docs: clarify View attribute filtering interaction with Exemplars#8419
docs: clarify View attribute filtering interaction with Exemplars#8419kyyril wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
| /** | ||
| * 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 |
There was a problem hiding this comment.
Nit: The bold text tag <b> can be removed for 'Note:'.
| * <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. | ||
| * |
There was a problem hiding this comment.
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.
| * to remove sensitive data from exemplars, you must configure a custom {@link ExemplarFilter} or | ||
| * disable exemplars entirely. |
There was a problem hiding this comment.
ExemplarFilter isn't a SDK extension point so custom implementations cannot be provided. The spec way to do thing would be a custom exemplar reservoir, but java doesn't support that right now either.
The only way accomplish this is to disable exemplars, or to write a delegating exporter which filters the attributes from the MetricData instances before exporting. You can of course do this in the collector as well.
There was a problem hiding this comment.
Ah, I missed the fact the ExemplarFilter only has static methods.
Seems like an issue to add support for setting ExemplarReservoir at the View level already exists.
In the meantime, this PR could update the documentation to reflect the filtering mechanisms mentioned in @jack-berg's comment above.
There was a problem hiding this comment.
Thanks for the clarification @jack-berg! I've updated the Javadoc to remove the reference to custom ExemplarFilter and instead list the three actual options: disabling exemplars via ExemplarFilter.alwaysOff(), filtering via a delegating exporter, or filtering in the OpenTelemetry Collector.
There was a problem hiding this comment.
Thanks @psx95 — I've already pushed a commit (cd5f33e) that reflects @jack-berg's feedback. The Javadoc now correctly states that the options are: disabling exemplars entirely, using a delegating exporter, or filtering in the Collector. No more mention of custom ExemplarFilter.
|
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 👍 |
Resolves #8391
Changes
Adds Javadoc notices to
ViewandViewBuilder.setAttributeFiltermethods, 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