Summary
Non-string attributes are being sent as an empty string.
Steps To Reproduce
- Configure an Open Telemetry TraceProvider using sentry's SpanProcessor
- Start a Span
- Set a non-string Attribute (such as
semconv.HTTPStatusCode)
- Verify that in the dashboard this Attribute is an empty string, despite it's value being non-zero
Expected Behavior
- All attributes should reach Sentry's Dashboard with their respective values.
SDK
sentry-go version: v0.22.0
- Go version: 1.19
- Using Go Modules? yes
Sentry
- Using hosted Sentry in sentry.io? yes
- Anything particular to your environment that could be related to this issue? No.
Additional context
The problem seems to be due to these two calls:
|
attributes[kv.Key] = kv.Value.AsString() |
|
resource[kv.Key] = kv.Value.AsString() |
As stated by Value.AsString method's doc:
// AsString returns the string value. Make sure that the Value's type
// is STRING.
Probably the code's intention was to use Value.Emit(), instead. This method returns the string representation of the Value's data.
Summary
Non-string attributes are being sent as an empty string.
Steps To Reproduce
semconv.HTTPStatusCode)Expected Behavior
SDK
sentry-goversion: v0.22.0Sentry
Additional context
The problem seems to be due to these two calls:
sentry-go/otel/span_processor.go
Line 125 in feb3495
sentry-go/otel/span_processor.go
Line 128 in feb3495
As stated by
Value.AsStringmethod's doc:Probably the code's intention was to use
Value.Emit(), instead. This method returns the string representation of the Value's data.