Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpClient instrumentation does not handle case when tracing headers are content headers #1843

Closed
nrcventura opened this issue Aug 9, 2023 · 1 comment · Fixed by #1888
Closed
Labels
bug Something isn't working

Comments

@nrcventura
Copy link
Member

The HttpClient instrumentation currently handles the case when the distributed tracing and CAT headers are defined in the request headers but it does not handle the case when the tracing headers are already defined as content headers.

Description

The HttpClient instrumentation currently handles the case when the distributed tracing and CAT headers are defined in the request headers. It handles this by first removing the existing headers, and then adding the expected headers for the request. However, if these tracing headers are present in the content headers collection, the agent does not detect them and it results in 2 tracing headers being present in the external request. This results in broken traces.

Expected Behavior

The agent should replace any tracing headers defined on both the request and the content, and the appropriate headers should be added to the request (not the content).

Troubleshooting or NR Diag results

Steps to Reproduce

  1. Add a tracing header to an outbound HttpClient request using code like the following.
    request.Content.Headers.TryAddWithoutValidation("newrelic", "newrelic2");
  2. Perform the outbound call in an instrumented app.
  3. Observe in the downstream request that there are multple newrelic header values. One added by the agent and the other added using the above code.

Note that request.Headers.Add("newrelic", $"newrelic1"); does not result in multiple header values being observed in the downstream request.

Your Environment

Additional context

For Maintainers Only or Hero Triaging this bug
Suggested Priority (P1,P2,P3,P4,P5): P5
Suggested T-Shirt size (S, M, L, XL, Unknown): M (most of the effort is probably in the integration tests for the different tracing types -- W3C, New Relic DT, CAT)

@nrcventura nrcventura added the bug Something isn't working label Aug 9, 2023
@workato-integration
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant