Skip to content

chore(aws): Remove manual span creation #17310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2025
Merged

Conversation

msonnb
Copy link
Member

@msonnb msonnb commented Aug 4, 2025

the TODO says this is likely not needed anymore since OTel correctly wraps the handler in all cases (I never ran into any situation where it didn't).

Also, when a user would use Sentry.wrapHandler manually, the detection mechanism checking whether the handler was already wrapped by OTel would not work anyway, since it that case OTel wraps it only after we did, resulting in double spans.

Also also, removing this makes our lives easier for streaming, where this resulted in some issues with overlapping spans.

@msonnb msonnb requested review from mydea and andreiborza August 4, 2025 14:14
@msonnb msonnb self-assigned this Aug 4, 2025
Comment on lines 57 to 62
/**
* Automatically trace all handler invocations.
* You may want to disable this if you use express within Lambda.
* @default true
*/
startTrace: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline: This is a breaking change so we can't just remove it. Let's mark this field as deprecated and add a warning log when it's used.

@@ -45,6 +45,11 @@ export interface WrapperOptions {
* @default false
*/
captureAllSettledReasons: boolean;
/**
* @deprecated This option has no effect since OpenTelemetry always traces the handler.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Let's also mention that this will be removed in a future major and also add a TODO(v11) comment above.

consoleSandbox(() => {
// eslint-disable-next-line no-console
console.warn(
'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`.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Same as above

const options: WrapperOptions = {
flushTimeout: 2000,
callbackWaitsForEmptyEventLoop: false,
captureTimeoutWarning: true,
timeoutWarningLimit: 500,
captureAllSettledReasons: false,
startTrace: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: And also let's add a TODO comment here and mention that this has no effect now but is kept in here for typing reasons.

@msonnb msonnb force-pushed the ms/aws-remove-manual-tracing branch from 22643ef to 0be3063 Compare August 4, 2025 15:13
@msonnb msonnb force-pushed the ms/aws-remove-manual-tracing branch from 0be3063 to bccae5f Compare August 5, 2025 07:12
@msonnb msonnb merged commit bcaca08 into develop Aug 5, 2025
162 checks passed
@msonnb msonnb deleted the ms/aws-remove-manual-tracing branch August 5, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants