1 | import type { Span as WriteableSpan } from '@opentelemetry/api';
|
2 | import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
3 | import type { ClientOptions, Options, SamplingContext, Scope, Span, TracePropagationTargets } from '@sentry/types';
|
4 | import type { NodeTransportOptions } from './transports';
|
5 | export interface EsmLoaderHookOptions {
|
6 | include?: Array<string | RegExp>;
|
7 | exclude?: Array<string | RegExp> /**
|
8 | * When set to `true`, `import-in-the-middle` will only wrap ESM modules that are specifically instrumented by
|
9 | * OpenTelemetry plugins. This is useful to avoid issues where `import-in-the-middle` is not compatible with some of
|
10 | * your dependencies.
|
11 | *
|
12 | * **Note**: This feature will only work if you `Sentry.init()` the SDK before the instrumented modules are loaded.
|
13 | * This can be achieved via the Node `--import` CLI flag or by loading your app via async `import()` after calling
|
14 | * `Sentry.init()`.
|
15 | *
|
16 | * Defaults to `false`.
|
17 | */;
|
18 | onlyIncludeInstrumentedModules?: boolean;
|
19 | }
|
20 | export interface BaseNodeOptions {
|
21 | /**
|
22 | * List of strings/regex controlling to which outgoing requests
|
23 | * the SDK will attach tracing headers.
|
24 | *
|
25 | * By default the SDK will attach those headers to all outgoing
|
26 | * requests. If this option is provided, the SDK will match the
|
27 | * request URL of outgoing requests against the items in this
|
28 | * array, and only attach tracing headers if a match was found.
|
29 | *
|
30 | * @example
|
31 | * ```js
|
32 | * Sentry.init({
|
33 | * tracePropagationTargets: ['api.site.com'],
|
34 | * });
|
35 | * ```
|
36 | */
|
37 | tracePropagationTargets?: TracePropagationTargets;
|
38 | /**
|
39 | * Sets profiling sample rate when @sentry/profiling-node is installed
|
40 | */
|
41 | profilesSampleRate?: number;
|
42 | /**
|
43 | * Function to compute profiling sample rate dynamically and filter unwanted profiles.
|
44 | *
|
45 | * Profiling is enabled if either this or `profilesSampleRate` is defined. If both are defined, `profilesSampleRate` is
|
46 | * ignored.
|
47 | *
|
48 | * Will automatically be passed a context object of default and optional custom data. See
|
49 | * {@link Transaction.samplingContext} and {@link Hub.startTransaction}.
|
50 | *
|
51 | * @returns A sample rate between 0 and 1 (0 drops the profile, 1 guarantees it will be sent). Returning `true` is
|
52 | * equivalent to returning 1 and returning `false` is equivalent to returning 0.
|
53 | */
|
54 | profilesSampler?: (samplingContext: SamplingContext) => number | boolean;
|
55 | /** Sets an optional server name (device name) */
|
56 | serverName?: string;
|
57 | /**
|
58 | * Include local variables with stack traces.
|
59 | *
|
60 | * Requires the `LocalVariables` integration.
|
61 | */
|
62 | includeLocalVariables?: boolean;
|
63 | /**
|
64 | * If you use Spotlight by Sentry during development, use
|
65 | * this option to forward captured Sentry events to Spotlight.
|
66 | *
|
67 | * Either set it to true, or provide a specific Spotlight Sidecar URL.
|
68 | *
|
69 | * More details: https://spotlightjs.com/
|
70 | *
|
71 | * IMPORTANT: Only set this option to `true` while developing, not in production!
|
72 | */
|
73 | spotlight?: boolean | string;
|
74 | /**
|
75 | * If this is set to true, the SDK will not set up OpenTelemetry automatically.
|
76 | * In this case, you _have_ to ensure to set it up correctly yourself, including:
|
77 | * * The `SentrySpanProcessor`
|
78 | * * The `SentryPropagator`
|
79 | * * The `SentryContextManager`
|
80 | * * The `SentrySampler`
|
81 | */
|
82 | skipOpenTelemetrySetup?: boolean;
|
83 | /**
|
84 | * The max. duration in seconds that the SDK will wait for parent spans to be finished before discarding a span.
|
85 | * The SDK will automatically clean up spans that have no finished parent after this duration.
|
86 | * This is necessary to prevent memory leaks in case of parent spans that are never finished or otherwise dropped/missing.
|
87 | * However, if you have very long-running spans in your application, a shorter duration might cause spans to be discarded too early.
|
88 | * In this case, you can increase this duration to a value that fits your expected data.
|
89 | *
|
90 | * Defaults to 300 seconds (5 minutes).
|
91 | */
|
92 | maxSpanWaitDuration?: number;
|
93 | /**
|
94 | * Whether to register ESM loader hooks to automatically instrument libraries.
|
95 | * This is necessary to auto instrument libraries that are loaded via ESM imports, but it can cause issues
|
96 | * with certain libraries. If you run into problems running your app with this enabled,
|
97 | * please raise an issue in https://github.com/getsentry/sentry-javascript.
|
98 | *
|
99 | * You can optionally exclude specific modules or only include specific modules from being instrumented by providing
|
100 | * an object with `include` or `exclude` properties.
|
101 | *
|
102 | * ```js
|
103 | * registerEsmLoaderHooks: {
|
104 | * exclude: ['openai'],
|
105 | * }
|
106 | * ```
|
107 | *
|
108 | * Defaults to `true`.
|
109 | */
|
110 | registerEsmLoaderHooks?: boolean | EsmLoaderHookOptions;
|
111 | /**
|
112 | * Configures in which interval client reports will be flushed. Defaults to `60_000` (milliseconds).
|
113 | */
|
114 | clientReportFlushInterval?: number;
|
115 | /** Callback that is executed when a fatal global error occurs. */
|
116 | onFatalError?(this: void, error: Error): void;
|
117 | }
|
118 | /**
|
119 | * Configuration options for the Sentry Node SDK
|
120 | * @see @sentry/types Options for more information.
|
121 | */
|
122 | export interface NodeOptions extends Options<NodeTransportOptions>, BaseNodeOptions {
|
123 | }
|
124 | /**
|
125 | * Configuration options for the Sentry Node SDK Client class
|
126 | * @see NodeClient for more information.
|
127 | */
|
128 | export interface NodeClientOptions extends ClientOptions<NodeTransportOptions>, BaseNodeOptions {
|
129 | }
|
130 | export interface CurrentScopes {
|
131 | scope: Scope;
|
132 | isolationScope: Scope;
|
133 | }
|
134 | /**
|
135 | * The base `Span` type is basically a `WriteableSpan`.
|
136 | * There are places where we basically want to allow passing _any_ span,
|
137 | * so in these cases we type this as `AbstractSpan` which could be either a regular `Span` or a `ReadableSpan`.
|
138 | * You'll have to make sur to check revelant fields before accessing them.
|
139 | *
|
140 | * Note that technically, the `Span` exported from `@opentelemwetry/sdk-trace-base` matches this,
|
141 | * but we cannot be 100% sure that we are actually getting such a span, so this type is more defensive.
|
142 | */
|
143 | export type AbstractSpan = WriteableSpan | ReadableSpan | Span;
|
144 | //# sourceMappingURL=types.d.ts.map |
\ | No newline at end of file |