-
Notifications
You must be signed in to change notification settings - Fork 41
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
http: superfluous response.WriteHeader call #84
Comments
Which version otelchi are you using it? and can you share how to replicate that? |
version
to replicate... I don't know.... we have large monorepo. probably something writes header, and then otelchi tries to write header again.. besides, how come otelchi is writing header of response? isn't it that monitoring libraries (control plane) are not supposed to modify data plane? some hints on how to repro this:
our main.go shows that it is very early in the stack of middleware, pretty much root. requestID and realIP do not write body nor status code and never error. there are no other routers or middleware. "github.com/go-chi/chi/v5"
...
func main() {
...
r := chi.NewRouter()
r.Use(middleware.RequestID)
r.Use(middleware.RealIP)
r.Use(otelchi.Middleware("server", otelchi.WithChiRoutes(r)))
...
} |
Thanks for raising this concern! Actually, it isn’t modifying the response. As you can see here, it only captures the initial status code for span attribution purposes while propagating the original ResponseWriter untouched. For reference, the official OpenTelemetry instrumentation otelmux uses a similar approach, as shown here. We appreciate your report and will review this further. |
started to get this recently
The text was updated successfully, but these errors were encountered: