Skip to content

Commit

Permalink
fix: rename startTransaction -> startTrace
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenquimby committed Oct 12, 2023
1 parent 8dd15ac commit ad72d86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/serverless/src/awslambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface WrapperOptions {
* You may want to disable this if you use express within Lambda (use tracingHandler instead).
* @default true
*/
startTransaction: boolean;
startTrace: boolean;
}

export const defaultIntegrations: Integration[] = [...Sentry.defaultIntegrations, new AWSServices({ optional: true })];
Expand Down Expand Up @@ -235,7 +235,7 @@ export function wrapHandler<TEvent, TResult>(
captureTimeoutWarning: true,
timeoutWarningLimit: 500,
captureAllSettledReasons: false,
startTransaction: true,
startTrace: true,
...wrapOptions,
};
let timeoutWarningTimer: NodeJS.Timeout;
Expand Down Expand Up @@ -294,7 +294,7 @@ export function wrapHandler<TEvent, TResult>(
const hub = getCurrentHub();

let transaction: Sentry.Transaction | undefined;
if (options.startTransaction) {
if (options.startTrace) {
const eventWithHeaders = event as { headers?: { [key: string]: string } };

const sentryTrace =
Expand Down Expand Up @@ -324,7 +324,7 @@ export function wrapHandler<TEvent, TResult>(
let rv: TResult;
try {
enhanceScopeWithEnvironmentData(scope, context, START_TIME);
if (options.startTransaction) {
if (options.startTrace) {
enhanceScopeWithTransactionData(scope, context);
// We put the transaction on the scope so users can attach children to it
scope.setSpan(transaction);
Expand Down
6 changes: 3 additions & 3 deletions packages/serverless/test/awslambda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ describe('AWSLambda', () => {
expect(SentryNode.captureException).toBeCalledTimes(2);
});

// "wrapHandler() ... successful execution" tests the default of startTransaction enabled
test('startTransaction disabled', async () => {
// "wrapHandler() ... successful execution" tests the default of startTrace enabled
test('startTrace disabled', async () => {
expect.assertions(3);

const handler: Handler = async (_event, _context) => 42;
const wrappedHandler = wrapHandler(handler, { startTransaction: false });
const wrappedHandler = wrapHandler(handler, { startTrace: false });
await wrappedHandler(fakeEvent, fakeContext, fakeCallback);

// @ts-expect-error see "Why @ts-expect-error" note
Expand Down

0 comments on commit ad72d86

Please sign in to comment.