Skip to content

Support capturing HTTP request/response headers via environment variables in Node.js auto-instrumentation #3002

@Abhijeetpradhan

Description

@Abhijeetpradhan

Issue:
Currently, in Node.js auto-instrumentation, capturing request or response headers requires code-level hooks (e.g., requestHook/responseHook). There is no support for configuring this via environment variables.

In contrast, the Java agent supports header capture through env vars like OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS

Is there any similar support of capturing request and response headers or if not would it be possible to add similar support to the Node.js auto-instrumentation, to allow declarative configuration via environment variables?

Dependencies used:
{
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/auto-instrumentations-node": "^0.60.1",
"@opentelemetry/exporter-trace-otlp-proto": "^0.202.0",
"@opentelemetry/sdk-metrics": "^2.0.1",
"@opentelemetry/sdk-node": "^0.202.0",
"@opentelemetry/sdk-trace-base": "^2.0.1"
}
Node.js version: node v16.20.2 and above

Thanks for your consideration!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions