File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Sources/OpenTelemetrySdk/Trace Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ public protocol SpanProcessor {
1818 /// Called when a Span is started, if the Span.isRecording is true.
1919 /// This method is called synchronously on the execution thread, should not throw or block the
2020 /// execution thread.
21+ /// - Parameter parentContext: the context of the span parent, if exists
2122 /// - Parameter span: the ReadableSpan that just started
2223 func onStart( parentContext: SpanContext ? , span: ReadableSpan )
2324
@@ -33,6 +34,7 @@ public protocol SpanProcessor {
3334
3435 /// Processes all span events that have not yet been processed.
3536 /// This method is executed synchronously on the calling thread
37+ /// - Parameter timeout: Maximum time the flush complete or abort. If nil, it will wait indefinitely
3638 func forceFlush( timeout: TimeInterval ? )
3739}
3840
Original file line number Diff line number Diff line change @@ -135,7 +135,8 @@ private class BatchWorker: Thread {
135135 }
136136 let timeoutTimer = DispatchSource . makeTimerSource ( queue: DispatchQueue . global ( ) )
137137 timeoutTimer. setEventHandler { exportOperation. cancel ( ) }
138- timeoutTimer. schedule ( deadline: . now( ) + . milliseconds( Int ( explicitTimeout? . toMilliseconds ?? exportTimeout. toMilliseconds) ) , leeway: . milliseconds( 1 ) )
138+ let maxTimeOut = min ( explicitTimeout ?? TimeInterval . greatestFiniteMagnitude, exportTimeout)
139+ timeoutTimer. schedule ( deadline: . now( ) + . milliseconds( Int ( maxTimeOut. toMilliseconds) ) , leeway: . milliseconds( 1 ) )
139140 timeoutTimer. activate ( )
140141 queue. addOperation ( exportOperation)
141142 queue. waitUntilAllOperationsAreFinished ( )
You can’t perform that action at this time.
0 commit comments