Skip to content

feat(aws-serverless): Emit low cardinality function.aws span names - #24072

Merged
Lms24 merged 4 commits into
lms/feat-server-utils-firebase-span-namesfrom
lms/feat-aws-faas-span-names
Sep 8, 2026
Merged

feat(aws-serverless): Emit low cardinality function.aws span names#24072
Lms24 merged 4 commits into
lms/feat-server-utils-firebase-span-namesfrom
lms/feat-aws-faas-span-names

Conversation

@Lms24

@Lms24 Lms24 commented Sep 4, 2026

Copy link
Copy Markdown
Member

Small adjustment: When streaming is enabled and we can't get a function name, we fall back to the string name.
Additionally, added the sentry.segment.name.source attribute which was missing previously, in line with GCP, set to route. Other than that the span name already fitted conventions, so no more changes necessary.

To test, this converts the AWS Lambda test to span streaming. The other (layer one) is unchanged, to be converted later.

ref #23954

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.8 kB added added
@sentry/browser - with treeshaking flags 27.11 kB added added
@sentry/browser - with treeshaking flags tracing without tracing 27 kB added added
@sentry/browser (incl. Tracing) 49.22 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 49.22 kB added added
@sentry/browser (incl. Tracing, Profiling) 52.12 kB added added
@sentry/browser (incl. Tracing, Replay) 88.76 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.95 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 93.44 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 106.37 kB added added
@sentry/browser (incl. Feedback) 46.3 kB added added
@sentry/browser (incl. sendFeedback) 33.86 kB added added
@sentry/browser (incl. FeedbackAsync) 38.97 kB added added
@sentry/browser (incl. Metrics) 29.82 kB added added
@sentry/browser (incl. Logs) 30.09 kB added added
@sentry/browser (incl. Metrics & Logs) 30.75 kB added added
@sentry/react 30.55 kB added added
@sentry/react (incl. Tracing) 51.56 kB added added
@sentry/vue 36.05 kB added added
@sentry/vue (incl. Tracing) 51.48 kB added added
@sentry/svelte 28.83 kB added added
CDN Bundle 30.55 kB added added
CDN Bundle (incl. Tracing) 49.74 kB added added
CDN Bundle (incl. Logs, Metrics) 32.82 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 51.7 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 73.48 kB added added
CDN Bundle (incl. Tracing, Replay) 87.29 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.18 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 93.22 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.21 kB added added
CDN Bundle - uncompressed 90.46 kB added added
CDN Bundle (incl. Tracing) - uncompressed 148.17 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.03 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 154.14 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.29 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.76 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.71 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.46 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 287.4 kB added added
@sentry/nextjs (client) 54 kB added added
@sentry/sveltekit (client) 49.65 kB added added
@sentry/core/server 36.99 kB added added
@sentry/core/browser 13.55 kB added added
@sentry/node 127.86 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.61 kB added added
@sentry/node - without tracing 88.73 kB added added
@sentry/node - without channel injection 107.11 kB added added
@sentry/aws-serverless 97.12 kB added added
@sentry/cloudflare (withSentry) - minified 201.98 kB added added
@sentry/cloudflare (withSentry) 502.68 kB added added

View base workflow run

@Lms24
Lms24 force-pushed the lms/feat-aws-faas-span-names branch from 775eeab to 4939949 Compare September 4, 2026 11:11
@Lms24
Lms24 force-pushed the lms/feat-aws-faas-span-names branch from a289648 to 4e43ca6 Compare September 4, 2026 12:11
@Lms24 Lms24 self-assigned this Sep 4, 2026
@Lms24
Lms24 marked this pull request as ready for review September 4, 2026 12:14
@Lms24
Lms24 requested a review from a team as a code owner September 4, 2026 12:14
@Lms24
Lms24 requested review from isaacs, msonnb and mydea and removed request for a team September 4, 2026 12:14
Lms24 and others added 4 commits September 8, 2026 16:22
`function.aws` spans were already named after the Lambda function, which is what the
`{{faas.name}}` template in the Sentry span name conventions asks for, so their names do
not change. What was missing is the conventions' static fallback: when the invocation
context carries no function name, the span was started with an empty name and `faas.name`
was left unset.

Resolve the function name from `context.functionName` or the `AWS_LAMBDA_FUNCTION_NAME`
environment variable, use it for both the span name and `faas.name`, and fall back to
`Serverless function execution` under span streaming. Without span streaming the name stays
byte-identical to before.

Refs #23954
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`requestSpanOptions.test.ts` asserted the start-span options object against a mocked
client. The `aws-serverless` e2e app now runs on span streaming and covers the same
ground against a real Lambda, so the unit tests only duplicated it.

The one branch e2e cannot reach is the `Serverless function execution` fallback: Lambda
always populates `context.functionName`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ame source

`function.aws` spans left `sentry.segment.name.source` unset, so it defaulted to
`custom` — which claims the user named the span. The name comes from the Lambda
function, so `component` is what it is, and it matches the other FaaS spans.

Applies in both trace lifecycles, so the static layer suite and the streamed npm
suite are updated alongside it.

Refs #23954
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/feat-aws-faas-span-names branch from 4e43ca6 to 7045f2a Compare September 8, 2026 14:23

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7045f2a. Configure here.

Comment thread packages/aws-serverless/src/requestSpanOptions.ts
@Lms24
Lms24 merged commit 03aaf42 into develop Sep 8, 2026
53 of 82 checks passed
@Lms24
Lms24 deleted the lms/feat-aws-faas-span-names branch September 8, 2026 14:44
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