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.
Found while working on #8510
Description
In the OpenTelemetry Metrics SDK Specification:
In the Go SDK's independent mode:
NewView(Instrument{Name: "my_counter"}, Stream{Description: "updated"})), NewView outputsStream{AttributeFilter: nil}.Stream{AttributeFilter: nil}directly.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.