Skip to content

[OTel] Non-string attributes are being sent as an empty string #683

@vtfr

Description

@vtfr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIssue type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions