Skip to content

Commit 77bcd32

Browse files
committed
depracte option instead of removing
1 parent e6e96bc commit 77bcd32

File tree

1 file changed

+19
-1
lines changed
  • packages/aws-serverless/src

1 file changed

+19
-1
lines changed

packages/aws-serverless/src/sdk.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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';
33
import type { NodeClient, NodeOptions } from '@sentry/node';
44
import {
55
captureException,
@@ -45,6 +45,11 @@ export interface WrapperOptions {
4545
* @default false
4646
*/
4747
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;
4853
}
4954

5055
/**
@@ -204,14 +209,27 @@ export function wrapHandler<TEvent, TResult>(
204209
wrapOptions: Partial<WrapperOptions> = {},
205210
): Handler<TEvent, TResult> {
206211
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+
207223
const options: WrapperOptions = {
208224
flushTimeout: 2000,
209225
callbackWaitsForEmptyEventLoop: false,
210226
captureTimeoutWarning: true,
211227
timeoutWarningLimit: 500,
212228
captureAllSettledReasons: false,
229+
startTrace: true,
213230
...wrapOptions,
214231
};
232+
215233
let timeoutWarningTimer: NodeJS.Timeout;
216234

217235
// AWSLambda is like Express. It makes a distinction about handlers based on its last argument

0 commit comments

Comments
 (0)