11import type { Span as WriteableSpan } from '@opentelemetry/api' ;
22import type { Instrumentation } from '@opentelemetry/instrumentation' ;
33import type { ReadableSpan , SpanProcessor } from '@opentelemetry/sdk-trace-base' ;
4- import type { ClientOptions , Options , SamplingContext , Scope , Span , TracePropagationTargets } from '@sentry/core' ;
4+ import type { ClientOptions , Options , SamplingContext , Scope , ServerRuntimeOptions , Span } from '@sentry/core' ;
55import type { NodeTransportOptions } from './transports' ;
66
7- export interface BaseNodeOptions {
7+ /**
8+ * Base options for WinterTC-compatible server-side JavaScript runtimes with OpenTelemetry support.
9+ * This interface extends the base ServerRuntimeOptions from @sentry/core with OpenTelemetry-specific configuration options.
10+ * Used by Node.js, Bun, and other WinterTC-compliant runtime SDKs that support OpenTelemetry instrumentation.
11+ */
12+ export interface OpenTelemetryServerRuntimeOptions extends ServerRuntimeOptions {
813 /**
9- * List of strings/regex controlling to which outgoing requests
10- * the SDK will attach tracing headers.
11- *
12- * By default the SDK will attach those headers to all outgoing
13- * requests. If this option is provided, the SDK will match the
14- * request URL of outgoing requests against the items in this
15- * array, and only attach tracing headers if a match was found.
14+ * If this is set to true, the SDK will not set up OpenTelemetry automatically.
15+ * In this case, you _have_ to ensure to set it up correctly yourself, including:
16+ * * The `SentrySpanProcessor`
17+ * * The `SentryPropagator`
18+ * * The `SentryContextManager`
19+ * * The `SentrySampler`
20+ */
21+ skipOpenTelemetrySetup ?: boolean ;
22+
23+ /**
24+ * Provide an array of OpenTelemetry Instrumentations that should be registered.
1625 *
17- * @example
18- * ```js
19- * Sentry.init({
20- * tracePropagationTargets: ['api.site.com'],
21- * });
22- * ```
26+ * Use this option if you want to register OpenTelemetry instrumentation that the Sentry SDK does not yet have support for.
2327 */
24- tracePropagationTargets ?: TracePropagationTargets ;
28+ openTelemetryInstrumentations ?: Instrumentation [ ] ;
29+
30+ /**
31+ * Provide an array of additional OpenTelemetry SpanProcessors that should be registered.
32+ */
33+ openTelemetrySpanProcessors ?: SpanProcessor [ ] ;
34+ }
2535
36+ /**
37+ * Base options for the Sentry Node SDK.
38+ * Extends the common WinterTC options with OpenTelemetry support shared with Bun and other server-side SDKs.
39+ */
40+ export interface BaseNodeOptions extends OpenTelemetryServerRuntimeOptions {
2641 /**
2742 * Sets profiling sample rate when @sentry/profiling-node is installed
2843 *
@@ -61,61 +76,13 @@ export interface BaseNodeOptions {
6176 */
6277 profileLifecycle ?: 'manual' | 'trace' ;
6378
64- /**
65- * If set to `false`, the SDK will not automatically detect the `serverName`.
66- *
67- * This is useful if you are using the SDK in a CLI app or Electron where the
68- * hostname might be considered PII.
69- *
70- * @default true
71- */
72- includeServerName ?: boolean ;
73-
74- /** Sets an optional server name (device name) */
75- serverName ?: string ;
76-
7779 /**
7880 * Include local variables with stack traces.
7981 *
8082 * Requires the `LocalVariables` integration.
8183 */
8284 includeLocalVariables ?: boolean ;
8385
84- /**
85- * If you use Spotlight by Sentry during development, use
86- * this option to forward captured Sentry events to Spotlight.
87- *
88- * Either set it to true, or provide a specific Spotlight Sidecar URL.
89- *
90- * More details: https://spotlightjs.com/
91- *
92- * IMPORTANT: Only set this option to `true` while developing, not in production!
93- */
94- spotlight ?: boolean | string ;
95-
96- /**
97- * Provide an array of OpenTelemetry Instrumentations that should be registered.
98- *
99- * Use this option if you want to register OpenTelemetry instrumentation that the Sentry SDK does not yet have support for.
100- */
101- openTelemetryInstrumentations ?: Instrumentation [ ] ;
102-
103- /**
104- * Provide an array of additional OpenTelemetry SpanProcessors that should be registered.
105- */
106- openTelemetrySpanProcessors ?: SpanProcessor [ ] ;
107-
108- /**
109- * The max. duration in seconds that the SDK will wait for parent spans to be finished before discarding a span.
110- * The SDK will automatically clean up spans that have no finished parent after this duration.
111- * This is necessary to prevent memory leaks in case of parent spans that are never finished or otherwise dropped/missing.
112- * However, if you have very long-running spans in your application, a shorter duration might cause spans to be discarded too early.
113- * In this case, you can increase this duration to a value that fits your expected data.
114- *
115- * Defaults to 300 seconds (5 minutes).
116- */
117- maxSpanWaitDuration ?: number ;
118-
11986 /**
12087 * Whether to register ESM loader hooks to automatically instrument libraries.
12188 * This is necessary to auto instrument libraries that are loaded via ESM imports, but it can cause issues
@@ -125,28 +92,6 @@ export interface BaseNodeOptions {
12592 * Defaults to `true`.
12693 */
12794 registerEsmLoaderHooks ?: boolean ;
128-
129- /**
130- * Configures in which interval client reports will be flushed. Defaults to `60_000` (milliseconds).
131- */
132- clientReportFlushInterval ?: number ;
133-
134- /**
135- * By default, the SDK will try to identify problems with your instrumentation setup and warn you about it.
136- * If you want to disable these warnings, set this to `true`.
137- */
138- disableInstrumentationWarnings ?: boolean ;
139-
140- /**
141- * Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause
142- * problems for sending events from command line applications. Setting it too
143- * high can cause the application to block for users with network connectivity
144- * problems.
145- */
146- shutdownTimeout ?: number ;
147-
148- /** Callback that is executed when a fatal global error occurs. */
149- onFatalError ?( this : void , error : Error ) : void ;
15095}
15196
15297/**
0 commit comments