Skip to content

Commit

Permalink
Fix otel http remapping to account for int values (#2737)
Browse files Browse the repository at this point in the history
  • Loading branch information
zarirhamza authored Jun 11, 2024
1 parent 028515c commit 09bdc86
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ddtrace/opentelemetry/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func toReservedAttributes(k string, v attribute.Value) (string, interface{}) {
}
return ext.EventSampleRate, rate
case "http.response.status_code":
return "http.status_code", v.AsString()
return "http.status_code", strconv.FormatInt(v.AsInt64(), 10)
default:
return k, v.AsInterface()
}
Expand Down
2 changes: 1 addition & 1 deletion ddtrace/opentelemetry/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ func TestRemapWithMultipleSetAttributes(t *testing.T) {
sp.SetAttributes(attribute.String("service.name", "new.service.name"))
sp.SetAttributes(attribute.String("span.type", "new.span.type"))
sp.SetAttributes(attribute.String("analytics.event", "true"))
sp.SetAttributes(attribute.String("http.response.status_code", "200"))
sp.SetAttributes(attribute.Int("http.response.status_code", 200))
sp.End()

tracer.Flush()
Expand Down

0 comments on commit 09bdc86

Please sign in to comment.