Repository navigation
fix: batch shutdown flush - #1731
Merged
fractalwrench merged 2 commits intoNov 27, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1731 +/- ##
==========================================
+ Coverage 91.24% 91.25% +0.01%
==========================================
Files 578 578
Lines 9228 9228
Branches 1684 1684
==========================================
+ Hits 8420 8421 +1
Misses 407 407
+ Partials 401 400 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change that flushes batch exporters after draining telemetry and before shutdown.
No open issues 🎉
What changed in this PR
Fixes #1695 by making batch span and log processors flush the exporter during shutdown, after draining queued telemetry and before exporter shutdown, aligning with OpenTelemetry requirements.
Changes:
- Adds exporter flushing within the existing shutdown timeout and propagates flush failures.
- Adds tests for export-before-flush ordering, flush exceptions, timeouts, and repeated shutdown.
- Updates span and log processor tests to expect flushing before exporter shutdown.
| File | Description |
|---|---|
exporters-core/src/commonTest/kotlin/io/opentelemetry/kotlin/tracing/export/BatchSpanProcessorImplTest.kt |
Expects exporter flushing before span processor shutdown. |
exporters-core/src/commonTest/kotlin/io/opentelemetry/kotlin/logging/export/BatchLogRecordProcessorImplTest.kt |
Expects exporter flushing before log processor shutdown. |
exporters-core/src/commonTest/kotlin/io/opentelemetry/kotlin/export/BatchTelemetryProcessorTest.kt |
Adds shutdown flush ordering, failure, timeout, and repeat-call coverage. |
exporters-core/src/commonMain/kotlin/io/opentelemetry/kotlin/export/BatchTelemetryProcessor.kt |
Calls the guarded exporter flush after the worker drains the queue. |
Review effort: Balanced
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.
Fixes #1695.
Calls the exporter's
forceFlush()when the batch span and log record processors shut down, after exporting the queued telemetry and beforeexporter.shutdown().What changed
BatchTelemetryProcessor.shutdown()now flushes the exporter once the worker has drained the queue, so both batch processors get the fix.shutdown()now returnsFailureif the exporter's flush fails or times out. The flush runs within the existing shutdown timeout, so it doesn't extend how long shutdown can take.Tests
BatchTelemetryProcessorTest: export then flush, a failing flush, a flush timeout, and a second shutdown not flushing again.BatchSpanProcessorImplTestandBatchLogRecordProcessorImplTestnow expect aflushbeforeshutdown.