mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-08 06:09:53 +00:00
only write attributes after other middleware (and request)
This commit is contained in:
parent
168f0e02b8
commit
d28346cbdd
2 changed files with 7 additions and 6 deletions
|
|
@ -104,6 +104,9 @@ func (ot *openTelemetryWrapper) serveHTTP(w http.ResponseWriter, r *http.Request
|
|||
}
|
||||
}
|
||||
|
||||
next := ctx.Value(nextCallCtxKey).(*nextCall)
|
||||
next.err = next.next.ServeHTTP(w, r)
|
||||
|
||||
// Add custom span attributes to the current span
|
||||
span := trace.SpanFromContext(ctx)
|
||||
if span.IsRecording() && len(ot.spanAttributes) > 0 {
|
||||
|
|
@ -116,9 +119,6 @@ func (ot *openTelemetryWrapper) serveHTTP(w http.ResponseWriter, r *http.Request
|
|||
}
|
||||
span.SetAttributes(attributes...)
|
||||
}
|
||||
|
||||
next := ctx.Value(nextCallCtxKey).(*nextCall)
|
||||
next.err = next.next.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// ServeHTTP propagates call to the by wrapped by `otelhttp` next handler.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue