Skip to content

opentelemetry-exporter-otlp-proto-http: fix metric self-observability over-count on batch split#5370

Open
Krishnachaitanyakc wants to merge 3 commits into
open-telemetry:mainfrom
Krishnachaitanyakc:fix/otlp-http-metrics-split-num-items
Open

opentelemetry-exporter-otlp-proto-http: fix metric self-observability over-count on batch split#5370
Krishnachaitanyakc wants to merge 3 commits into
open-telemetry:mainfrom
Krishnachaitanyakc:fix/otlp-http-metrics-split-num-items

Conversation

@Krishnachaitanyakc

Copy link
Copy Markdown
Contributor

Description

Fixes a self-observability bug in the OTLP/HTTP metric exporter: when max_export_batch_size splits an export into multiple requests, each split was recorded with the whole batch's data-point count in otel.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

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit test: split a 3-data-point batch with max_export_batch_size=1; assert the internal metric_data_point.exported counter 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?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

… 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.
@Krishnachaitanyakc Krishnachaitanyakc requested a review from a team as a code owner June 29, 2026 16:50
@github-project-automation github-project-automation Bot moved this to Reviewed PRs that need fixes in Python PR digest 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().
@github-project-automation github-project-automation Bot moved this from Reviewed PRs that need fixes to Approved PRs in Python PR digest Jun 30, 2026
@herin049 herin049 self-requested a review June 30, 2026 02:58

@anuraaga anuraaga left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved PRs

Development

Successfully merging this pull request may close these issues.

4 participants