feat: extract HTTP semconv attributes for API Gateway-triggered invocations - #86
Open
RaphaelManke wants to merge 6 commits into
Open
feat: extract HTTP semconv attributes for API Gateway-triggered invocations#86RaphaelManke wants to merge 6 commits into
RaphaelManke wants to merge 6 commits into
Conversation
mmanciop
reviewed
Aug 26, 2026
| | `http.request.method` | string | The HTTP method. API Gateway-triggered invocations only. | | ||
| | `url.path` | string | The request path. API Gateway-triggered invocations only. | | ||
| | `url.scheme` | string | Always `https`. API Gateway-triggered invocations only. | | ||
| | `http.route` | string | The matched route template, with path parameters normalized (`{id}` -> `:id`). API Gateway-triggered invocations only. | |
Member
There was a problem hiding this comment.
AFAIK there is no mandated format to express parameters in http.route, so I am not sure we need the normalization
…ations Detects API Gateway REST API (v1) and HTTP API (v2) proxy integration events directly from the raw invoke event and return payload the extension already captures, independent of the in-function OpenTelemetry SDK. Adds http.request.method, url.path, url.scheme, http.route, server.address/port, client.address, network.protocol.version, and http.response.status_code to the handler span for every supported runtime, including when auto-instrumentation is disabled. Response attributes are gated on the invocation's request actually being an API Gateway event, not merely on the return value having a statusCode field, since other trigger types can happen to return one too (e.g. the integration test SQS/EventBridge consumers). Span renaming to "<method> <route>", request/response header capture, and query string capture are opt-in via new DASH0_* env vars, since none of the existing users' span names or PII exposure should change by default. Closes open-telemetry/opentelemetry-js-contrib#999 at the extension layer instead of the upstream instrumentation-aws-lambda package, since the extension already parses both payloads for every Lambda runtime.
RaphaelManke
force-pushed
the
RaphaelManke/Nodejs-http-attributes
branch
from
August 26, 2026 16:09
adde651 to
9ae055f
Compare
Tags each scenario/runtime's trace lookup with its producerTraceId so a failure (like the httpapi resourceSpans-not-found case) can be looked up directly in the backend instead of correlating interleaved concurrent test logs.
Drives a real HTTP API v2 invocation through the extension's own runtime-API proxy (no AWS deploy needed) and asserts the stored event payload is masked while the exported span's http.route attribute and name are not. Also moves the shared mock sandbox onto a dedicated OS thread so it survives across per-test tokio runtimes, fixing a hang that surfaced when two round-trip tests shared it.
CI confirmed the routeKey masking fix delivers the real, unmasked route for both apigateway and httpapi consumer spans, so the earlier toBeDefined() relaxation is no longer needed.
| invocation_entry::get_api_gateway_request_data(invocation_id); | ||
| attributes.extend(api_gateway_attributes); | ||
| if let Some(name) = api_gateway_span_name { | ||
| span_name = name; |
Collaborator
There was a problem hiding this comment.
are we sure we want to change the span name here? we decided that the handler span should be easily distinguishable from the name.
|
|
||
| ### API Gateway | ||
|
|
||
| When a Lambda is invoked through API Gateway, the extension recognizes both integration styles and adds HTTP semantic-convention attributes to the handler span: |
Collaborator
There was a problem hiding this comment.
i'm guessing this also works for lambda urls. if so, let's document it. if not, it might be worthwhile to add.
mosheshaham-dash0
approved these changes
Aug 31, 2026
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.
Summary
Adds HTTP semantic-convention attributes to the handler span for API Gateway REST API (v1) and HTTP API (v2) proxy integration invocations, addressing open-telemetry/opentelemetry-js-contrib#999 at the extension layer instead of the upstream
instrumentation-aws-lambdapackage.extension::runtime_proxy), so extraction runs independently of the in-function OpenTelemetry SDK — it works for every supported Lambda runtime (Node.js, Python, Java, .NET, Go), and even when auto-instrumentation is disabled and the extension builds a synthetic trace itself.http.request.method,url.path,url.scheme,http.route,server.address/server.port,client.address,network.protocol.version) andhttp.response.status_codeare captured unconditionally — none carry PII.<method> <route>, request/response header capture, and query-string capture are opt-in via newDASH0_*env vars, off by default so nothing changes for existing users.Test plan
cargo test— 302 tests pass, including new unit tests insrc/otlp/http_attributes.rsand a full request→response round-trip integration test insrc/extension/runtime_proxy.rsthat drives the realroute::dispatchhandler against a mock sandbox Runtime API.cargo clippy --all-targets— no new warnings.integration-tests/tests/src/test-tracing-scenarios-general.test.ts) to assert the new attributes on the existingapigateway/httpapiscenarios — needs a real CI run against deployed infra to confirm.