Skip to content

docs: clarify View attribute filtering interaction with Exemplars#8419

Merged
jack-berg merged 3 commits into
open-telemetry:mainfrom
kyyril:fix/document-view-exemplar-interaction
May 22, 2026
Merged

docs: clarify View attribute filtering interaction with Exemplars#8419
jack-berg merged 3 commits into
open-telemetry:mainfrom
kyyril:fix/document-view-exemplar-interaction

Conversation

@kyyril
Copy link
Copy Markdown
Contributor

@kyyril kyyril commented May 20, 2026

Resolves #8391

Changes

Adds Javadoc notices to View and ViewBuilder.setAttributeFilter methods, clarifying that attributes filtered out by a View may still appear on recorded exemplars.

This behavior is non-obvious (measurement attributes are retained on Exemplars even if filtered by View/aggregation) and was resolved in the spec (#5073) and documented similarly in .NET (#7270).

Checklist

  • Javadoc added/updated
  • Code formatted using spotlessApply

@kyyril kyyril requested a review from a team as a code owner May 20, 2026 22:48
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.14%. Comparing base (32440c1) to head (cd5f33e).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8419      +/-   ##
============================================
- Coverage     91.14%   91.14%   -0.01%     
- Complexity     7761     7762       +1     
============================================
  Files           881      881              
  Lines         23409    23409              
  Branches       2331     2331              
============================================
- Hits          21337    21336       -1     
  Misses         1377     1377              
- Partials        695      696       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

/**
* Sets a filter which retains attribute keys included in {@code keysToRetain}.
*
* <p><b>Note:</b> Attributes dropped by this filter may still appear on recorded exemplars. If
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The bold text tag <b> can be removed for 'Note:'.

Comment on lines +20 to +23
* <p><b>Note:</b> When a view filters out attributes, the dropped attributes may still appear on
* recorded exemplars. If you need to remove sensitive data from exemplars, you must configure a
* custom {@link ExemplarFilter} or disable exemplars entirely.
*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this could be removed from here. This documentation explains special behavior of setAttributeFilter method and is already part of method's Javadoc, so adding it to the class' Javadoc does not seem necessary.

Comment thread sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/ViewBuilder.java Outdated
@kyyril
Copy link
Copy Markdown
Contributor Author

kyyril commented May 21, 2026

Thanks for the clarification @jack-berg! Updated the Javadoc to reflect the actual options (disable exemplars, delegating exporter, or Collector filtering). Let me know if it looks good 👍

@jack-berg jack-berg merged commit 8bacccc into open-telemetry:main May 22, 2026
28 checks passed
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented May 22, 2026

Thank you for your contribution @kyyril! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document interaction between View attribute filtering and Exemplars

4 participants