Skip to content

WithDefaultAttributes is overridden by nil attribute filter in views #8857

Description

@dashpole

Found while working on #8510

Description

In the OpenTelemetry Metrics SDK Specification:

"If attribute_keys is not provided, the SDK should use the 'Attributes' advisory parameter configured on the instrument. If that is also absent, all attributes are kept by default."

In the Go SDK's independent mode:

  • When a user defines a view that modifies something unrelated to attributes (e.g., NewView(Instrument{Name: "my_counter"}, Stream{Description: "updated"})), NewView outputs Stream{AttributeFilter: nil}.
  • Because a view matched, the pipeline skips the fallback block and uses Stream{AttributeFilter: nil} directly.
  • As a result, the instrument's advisory Attributes (metric/x.WithDefaultAttributes) are completely dropped, and all recorded attributes are exported.

Expected behavior

According to the specification, the stream should have retained the instrument's advisory attributes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions