opentelemetry-exporter-otlp-proto-http: fix metric self-observability over-count on batch split#5370
Open
Krishnachaitanyakc wants to merge 2 commits into
Conversation
… over-count on batch split When max_export_batch_size splits an export, each split was recording the whole batch's data-point count in the exporter's self-observability metrics (otel.sdk.exporter.metric_data_point.*), over-counting exported/inflight data points. Each split now records its own data-point count.
herin049
requested changes
Jun 30, 2026
…ting Use the single _count_data_points helper for both the unsplit request and each split batch, removing the duplicate count loop in export().
herin049
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a self-observability bug in the OTLP/HTTP metric exporter: when
max_export_batch_sizesplits an export into multiple requests, each split was recorded with the whole batch's data-point count inotel.sdk.exporter.metric_data_point.{exported,inflight}(opt-in internal metrics), over-counting. Each split now records its own data-point count. This does not affect exported telemetry, only the exporter's own metrics.Type of change
How Has This Been Tested?
max_export_batch_size=1; assert the internalmetric_data_point.exportedcounter totals 3 (previously 9) and 3 requests are sent. Fails on the prior code, passes with the fix.Does This PR Require a Contrib Repo Change?
Checklist: