Skip to content

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

Open
Lms24 wants to merge 4 commits into
lms/feat-server-utils-firebase-span-namesfrom
lms/feat-aws-faas-span-names
Open

feat(aws-serverless): Emit low cardinality function.aws span names#24072
Lms24 wants to merge 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.69 kB added added
@sentry/browser - with treeshaking flags 26.99 kB added added
@sentry/browser - with treeshaking flags tracing without tracing 26.89 kB added added
@sentry/browser (incl. Tracing) 49.07 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 49.07 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.98 kB added added
@sentry/browser (incl. Tracing, Replay) 88.62 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.85 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 93.3 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 106.24 kB added added
@sentry/browser (incl. Feedback) 46.17 kB added added
@sentry/browser (incl. sendFeedback) 33.75 kB added added
@sentry/browser (incl. FeedbackAsync) 38.85 kB added added
@sentry/browser (incl. Metrics) 29.66 kB added added
@sentry/browser (incl. Logs) 29.94 kB added added
@sentry/browser (incl. Metrics & Logs) 30.59 kB added added
@sentry/react 30.45 kB added added
@sentry/react (incl. Tracing) 51.28 kB added added
@sentry/vue 35.91 kB added added
@sentry/vue (incl. Tracing) 51.34 kB added added
@sentry/svelte 28.71 kB added added
CDN Bundle 30.43 kB added added
CDN Bundle (incl. Tracing) 49.6 kB added added
CDN Bundle (incl. Logs, Metrics) 32.66 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 51.53 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 73.31 kB added added
CDN Bundle (incl. Tracing, Replay) 87.15 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.02 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 93.08 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.03 kB added added
CDN Bundle - uncompressed 90.13 kB added added
CDN Bundle (incl. Tracing) - uncompressed 147.81 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.52 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.59 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.82 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.44 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.21 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.15 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.9 kB added added
@sentry/nextjs (client) 53.89 kB added added
@sentry/sveltekit (client) 49.51 kB added added
@sentry/core/server 40.96 kB added added
@sentry/core/browser 13.53 kB added added
@sentry/node 124.8 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.51 kB added added
@sentry/node - without tracing 88.5 kB added added
@sentry/node - without channel injection 104.11 kB added added
@sentry/aws-serverless 96.87 kB added added
@sentry/cloudflare (withSentry) - minified 201.56 kB added added
@sentry/cloudflare (withSentry) 501.37 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 and others added 4 commits September 4, 2026 14:11
`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 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
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