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
Describe the bug
Using GlobalOpenTelemetry with auto-configuration enabled, the application is no longer flushing spans in the JVM shutdown hook. If I sleep for some time at the end of the main method, it works. It works reliably without sleep on 1.22.0.
Steps to reproduce
I am running the following code:
importio.opentelemetry.api.GlobalOpenTelemetry;
importio.opentelemetry.api.OpenTelemetry;
importio.opentelemetry.api.common.Attributes;
importio.opentelemetry.api.trace.Span;
importio.opentelemetry.api.trace.Tracer;
importio.opentelemetry.context.Scope;
classPlainJava {
publicstaticvoidmain(String[] args) throwsException {
OpenTelemetryopenTelemetry = GlobalOpenTelemetry.get();
Tracertracer = openTelemetry.getTracer("plain-java", "1.0.0");
Spanspan = tracer.spanBuilder("my span").startSpan();
try (Scopess = span.makeCurrent()) {
// In this scope, the span is the current/active span
} finally {
span.end();
}
// Thread.sleep(10000);
}
}
This is running with -Dotel.java.global-autoconfigure.enabled=true and no other otel-related system properties or environment variables. A local Jaeger is listening on port 4317.
What did you expect to see?
I expected to see a trace with my span in my local Jaeger UI.
What did you see instead?
No trace was received.
What version and what artifacts are you using?
Artifacts:
opentelemetry-sdk
opentelemetry-sdk-extension-autoconfigure
opentelemetry-exporter-otlp
Version: v1.23.0
How did you reference these artifacts? From SBT:
I built opentelemetry-java locally, and can confirm OpenTelemetry.close() is called and that shutdown completes successfully.
The changes in 4df4a0a seem relevant, but I don't see a problem.
I originally hit this in Scala's otel4s, but I've minimized it to pure Java aside from the build. I can throw together a POM to completely eliminate Scala, but I don't think that's it.
The text was updated successfully, but these errors were encountered:
I can verify that this is a bug. Looks like I botched the ordering of the shutdown hook and its not operating on the OpenTelemetrySdk instance that ends up being used.
@jkwatson we should issue a patch for this. @trask can we hold off on the instrumentation release to incorporate the patch?
Describe the bug
Using
GlobalOpenTelemetry
with auto-configuration enabled, the application is no longer flushing spans in the JVM shutdown hook. If I sleep for some time at the end of the main method, it works. It works reliably without sleep on 1.22.0.Steps to reproduce
I am running the following code:
This is running with
-Dotel.java.global-autoconfigure.enabled=true
and no other otel-related system properties or environment variables. A local Jaeger is listening on port4317
.What did you expect to see?
I expected to see a trace with
my span
in my local Jaeger UI.What did you see instead?
No trace was received.
What version and what artifacts are you using?
Artifacts:
opentelemetry-sdk
opentelemetry-sdk-extension-autoconfigure
opentelemetry-exporter-otlp
Version:
v1.23.0
How did you reference these artifacts? From SBT:
Environment
Compiler: Azul Systems, Inc. Java 19.0.1
OS: MacOS Ventura 13.1
Additional context
OpenTelemetry.close()
is called and that shutdown completes successfully.The text was updated successfully, but these errors were encountered: