|
1 | 1 | import type { Integration, Options, Scope } from '@sentry/core';
|
2 |
| -import { applySdkMetadata, debug, getSDKSource } from '@sentry/core'; |
| 2 | +import { applySdkMetadata, consoleSandbox, debug, getSDKSource } from '@sentry/core'; |
3 | 3 | import type { NodeClient, NodeOptions } from '@sentry/node';
|
4 | 4 | import {
|
5 | 5 | captureException,
|
@@ -45,6 +45,11 @@ export interface WrapperOptions {
|
45 | 45 | * @default false
|
46 | 46 | */
|
47 | 47 | captureAllSettledReasons: boolean;
|
| 48 | + /** |
| 49 | + * @deprecated This option has no effect since OpenTelemetry always traces the handler. |
| 50 | + * If you want to disable tracing, set `SENTRY_TRACES_SAMPLE_RATE` to `0.0`. |
| 51 | + */ |
| 52 | + startTrace: boolean; |
48 | 53 | }
|
49 | 54 |
|
50 | 55 | /**
|
@@ -204,14 +209,27 @@ export function wrapHandler<TEvent, TResult>(
|
204 | 209 | wrapOptions: Partial<WrapperOptions> = {},
|
205 | 210 | ): Handler<TEvent, TResult> {
|
206 | 211 | const START_TIME = performance.now();
|
| 212 | + |
| 213 | + // eslint-disable-next-line deprecation/deprecation |
| 214 | + if (typeof wrapOptions.startTrace !== 'undefined') { |
| 215 | + consoleSandbox(() => { |
| 216 | + // eslint-disable-next-line no-console |
| 217 | + console.warn( |
| 218 | + 'The `startTrace` option is deprecated and has no effect since OpenTelemetry always traces the handler. If you want to disable tracing, set `SENTRY_TRACES_SAMPLE_RATE` to `0.0`.', |
| 219 | + ); |
| 220 | + }); |
| 221 | + } |
| 222 | + |
207 | 223 | const options: WrapperOptions = {
|
208 | 224 | flushTimeout: 2000,
|
209 | 225 | callbackWaitsForEmptyEventLoop: false,
|
210 | 226 | captureTimeoutWarning: true,
|
211 | 227 | timeoutWarningLimit: 500,
|
212 | 228 | captureAllSettledReasons: false,
|
| 229 | + startTrace: true, |
213 | 230 | ...wrapOptions,
|
214 | 231 | };
|
| 232 | + |
215 | 233 | let timeoutWarningTimer: NodeJS.Timeout;
|
216 | 234 |
|
217 | 235 | // AWSLambda is like Express. It makes a distinction about handlers based on its last argument
|
|
0 commit comments