diff --git a/CHANGELOG.md b/CHANGELOG.md index e53ce06904a..4bcc75fa442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - The `"go.opentelemetry.io/contrib/detector/aws/ecs".Detector` no longer errors if not running in ECS. (#1426, #1428) +- `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux` + does not require instrumented HTTP handlers to call `Write` nor + `WriteHeader` anymore. (#1443) ## [1.2.0/0.27.0] - 2021-11-15 @@ -46,7 +49,7 @@ Update dependency on the `go.opentelemetry.io/otel` project to `v1.1.0`. - Add instrumentation for the `github.com/aws/aws-lambda-go` package. (#983) - Add resource detector for AWS Lambda. (#983) - Add `WithTracerProvider` option for `otelhttptrace.NewClientTrace`. (#1128) -- Add optional AWS X-Ray configuration module for AWS Lambda Instrumentation (#984) +- Add optional AWS X-Ray configuration module for AWS Lambda Instrumentation. (#984) ### Fixed diff --git a/instrumentation/github.com/gorilla/mux/otelmux/mux.go b/instrumentation/github.com/gorilla/mux/otelmux/mux.go index d805e44ea8e..7df7b0cf73f 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/mux.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/mux.go @@ -83,13 +83,12 @@ var rrwPool = &sync.Pool{ func getRRW(writer http.ResponseWriter) *recordingResponseWriter { rrw := rrwPool.Get().(*recordingResponseWriter) rrw.written = false - rrw.status = 0 + rrw.status = http.StatusOK rrw.writer = httpsnoop.Wrap(writer, httpsnoop.Hooks{ Write: func(next httpsnoop.WriteFunc) httpsnoop.WriteFunc { return func(b []byte) (int, error) { if !rrw.written { rrw.written = true - rrw.status = http.StatusOK } return next(b) } diff --git a/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go b/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go index 0f41e01ab87..78c25b622b4 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go @@ -30,9 +30,7 @@ import ( "go.opentelemetry.io/otel/trace" ) -func ok(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(http.StatusOK) -} +func ok(w http.ResponseWriter, _ *http.Request) {} func TestSDKIntegration(t *testing.T) { sr := tracetest.NewSpanRecorder()