opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

Add support for exemplars

Open rghetia opened this issue 5 years ago • 4 comments

For histogram aggregation add support for collecting at least one SpanContext for each histogram bucket. This is essentially, exemplars in metrics proto. Although exemplars are not limited to SpanContext.

rghetia avatar Mar 16 '20 17:03 rghetia

I have feelings. https://github.com/open-telemetry/opentelemetry-proto/issues/81

jmacd avatar Mar 17 '20 15:03 jmacd

@jmacd @MrAlias just to confirm: there will not be exemplars support in the GA based on how this is labeled, correct?

tigrannajaryan avatar Dec 07 '20 15:12 tigrannajaryan

@jmacd @MrAlias just to confirm: there will not be exemplars support in the GA based on how this is labeled, correct?

AFAIK, that is correct. Especially since they seem to be something we can add post-GA with backwards compatibility.

Though, I'm interested to know what @jmacd thinks.

MrAlias avatar Dec 07 '20 18:12 MrAlias

Are there any update for this issue?

shizhx avatar Apr 21 '22 09:04 shizhx

If we want to move this to post stable release. We would want to add a non-comparable field type to https://github.com/open-telemetry/opentelemetry-go/blob/587437ba5b784c4ca242a8374758d0ac37fa6bd8/sdk/metric/metricdata/data.go#L83 to ensure adding a field of exemplar slices here would not break backwards compatibility.

MrAlias avatar Oct 20 '22 17:10 MrAlias

Discussed in the SIG meeting today: this might better fit in the post-GA metric SDK project. It needs to be verified that this can be added in a backwards compatible manner. If so, work to add it should be postponed until the specification has stabilized this section.

MrAlias avatar Oct 20 '22 21:10 MrAlias

Things to consider if this will be an API breaking change:

  • How is the exemplars are configured. Option (where)
  • How does this impact current data structures: eg. DataPoint above

Once metrics SDK is stable, how can this be used in a pre-release form?

  • One option is to use an RC version.

MadVikingGod avatar Oct 21 '22 16:10 MadVikingGod

Regarding support for exemplars before they are stable, I think we can leverage environment variables. We can leverage the language specific environment variables and define something like OTEL_GO_X_EXEMPLARS as a boolean that when set to true will enable exemplars in the SDK.

This also means that users will configure the exemplar filter via the already defined OTEL_METRICS_EXEMPLAR_FILTER.

MrAlias avatar Mar 27 '23 17:03 MrAlias

I added exemplar support to a fork of this project because I needed it for a test tool I was working on. While doing so, I noticed that the metricdata.Exemplar.FilteredAttributes field was not of type attribute.Set where all other attribute collections were. https://github.com/open-telemetry/opentelemetry-go/blob/main/sdk/metric/metricdata/data.go#L162 Is this by design or a minor api bug in the data definition for the Exemplar type?

seschis avatar May 05 '23 14:05 seschis

I added exemplar support to a fork of this project because I needed it for a test tool I was working on. While doing so, I noticed that the metricdata.Exemplar.FilteredAttributes field was not of type attribute.Set where all other attribute collections were. https://github.com/open-telemetry/opentelemetry-go/blob/main/sdk/metric/metricdata/data.go#L162 Is this by design or a minor api bug in the data definition for the Exemplar type?

This is by design. The dropped attributes from Set.Filter are defined as []attribute.KeyValue and the transport proto also defines them this way: https://github.com/open-telemetry/opentelemetry-proto-go/blob/a8511867c40a8fedbc31ceeede8234d03d645b7a/otlp/metrics/v1/metrics.pb.go#L1608

MrAlias avatar May 05 '23 15:05 MrAlias

Hi, is this still active? How can we confirm the plan and status of the support for trace exemplar? Thank you!

ymotongpoo avatar Jan 17 '24 07:01 ymotongpoo