Skip to content

Count data points in OTLP metric exporter health metrics - #9016

Open
goutamadwant wants to merge 4 commits into
open-telemetry:mainfrom
goutamadwant:fix-metric-point-count
Open

goutamadwant wants to merge 4 commits into
open-telemetry:mainfrom
goutamadwant:fix-metric-point-count

Conversation

@goutamadwant

Copy link
Copy Markdown

Fixes #9011.

Count the data points across the exported metrics when recording exporter health metrics. Previously, a batch containing three instruments with 3, 2, and 0 points reported 3 items instead of 5. Both reusable and immutable memory modes now pass the point count to the exporter instrumentation.

The regression test checks inflight and exported counts before and after asynchronous success or failure, including empty metrics, empty batches, and subsequent exports.

Validation:

  • ./gradlew :exporters:otlp:common:check :exporters:common:check
  • ./gradlew :exporters:otlp:all:testOkHttpVersionLATEST --tests '*MetricExporter*'

@goutamadwant
goutamadwant requested a review from a team as a code owner November 7, 2026 18:54
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-11-19 08:36 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Give the HTTP and gRPC metric exporter builder fixtures one data point
so their meter-provider tests retain meaningful nonzero assertions.

Cover legacy and latest exporter instrumentation in both memory modes,
including multi-point and empty exports, asynchronous success and failure,
and subsequent exports. Assert that legacy seen/exported counters count
data points and preserve their type and success attributes, with exported
counts updated only after completion.
@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.53%. Comparing base (fecfb6d) to head (826e0aa).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9016      +/-   ##
============================================
+ Coverage     90.37%   90.53%   +0.15%     
- Complexity    11018    11186     +168     
============================================
  Files          1021     1032      +11     
  Lines         30124    30511     +387     
  Branches       3933     3994      +61     
============================================
+ Hits          27225    27623     +398     
+ Misses         1941     1913      -28     
- Partials        958      975      +17     

☔ View full report in Codecov by Harness.
📢 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.

@opentelemetry-pr-dashboard

This comment has been minimized.

Comment on lines +40 to +43
@MethodSource("exportCases")
void countsDataPoints(
InternalTelemetryVersion telemetryVersion, MemoryMode memoryMode, boolean successful) {
InMemoryMetricReader reader = InMemoryMetricReader.create();

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.

Could we narrow this test to asserting the count passed to doExport, parameterized over MemoryMode? The mixed-point and empty cases cover this change. Telemetry-version and success/failure accounting belong to downstream instrumentation tests, and the callback here manually recreates that wiring.

Signed-off-by: goutamadwant <workwithgoutam@gmail.com>
@goutamadwant

Copy link
Copy Markdown
Author

I narrowed the test in 826e0aa to the count passed to doExport for each MemoryMode. It covers mixed and empty batches, then reuses the marshaler to check the count resets. Both modes and the HTTP/gRPC exporter-builder tests passed locally.

This branch has not been deployed

No deployments
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.

MetricReusableDataMarshaler passes MetricData count instead of data point count to otel.sdk.exporter.metric_data_point.{inflight,exported}

2 participants