We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
request_id
1 parent 2881b8b commit 3bbfcc5Copy full SHA for 3bbfcc5
coderd/httpmw/requestid.go
@@ -5,6 +5,8 @@ import (
5
"net/http"
6
7
"github.com/google/uuid"
8
+ "go.opentelemetry.io/otel/attribute"
9
+ "go.opentelemetry.io/otel/trace"
10
11
"cdr.dev/slog"
12
)
@@ -29,6 +31,9 @@ func AttachRequestID(next http.Handler) http.Handler {
29
31
ctx := context.WithValue(r.Context(), requestIDContextKey{}, rid)
30
32
ctx = slog.With(ctx, slog.F("request_id", rid))
33
34
+ trace.SpanFromContext(ctx).
35
+ SetAttributes(attribute.String("request_id", rid.String()))
36
+
37
rw.Header().Set("X-Coder-Request-Id", ridString)
38
next.ServeHTTP(rw, r.WithContext(ctx))
39
})
0 commit comments