mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-08 17:37:01 +00:00
fix(middleware/tracing): check attribute types before setting them
Co-authored-by: sindrerh2 <sindre.rodseth.hansen@nav.no>
This commit is contained in:
@@ -19,7 +19,12 @@ func Tracing(next http.Handler) http.Handler {
|
||||
attrs := httpinternal.Attributes(r)
|
||||
for k, v := range attrs {
|
||||
attrKey := "wonderwall." + k
|
||||
span.SetAttributes(attribute.String(attrKey, fmt.Sprint(v)))
|
||||
switch v := v.(type) {
|
||||
case bool:
|
||||
span.SetAttributes(attribute.Bool(attrKey, v))
|
||||
default:
|
||||
span.SetAttributes(attribute.String(attrKey, fmt.Sprint(v)))
|
||||
}
|
||||
}
|
||||
|
||||
// Override request ID with trace ID if available.
|
||||
|
||||
Reference in New Issue
Block a user