You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-05-22 09:35:21 +02:00
docs: clarify that View attribute filters do not apply to Exemplars (#8339)
This PR updates the documentation to clarify how View attribute filters interact with Exemplars. Currently, it's not very obvious that when a View filters out certain attributes, those dropped attributes might still appear on Exemplars. According to the OTel specification, Exemplars retain the original measurement attributes regardless of the View or aggregation configuration. This behavior can be confusing for users, so I've added a brief note to the godocs for View, AttributeFilter, and the package-level doc.go to make this explicit (similar to the recent documentation updates in the .NET SDK). fixes #8330 --------- Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
// View. Views allow users that run OpenTelemetry instrumented code to modify
|
||||
// the generated data of that instrumentation.
|
||||
//
|
||||
// Note that attributes filtered out by a View may still appear on Exemplars,
|
||||
// because Exemplars are recorded with the dropped measurement attributes
|
||||
// when View attribute filtering is applied.
|
||||
//
|
||||
// The data generated by a MeterProvider needs to include information about its
|
||||
// origin. A MeterProvider needs to be configured with a Resource, using the
|
||||
// WithResource MeterProviderOption, to include this information. This Resource
|
||||
|
||||
@@ -141,6 +141,10 @@ type Stream struct {
|
||||
// the attribute will not be recorded, otherwise, if it returns true, it
|
||||
// will record the attribute.
|
||||
//
|
||||
// Note that attributes filtered out by a View may still appear on Exemplars,
|
||||
// because Exemplars are recorded with the dropped measurement attributes
|
||||
// when View attribute filtering is applied.
|
||||
//
|
||||
// Use NewAllowKeysFilter from "go.opentelemetry.io/otel/attribute" to
|
||||
// provide an allow-list of attribute keys here.
|
||||
AttributeFilter attribute.Filter
|
||||
|
||||
@@ -22,6 +22,10 @@ var (
|
||||
// should be collected for certain instruments. It returns true and the exact
|
||||
// Stream to use for matching Instruments. Otherwise, if the view does not
|
||||
// match, false is returned.
|
||||
//
|
||||
// Note that attributes filtered out by a View may still appear on Exemplars,
|
||||
// because Exemplars are recorded with the dropped measurement attributes
|
||||
// when View attribute filtering is applied.
|
||||
type View func(Instrument) (Stream, bool)
|
||||
|
||||
// NewView returns a View that applies the Stream mask for all instruments that
|
||||
|
||||
Reference in New Issue
Block a user