Skip to content

Capture HTTP request/response headers as span attributes #906

@ashu658

Description

@ashu658

Is your feature request related to a problem?
Python agent is not able to capture custom headers as of now. The specifications for capturing request/response headers is defined here http-request-response-header

Describe the solution you'd like
This feature aims to capture custom request/response headers with the help of environment variables.I think these environment variables should be same for all the frameworks (something like OTEL_PYTHON_CAPTURE_REQUEST_HEADERS, OTEL_PYTHON_CAPTURE_RESPONSE_HEADERS) and the request/response headers will only be added in case of a server span.

Currently, some frameworks like falcon and django captures custom request headers with the help of environment variables (i.e. OTEL_PYTHON_FALCON_TRACED_REQUEST_ATTRS etc). I suggest we should change the environment variable from being framework specific to be general for all the frameworks.

We can open multiple sub-issues to add support and test cases for each framework.

Additional context
With conditional server span creation #445 added we can ensure single server span creation and no two frameworks capturing the same headers.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions