opentelemetry-go-instrumentation icon indicating copy to clipboard operation
opentelemetry-go-instrumentation copied to clipboard

Capture http request headers on spans

Open diecgia opened this issue 8 months ago • 1 comments

Hi, Currently, not all http headers are added to spans generated by otel-go. To determine the origin of the request, I want to add the "x-forwarded-for" http header to the spans.

I've seen that in java it is possible to add a property to capture the desired headers, for example, with the OTEL_INSTRUMENTATION_HTTP_CLIENT_CAPTURE_REQUEST_HEADERS env var: https://opentelemetry.io/docs/zero-code/java/agent/instrumentation/http/#capturing-http-request-and-response-headers

Would it be possible to enable these properties for go instrumentation or capture the "x-forwarded-for" header by default on the spans?

Thanks in advance!

diecgia avatar Mar 12 '25 08:03 diecgia