open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Cannot Capture Custom Headers from Instrumented Servers

Open
#13,390 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs triage
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

Describe the bug

Hi everyone,
I have attached the java opentelemetry agent to our application, anh I want to capture one custom header from its response to the clients.

This is the response header:

Date: Tue, 25 Feb 2025 06:12:47 GMT
X-Content-Type-Options: nosniff
Content-Length: 0
X-ORACLE-DMS-ECID: 006Bj5OWiBcA_MYjLp2VOA00060m000JuW
X-ORACLE-DMS-RID: 0:1
X-XSS-Protection: 1; mode=block
Keep-Alive: timeout=5, max=1000
Connection: Keep-Alive
Content-Type: text/xml; charset=iso-8859-1

And inside properties file, I use this configration:

otel.instrumentation.http.server.capture-response-headers=Content-Type,X-ORACLE-DMS-ECID

I dont understand why it only captures the Content-Type, but not the X-ORACLE-DMS-ECID header. Is there any additional configuration for the custom header.

Thank everyone.

Steps to reproduce

This is the response header:

Date: Tue, 25 Feb 2025 06:12:47 GMT
X-Content-Type-Options: nosniff
Content-Length: 0
X-ORACLE-DMS-ECID: 006Bj5OWiBcA_MYjLp2VOA00060m000JuW
X-ORACLE-DMS-RID: 0:1
X-XSS-Protection: 1; mode=block
Keep-Alive: timeout=5, max=1000
Connection: Keep-Alive
Content-Type: text/xml; charset=iso-8859-1

The configuration:

otel.instrumentation.http.server.capture-response-headers=Content-Type,X-ORACLE-DMS-ECID

Expected behavior

It should show both values for the configured headers.

Actual behavior

It should show both values for the configured headers.

Javaagent or library instrumentation version

1.37

Environment

JDK:
OS:

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Java agent 1.37 behavior with the listed response headers and the otel.instrumentation.http.server.capture-response-headers configuration. Compare capture of Content-Type with X-ORACLE-DMS-ECID, and consider the issue resolved when both configured response-header values are captured.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.