File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,14 @@ import (
2424// ExtractTraceID extracts the trace ID from the request headers.
2525// It supports both W3C Trace Context (traceparent) and B3 (X-B3-TraceId) formats.
2626func ExtractTraceID (h http.Header ) string {
27- if traceparent := h .Get ("traceparent " ); traceparent != "" {
27+ if traceparent := h .Get ("Traceparent " ); traceparent != "" {
2828 parts := strings .SplitN (traceparent , "-" , 3 )
2929 if len (parts ) >= 2 {
3030 return parts [1 ]
3131 }
3232 }
3333
34- if b3TraceID := h .Get ("X-B3-TraceId " ); b3TraceID != "" {
34+ if b3TraceID := h .Get ("X-B3-Traceid " ); b3TraceID != "" {
3535 return b3TraceID
3636 }
3737
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ func TestRequestLogTemplateWithTraceID(t *testing.T) {
147147 // Test with W3C Trace Context
148148 req := httptest .NewRequest (http .MethodPost , "http://example.com/api" , nil )
149149
150- req .Header .Set ("traceparent " , "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01" )
150+ req .Header .Set ("Traceparent " , "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01" )
151151
152152 resp := httptest .NewRecorder ()
153153 logHandler .ServeHTTP (resp , req )
You can’t perform that action at this time.
0 commit comments