Repository navigation
feat(aws-serverless): Add HTTP request and response attributes to function.aws spans - #26226
Merged
Merged
Conversation
…ction.aws spans Invocations triggered by a Lambda Function URL, API Gateway or ALB only carried url.full, so different requests to the same function were hard to tell apart. Add the http.server request attributes (method, path, query, scheme, server address/port, client address, user agent, protocol) plus faas.trigger, http.route from route templates only, and http.response.status_code from the handler result. Refs JS-4029 Co-Authored-By: Francesco Gringl-Novy <francesco.novy@sentry.io>
Contributor
size-limit report 📦Compared: 5956910 (PR test merge using develop at 6ee26d6) Against: 6ee26d6 (develop) · base run #65665 ✅ Baseline matches: this diff contains only this PR's changes.
|
mydea
reviewed
Nov 10, 2026
mydea
marked this pull request as ready for review
November 10, 2026 10:54
mydea
requested review from
andreiborza,
chargome,
logaretm,
msonnb and
nicohrubec
and removed request for
a team
November 10, 2026 10:54
API Gateway sends headers: null for requests without headers, which made getClientIPAddress throw before the handler ran. Also use conventions constants in the unit tests.
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 4 not successful, 53 successful. See the run.
Successful checks
|
msonnb
reviewed
Nov 11, 2026
…s-http-event-attributes
Reuses the payload-format aware path and query extraction for url.full and drops the separate extractFullUrl. client.address now prefers a forwarded address over sourceIp, like http.server spans.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 40097a3. Configure here.
msonnb
reviewed
Nov 11, 2026
msonnb
approved these changes
Nov 11, 2026
mydea
added a commit
that referenced
this pull request
Nov 11, 2026
…y default (#26228) **Why:** When a browser opens a Lambda Function URL, it also fetches `/favicon.ico`. That shows up as a second `function.aws` trace that looks like a duplicate (#25813). `init()` now adds default `ignoreSpans` filters for the invocations `http.server` spans skip by default: GET requests for static assets and metadata files (the same list as `isStaticAssetRequest` in core), and OPTIONS/HEAD requests. Filters users pass in are kept. **How to review:** This is stacked on #26226 because the filters match on the `http.request.method` and `url.path` attributes added there. Retarget to `develop` once that one merges. **Unsure about:** Static asset filtering can be turned off with `ignoreStaticAssets: false`, the same as `http.server`. OPTIONS/HEAD are always skipped. The regex duplicates core's `isStaticAssetRequest` because `ignoreSpans` only takes patterns, not functions. Refs #25813 <!-- junior-request-attribution:start --> via **Francesco Gringl-Novy**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0CA8FXFXAS%3A1794297679.791099 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CA8FXFXAS%3A1794297679.791099) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CA8FXFXAS%3A1794297679.791099/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <francesco.novy@sentry.io>
51 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why: When a Lambda runs behind a Function URL, API Gateway, or ALB, its
function.awsspan only hadurl.fullto say which request it handled. So two invocations of the same function (e.g./and the browser's/favicon.icofetch in #25813) looked like a duplicated trace. These spans now get the request attributeshttp.serverspans have:http.request.method,url.path,url.query,url.scheme,server.address/server.port,client.address(gated bydataCollection.userInfo, likehttp.server),user_agent.original,network.protocol.*,faas.trigger: http, andhttp.response.status_codefrom the handler result. None of these are deprecated in@sentry/conventions, and no existing attribute is removed or changed.http.routeis only set from route templates: the HTTP APIrouteKey(method prefix stripped) and the REST APIresource. Function URLs and$defaultroutes get no route. HTTP API payload format 1.0 also gets none, because it puts the raw path inresourcefor$default. The span name stays the function name so it stays low cardinality.How to review: Start with
httpEventAttributes.ts. The handler change only passes the event through so the status code can be set when the span ends.Unsure about: The status code only comes from a non-streaming result's
statusCode. For payload 2.0 a 200 is also inferred when the handler returns a value without one, since that's what AWS does. The span status isn't derived from the status code, because that would turn spans that areoktoday into errors. The new e2e test hasn't been run locally.Refs #25813
via Francesco Gringl-Novy.
--
View Session [Sentry]