fix: correct to span_id

This commit is contained in:
Cedric Ziel 2024-06-22 14:10:57 +02:00
parent e35ce3d005
commit bb450ed304

View File

@ -92,7 +92,7 @@ func (ot *openTelemetryWrapper) serveHTTP(w http.ResponseWriter, r *http.Request
// Add a trace_id placeholder, accessible via `{http.vars.trace_id}`. // Add a trace_id placeholder, accessible via `{http.vars.trace_id}`.
caddyhttp.SetVar(ctx, "trace_id", traceID) caddyhttp.SetVar(ctx, "trace_id", traceID)
// Add a span_id placeholder, accessible via `{http.vars.span_id}`. // Add a span_id placeholder, accessible via `{http.vars.span_id}`.
caddyhttp.SetVar(ctx, "span_ud", spanID) caddyhttp.SetVar(ctx, "span_id", spanID)
// Add the trace id to the log fields for the request. // Add the trace id to the log fields for the request.
if extra, ok := ctx.Value(caddyhttp.ExtraLogFieldsCtxKey).(*caddyhttp.ExtraLogFields); ok { if extra, ok := ctx.Value(caddyhttp.ExtraLogFieldsCtxKey).(*caddyhttp.ExtraLogFields); ok {
extra.Add(zap.String("traceID", traceID)) extra.Add(zap.String("traceID", traceID))