Skip to content

feat: OTEL_METRICS_EXEMPLAR_FILTER env - #4328

Open
proost wants to merge 6 commits into
open-telemetry:mainfrom
proost:feat-exemplar-filter-config
Open

feat: OTEL_METRICS_EXEMPLAR_FILTER env#4328
proost wants to merge 6 commits into
open-telemetry:mainfrom
proost:feat-exemplar-filter-config

Conversation

@proost

@proost proost commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

prev PR: #4267

Changes

Introduce "OTEL_METRICS_EXEMPLAR_FILTER". env is missing, so i add it.

I changed to use ctor instead of setter, Because i referred SpanLimit and breaking change is acceptable(due to preview).

According to spec, default is trace_based. But if performance downgrade worry, change to off is reasonable to me.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@proost
proost requested a review from a team as a code owner August 2, 2026 14:48
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.95%. Comparing base (4f8c843) to head (8b2cacd).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4328      +/-   ##
==========================================
+ Coverage   80.87%   80.95%   +0.09%     
==========================================
  Files         450      450              
  Lines       19186    19205      +19     
==========================================
+ Hits        15515    15546      +31     
+ Misses       3671     3659      -12     
Files with missing lines Coverage Δ
sdk/src/configuration/sdk_builder.cc 50.06% <100.00%> (+0.41%) ⬆️
sdk/src/metrics/meter_context.cc 93.82% <100.00%> (+1.05%) ⬆️
sdk/src/metrics/meter_context_factory.cc 100.00% <100.00%> (+50.00%) ⬆️
sdk/src/metrics/meter_provider_factory.cc 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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

.Build())
#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
,
ExemplarFilterType exemplar_filter_type = ExemplarFilterType::kTraceBased

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this read OTEL_METRICS_EXEMPLAR_FILTER too? Right now, apps that create MeterContext or MeterProvider directly always get trace_based. The env setting only works through MeterContextFactory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK, then how about calling as default argument? 7907e73

@lalitb

lalitb commented Aug 2, 2026

Copy link
Copy Markdown
Member

Please remove "Fixes #4178" from PR desc, as closing this Pr won't make the Exemplar to be declared stable.

@lalitb lalitb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Couple of comments, nothing blocking.

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.

2 participants