You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Caused by: java.lang.IllegalStateException: GlobalOpenTelemetry.set has already been called. GlobalOpenTelemetry.set must be called only once before any calls to GlobalOpenTelemetry.get. If you are using the OpenTelemetrySdk, use OpenTelemetrySdkBuilder.buildAndRegisterGlobal instead. Previous invocation set to cause of this exception.
at io.opentelemetry.api.GlobalOpenTelemetry.set(GlobalOpenTelemetry.java:84)
at io.opentelemetry.sdk.OpenTelemetrySdkBuilder.buildAndRegisterGlobal(OpenTelemetrySdkBuilder.java:63)
at com.myproject.observability.OpenTelemetryProvider.$init$(OpenTelemetryProvider.scala:27)
I am wondering what has gone wrong that by following basic examples from the Docs I ran in a state unexpected by the library. Please note that the docs don't list all dependencies required for using SDK. IMO either this is not obvious, or I am missing something obvious.
The text was updated successfully, but these errors were encountered:
It sounds like you're running your initialization code more than once (hence the exception that you see). I don't know anything about akka or how your configuration code might be being called, but you do need to make sure that it is only called once if you want to register the global instance. If you don't care about the global instance, you can certainly get rid of this error by not registering the global. But, even in that case, if you're creating more than once instance of the SDK, things are probably getting confused somewhere.
Thanks @jkwatson I actually removed all sdk packages and I've only added opentelemetry-api. With GlobalOpenTelemetry available there it works for me. I hope I won't run into issues later. Closing this ticket.
Hello 👋
I have a Scala application built with sbt, and which relies on Akka framework that I am trying to add tracing to.
Following the Docs for Opentelemetry Java and otlp based example from this repository, I've added the following dependencies:
I am further adding the set-up:
This is the error when I try to run a test:
These are the lines that throw this exception:
I am wondering what has gone wrong that by following basic examples from the Docs I ran in a state unexpected by the library. Please note that the docs don't list all dependencies required for using SDK. IMO either this is not obvious, or I am missing something obvious.
The text was updated successfully, but these errors were encountered: