Skip to content

Traces(otlp): Render bytes and value-less resource and scope attributes as string tags #3715

Backlog

Description

@lucastemb

The following was written by AI:

Background

The Agent renders every OTLP attribute value with pcommon.Value.AsString(): bytes become base64 strings, and an absent value becomes an empty string. #3713 brings ADP's span attributes in line. The Agent does the same for the other two kinds of attribute on a span:

Problem

ADP differs on three paths, and #3713 changes none of them:

  • Resource attributes, per-span pass (transform.rs): skips an attribute with no value, and renders bytes as the placeholder <N bytes> through otlp_value_to_string.
  • Resource attributes, trace level (translator.rs): skips an attribute with no value, and keeps bytes as AttributeValue::Bytes, which the encoder writes as a bytes attribute.
  • Scope attributes (instrumentation_scope_attributes_to_attrs): skips an attribute with no value, and renders bytes as <N bytes>.

Resource attributes also feed hostname, container-tag and semantic lookups, so changing how they are stored needs care: a lookup that sees an empty entry must treat it as absent, as it does now.

  • A bytes resource attribute is sent as a base64 string tag, in both resource paths
  • A resource attribute with no value is sent as an empty string tag
  • A bytes scope attribute is sent as a base64 string tag
  • A scope attribute with no value is sent as an empty string tag
  • Hostname, container-tag and semantic lookups that read resource attributes still treat an empty value as absent

Also check

The Agent's AsString() also renders numeric and boolean resource attributes as strings. At trace level ADP keeps them typed (Int, Float, Bool). Whether the output differs on the wire isn't verified.

References

Activity

  1. added
    area/components
    type/bug
    otlp/traces
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/componentsotlp/tracestype/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions