Skip to content

Commit 1a4efce

Browse files
authored
fix: Update _onSpanFinish when _spanBuffer is updated (#1399)
Without _onSpanFinish updated, then whenever a span is closed, it will will be offered to the old queue, that nothing is reading from anymore. This causes all traces to not be sent. #1281
1 parent 30ee1b6 commit 1a4efce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/kamon-core/src/main/scala/kamon/trace/Tracer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Tracer(initialConfig: Config, clock: Clock, contextStorage: ContextStorage
5757
@volatile private var _includeErrorType: Boolean = false
5858
@volatile private var _ignoredOperations: Set[String] = Set.empty
5959
@volatile private var _trackMetricsOnIgnoredOperations: Boolean = false
60-
private val _onSpanFinish: Span.Finished => Unit = _spanBuffer.offer
60+
@volatile private var _onSpanFinish: Span.Finished => Unit = _spanBuffer.offer
6161

6262
reconfigure(initialConfig)
6363

@@ -481,6 +481,7 @@ class Tracer(initialConfig: Config, clock: Clock, contextStorage: ContextStorage
481481
// If we eventually decide to keep those possible Spans around then we will need to change the queue type to
482482
// multiple consumer as the reconfiguring thread will need to drain the contents before replacing.
483483
_spanBuffer = new MpscArrayQueue[Span.Finished](traceReporterQueueSize)
484+
_onSpanFinish = _spanBuffer.offer
484485
}
485486

486487
_sampler = sampler

0 commit comments

Comments
 (0)