sdk/trace: batchSpanProcessor.ForceFlush calls SpanExporter.ExportSpans synchronously#6416
Closed
pellared wants to merge 9 commits intoopen-telemetry:mainfrom
Closed
sdk/trace: batchSpanProcessor.ForceFlush calls SpanExporter.ExportSpans synchronously#6416pellared wants to merge 9 commits intoopen-telemetry:mainfrom
pellared wants to merge 9 commits intoopen-telemetry:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6416 +/- ##
=======================================
- Coverage 81.8% 81.8% -0.1%
=======================================
Files 283 283
Lines 24910 24903 -7
=======================================
- Hits 20386 20378 -8
- Misses 4119 4120 +1
Partials 405 405 🚀 New features to boost your workflow:
|
pellared
commented
Mar 6, 2025
Comment on lines
-563
to
-579
| func TestBatchSpanProcessorForceFlushTimeout(t *testing.T) { | ||
| tp := basicTracerProvider(t) | ||
| exp := newIndefiniteExporter(t) | ||
| bsp := NewBatchSpanProcessor(exp) | ||
| tp.RegisterSpanProcessor(bsp) | ||
| tr := tp.Tracer(t.Name()) | ||
| _, span := tr.Start(context.Background(), "foo") | ||
| span.End() | ||
|
|
||
| // Add timeout to context to test deadline | ||
| ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) | ||
| defer cancel() | ||
|
|
||
| if got, want := bsp.ForceFlush(ctx), context.DeadlineExceeded; !errors.Is(got, want) { | ||
| t.Errorf("expected %q error, got %v", want, got) | ||
| } | ||
| } |
Member
Author
There was a problem hiding this comment.
This test was verifying a scenario when SpanExporter.ExportSpans hangs. Now we would be hanging because we are calling synchronously. I think this is fine as returning prematurely leaks a goroutine.
dmathieu
approved these changes
Mar 6, 2025
Comment on lines
+11
to
+14
| ### Changed | ||
|
|
||
| - `ForceFlush` of the `NewBatchSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace` calls `SpanExporter.ExportSpans` synchronously. (#6416) | ||
|
|
There was a problem hiding this comment.
Just for the record, this is a significant change in behavior, and can easily be interpreted as a breaking change.
Member
Author
There was a problem hiding this comment.
Member
Author
Member
Author
|
SIG meeting: This can cause other issues. |
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.
Per
CC @peterbourgon @ash2k