Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace reporting not working when setting reporter-queue-size to any value different than the default. #1281

Open
vvasilevbosch opened this issue Jun 5, 2023 · 0 comments

Comments

@vvasilevbosch
Copy link

vvasilevbosch commented Jun 5, 2023

When setting reporter-queue-size to any different value than default '4096', Tracer.reconfigure is called, which reinstantiates kamon.trace.Tracer#_spanBuffer but kamon.trace.Tracer#_onSpanFinish keeps reference to its old value, which is what causes this issue. The _onSpanFinish lambda should be updated with the new reference of _spanBuffer

private val _onSpanFinish: Span.Finished => Unit = _spanBuffer.offer

https://github.com/kamon-io/Kamon/blob/c3f065517f046f6feffb47652a9ac91d664f160b/core/kamon-core/src/main/scala/kamon/trace/Tracer.scala#L459C1-L465

  def reconfigure(newConfig: Config): Unit = synchronized {
    //......
      if(_traceReporterQueueSize != traceReporterQueueSize) {
        // By simply changing the buffer we might be dropping Spans that have not been collected yet by the reporters.
        // Since reconfigures are very unlikely to happen beyond application startup this might not be a problem.
        // If we eventually decide to keep those possible Spans around then we will need to change the queue type to
        // multiple consumer as the reconfiguring thread will need to drain the contents before replacing.
        _spanBuffer = new MpscArrayQueue[Span.Finished](traceReporterQueueSize)
      }
    //......
  }
@vvasilevbosch vvasilevbosch changed the title Trace reporting not working when setting reporter-queue-size to any number different than the default. Trace reporting not working when setting reporter-queue-size to any value different than the default. Jun 5, 2023
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

No branches or pull requests

1 participant