@@ -20,10 +20,8 @@ import (
20
20
func TraceRequest (tracer trace.Tracer ) func (http.Handler ) http.Handler {
21
21
return func (h http.Handler ) http.Handler {
22
22
return http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
23
- slog .Info ("websocket connection received" , "path" , r .URL .Path , "method" , r .Method )
24
- slog .Info ("processing connection" , "uri" , r .RequestURI )
25
-
26
- newCtx , span := tracer .Start (r .Context (), fmt .Sprintf ("%s %s" , r .Method , r .URL .String ()), trace .WithSpanKind (trace .SpanKindServer ),
23
+ newCtx , span := tracer .Start (r .Context (),
24
+ fmt .Sprintf ("%s %s" , r .Method , r .URL .String ()), trace .WithSpanKind (trace .SpanKindServer ),
27
25
trace .WithAttributes (
28
26
semconv .HTTPScheme (getScheme (r )),
29
27
semconv .HTTPMethod (r .Method ),
@@ -35,11 +33,11 @@ func TraceRequest(tracer trace.Tracer) func(http.Handler) http.Handler {
35
33
routePattern := chi .RouteContext (r .Context ()).RoutePattern ()
36
34
if routePattern != "" {
37
35
span .SetName (fmt .Sprintf ("%s %s" , r .Method , routePattern ))
36
+ span .SetAttributes (semconv .HTTPRoute (chi .RouteContext (r .Context ()).RoutePattern ()))
38
37
} else {
39
38
span .SetStatus (codes .Error , "not found" )
40
39
span .SetAttributes (semconv .HTTPStatusCode (http .StatusNotFound ))
41
40
}
42
- span .SetAttributes (semconv .HTTPRoute (chi .RouteContext (r .Context ()).RoutePattern ()))
43
41
})
44
42
}
45
43
}
@@ -77,6 +75,9 @@ func TLSOffload(registry registry.DeviceRegistry) func(http.Handler) http.Handle
77
75
span .SetAttributes (attribute .String ("cert.lookup.error" , "NotFound" ))
78
76
slog .Warn ("certificate not found" , "clientCertHashHeader" , clientCertHashHeader )
79
77
}
78
+ } else {
79
+ clientCertErrHeader := r .Header .Get ("X-Client-Cert-Error" )
80
+ span .SetAttributes (attribute .String ("cert.valid.error" , clientCertErrHeader ))
80
81
}
81
82
}
82
83
}
0 commit comments