Skip to content

Add experimental support for batching in periodic reader#8071

Merged
dashpole merged 11 commits intoopen-telemetry:mainfrom
dashpole:metrics_batching
Apr 9, 2026
Merged

Add experimental support for batching in periodic reader#8071
dashpole merged 11 commits intoopen-telemetry:mainfrom
dashpole:metrics_batching

Conversation

@dashpole
Copy link
Copy Markdown
Contributor

@dashpole dashpole commented Mar 18, 2026

Adds experimental support for maxExportBatchSize using the OTEL_GO_X_METRIC_EXPORT_BATCH_SIZE=<size> environment variable.

Previous prototype: #7930

This preserves existing behavior for timeouts when batching is not used, but individually applies the timeout to export calls when batching is used.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 98.06452% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.2%. Comparing base (cdf74d8) to head (1011b26).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sdk/metric/periodic_reader.go 88.0% 1 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #8071     +/-   ##
=======================================
+ Coverage   82.0%   82.2%   +0.1%     
=======================================
  Files        308     309      +1     
  Lines      24060   24211    +151     
=======================================
+ Hits       19742   19904    +162     
+ Misses      3940    3928     -12     
- Partials     378     379      +1     
Files with missing lines Coverage Δ
sdk/metric/internal/x/x.go 100.0% <100.0%> (+100.0%) ⬆️
sdk/metric/splitmetrics.go 100.0% <100.0%> (ø)
sdk/metric/periodic_reader.go 85.9% <88.0%> (-1.2%) ⬇️

... and 1 file with indirect coverage changes

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

@dashpole dashpole marked this pull request as ready for review March 18, 2026 17:42
Comment thread sdk/metric/periodic_reader.go
Copy link
Copy Markdown
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

Looks good overall. Only issue is is the timeout leaking into direct Collect(ctx, rm) calls.

Comment thread sdk/metric/periodic_reader.go Outdated
@dashpole dashpole force-pushed the metrics_batching branch 4 times, most recently from d6c074d to 600cebd Compare April 8, 2026 15:54
Comment thread sdk/metric/periodic_reader.go
Copy link
Copy Markdown
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

Looks good overall. Only minor suggestion on changelog entry.

Comment thread CHANGELOG.md Outdated
@dashpole dashpole merged commit 0c09e08 into open-telemetry:main Apr 9, 2026
34 checks passed
@dashpole dashpole deleted the metrics_batching branch April 9, 2026 13:31
pellared pushed a commit to pellared/opentelemetry-go that referenced this pull request Apr 23, 2026
…try#8071)

Adds experimental support for maxExportBatchSize using the
`OTEL_GO_X_METRIC_EXPORT_BATCH_SIZE=<size>` environment variable.

Previous prototype:
open-telemetry#7930

This preserves existing behavior for timeouts when batching is not used,
but individually applies the timeout to export calls when batching is
used.
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.

3 participants