diff --git a/instrumentation/othttp/handler.go b/instrumentation/othttp/handler.go index ea4ca36b549..52db46e322d 100644 --- a/instrumentation/othttp/handler.go +++ b/instrumentation/othttp/handler.go @@ -120,6 +120,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.handler.ServeHTTP(rww, r.WithContext(ctx)) setAfterServeAttributes(span, bw.read, rww.written, rww.statusCode, bw.err, rww.err) + span.SetStatus(standard.SpanStatusFromHTTPStatusCode(rww.statusCode)) } func setAfterServeAttributes(span trace.Span, read, wrote int64, statusCode int, rerr, werr error) {