From 9d8005843c074958f629f9496fe7e2c16a96a9cf Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Tue, 12 Apr 2022 14:45:16 -0600 Subject: [PATCH] [otelhttp] Remove propagation header injection (#2180) * remove propagation header injection * Updated changelog * Update CHANGELOG.md Co-authored-by: Chester Cheung Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + instrumentation/net/http/otelhttp/test/handler_test.go | 3 --- instrumentation/net/http/otelhttp/wrap.go | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf3b96ad4e..d34cf803f27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix the `otelmux` middleware by using `SpanKindServer` when deciding the `SpanStatus`. This makes `4xx` response codes to not be an error anymore. (#1973) - Fixed jaegerremote sampler not behaving properly with per operation strategy set. (#2137) +- Stopped injecting propagation context into response headers in otelhttp. (#2180) ## [1.6.0/0.31.0] - 2022-03-28 diff --git a/instrumentation/net/http/otelhttp/test/handler_test.go b/instrumentation/net/http/otelhttp/test/handler_test.go index 846da724d51..59909cf7b53 100644 --- a/instrumentation/net/http/otelhttp/test/handler_test.go +++ b/instrumentation/net/http/otelhttp/test/handler_test.go @@ -91,9 +91,6 @@ func TestHandlerBasics(t *testing.T) { if got, expected := rr.Result().StatusCode, http.StatusOK; got != expected { t.Fatalf("got %d, expected %d", got, expected) } - if got := rr.Header().Get("Traceparent"); got == "" { - t.Fatal("expected non empty trace header") - } spans := spanRecorder.Ended() if got, expected := len(spans), 1; got != expected { diff --git a/instrumentation/net/http/otelhttp/wrap.go b/instrumentation/net/http/otelhttp/wrap.go index b453b92e4cc..d55f0d6f5a9 100644 --- a/instrumentation/net/http/otelhttp/wrap.go +++ b/instrumentation/net/http/otelhttp/wrap.go @@ -91,6 +91,5 @@ func (w *respWriterWrapper) WriteHeader(statusCode int) { } w.wroteHeader = true w.statusCode = statusCode - w.props.Inject(w.ctx, propagation.HeaderCarrier(w.Header())) w.ResponseWriter.WriteHeader(statusCode) }