Repository navigation
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Pull request dashboard statusWaiting on the author · refreshed 2026-11-04 00:49 UTC Investigate required status check failures. Status above doesn't look right?
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the temporality-selector factory change.
No open issues 🎉
What changed in this PR
Adds instrument-specific temporality selection to InMemoryMetricExporter, allowing tests to use selectors such as deltaPreferred() without a custom exporter wrapper.
Changes:
- Adds a selector-based factory while preserving the behavior of existing factories.
- Expands tests for temporality selection, null-selector rejection, metric collection, and exported-data preservation.
- Updates the API compatibility report to record the new overload.
| File | Description |
|---|---|
sdk/testing/src/test/java/io/opentelemetry/sdk/testing/exporter/InMemoryMetricExporterTest.java |
Tests selector behavior and preserves coverage of existing factories. |
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/exporter/InMemoryMetricExporter.java |
Adds the selector factory and delegates temporality selection to it. |
docs/apidiffs/current_vs_latest/opentelemetry-sdk-testing.txt |
Records the new public factory overload. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8993 +/- ##
============================================
- Coverage 90.37% 90.37% -0.01%
- Complexity 11012 11016 +4
============================================
Files 1020 1021 +1
Lines 30119 30127 +8
Branches 3932 3932
============================================
+ Hits 27219 27226 +7
Misses 1941 1941
- Partials 959 960 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| * @param aggregationTemporalitySelector selects the aggregation temporality for each instrument | ||
| * type | ||
| */ | ||
| public static InMemoryMetricExporter create( |
There was a problem hiding this comment.
InMemoryMetricReader started with just create() methods, but expanded to a builder because the configuration footprint expanded to include setAggregationTemporalitySelector, setDefaultAggregationSelector, setMemoryMode. I see InMemoryMetricExporter going the same way so let's just jump to the builder now anticipating the setMemoryMode and setDefaultAggregationSeletor configuration options.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add
InMemoryMetricExporter.builder()with a temporality selector so tests can select temporality by instrument type without a custom exporter wrapper.This uses delta temporality for counters and histograms while keeping up-down counters cumulative.
Existing factories retain their behavior:
create()uses cumulative temporality for all instruments, andcreate(AggregationTemporality)applies the given temporality to every instrument type.Related to open-telemetry/opentelemetry-java-instrumentation#21111.