Skip to content

ref(aws-serverless): Streamline AwsLambda instrumentation#21758

Draft
nicohrubec wants to merge 4 commits into
developfrom
nh/streamline-aws-lambda
Draft

ref(aws-serverless): Streamline AwsLambda instrumentation#21758
nicohrubec wants to merge 4 commits into
developfrom
nh/streamline-aws-lambda

Conversation

@nicohrubec

@nicohrubec nicohrubec commented Jun 24, 2026

Copy link
Copy Markdown
Member

Streamlines the AWS Lambda instrumentation.

The Lambda span is now created via the @sentry/core startInactiveSpan API — within the extracted parent context (otelContext.with(parent, …)) so incoming trace propagation is preserved — and activated with withActiveSpan, instead of tracer.startSpan + trace.setSpan. The integration's requestHook (origin/op) and responseHook (captureException with mechanism auto.function.aws_serverless.otel) are folded directly into the instrumentation, and the hook config is removed. eventContextExtractor, disableAwsContextPropagation, force-flush, the Sentry wrapHandler layering, and InstrumentationBase scaffolding are kept.

otel.kind: SERVER is preserved via the kind option on startInactiveSpan; OTel recordException is dropped (errors are captured via captureException).

Also adds e2e coverage for handler paths the existing async-only suite missed — callback-style handlers (success + error) and trace continuation from incoming headers. These pass both before and after the streamline, guarding that the migration is behavior-preserving.

Ref JS-2849

🤖 Generated with Claude Code

nicohrubec and others added 2 commits June 24, 2026 15:48
… e2e coverage

Adds e2e cases for callback-style handlers (success + error) and trace
continuation from incoming headers, covering paths the existing async-only
suite missed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Create the Lambda span via the `@sentry/core` `startInactiveSpan` API (within the
extracted parent context) instead of the OTel tracer, and fold the integration's
`requestHook` (origin/op) and `responseHook` (captureException) directly into the
instrumentation. `otel.kind: SERVER` is preserved via the `kind` option.

Ref JS-2849

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 24, 2026

Copy link
Copy Markdown

JS-2849

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.47 kB - -
@sentry/browser - with treeshaking flags 25.91 kB - -
@sentry/browser (incl. Tracing) 45.97 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.72 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.76 kB - -
@sentry/browser (incl. Tracing, Replay) 85.22 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.81 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.91 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.57 kB - -
@sentry/browser (incl. Feedback) 44.66 kB - -
@sentry/browser (incl. sendFeedback) 32.26 kB - -
@sentry/browser (incl. FeedbackAsync) 37.4 kB - -
@sentry/browser (incl. Metrics) 28.54 kB - -
@sentry/browser (incl. Logs) 28.78 kB - -
@sentry/browser (incl. Metrics & Logs) 29.47 kB - -
@sentry/react 29.27 kB - -
@sentry/react (incl. Tracing) 48.28 kB - -
@sentry/vue 32.63 kB - -
@sentry/vue (incl. Tracing) 47.84 kB - -
@sentry/svelte 27.5 kB - -
CDN Bundle 29.89 kB - -
CDN Bundle (incl. Tracing) 47.89 kB - -
CDN Bundle (incl. Logs, Metrics) 31.44 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.24 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.78 kB - -
CDN Bundle (incl. Tracing, Replay) 85.4 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.68 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.19 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.45 kB - -
CDN Bundle - uncompressed 88.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.03 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 93.65 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.62 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.05 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.69 kB - -
@sentry/nextjs (client) 50.67 kB - -
@sentry/sveltekit (client) 46.37 kB - -
@sentry/core/server 76.5 kB - -
@sentry/core/browser 63.63 kB - -
@sentry/node-core 61.51 kB - -
@sentry/node 122.65 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.4 kB - -
@sentry/node - without tracing 73.55 kB - -
@sentry/aws-serverless 84.52 kB -0.26% -215 B 🔽
@sentry/cloudflare (withSentry) - minified 176.01 kB - -
@sentry/cloudflare (withSentry) 437.76 kB - -

View base workflow run

@nicohrubec nicohrubec changed the base branch from nh/aws-lambda-tests to develop June 24, 2026 14:16
nicohrubec and others added 2 commits June 24, 2026 16:26
…gging

Remove the vendored internal-types.ts (inline the one-line LambdaModule type)
and replace OTel `diag` logging with Sentry's `debug` (gated on DEBUG_BUILD),
dropping the `diag` import.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…cate disableAwsContextPropagation

The eventContextExtractor option was hardcoded and never user-overridable, so
inline Sentry's extractor directly and remove the unreachable default extractor
(and the now-unused headerGetter/propagation plumbing). Deprecate the
disableAwsContextPropagation option, which has been a no-op, and drop its dead
default in the instrument factory.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant