Agent version
7.81.1
Bug Report
The logs of cluster-agent version 7.81.1 have many log lines like this one:
2026-09-02 08:22:05 UTC | CLUSTER | WARN | (log/log.go:267 in Printf) | Error from the agent http API server: http: superfluous response.WriteHeader call from github.com/DataDog/datadog-agent/pkg/clusteragent/api.(*telemetryWriterWrapper).WriteHeader (handler_telemetry.go:110)
This is due to telemetryWriterWrapper failing to track whether or not the response headers were written out. It fails to update its wroteHeader field when the delegate http.ResponseWriter implementation calls its WriteHeader method as part of the Write implementation (see the godoc of http.ResponseWriter.Write here).
To fix this, telemetryWriterWrapper should implement Write and update wroteHeader in it along with, perhaps, some other state.
Agent version
7.81.1
Bug Report
The logs of cluster-agent version 7.81.1 have many log lines like this one:
This is due to
telemetryWriterWrapperfailing to track whether or not the response headers were written out. It fails to update itswroteHeaderfield when the delegatehttp.ResponseWriterimplementation calls itsWriteHeadermethod as part of theWriteimplementation (see the godoc ofhttp.ResponseWriter.Writehere).To fix this,
telemetryWriterWrappershould implementWriteand updatewroteHeaderin it along with, perhaps, some other state.