Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Build Status Released Version

deprecated Global tracer resolution for Java

Global Tracer forwarding to another Tracer implementation.

Note: GlobalTracer has been included in core OpenTracing Java since opentracing-java version 0.21.0.
This contrib project is now deprecated.


Provides the GlobalTracer.get() method that returns the singleton global tracer.

When the tracer is needed it is lazily looked up using the following rules:

  1. The tracer from the last register(tracer) call always takes precedence.
  2. If no tracer was registered, one is resolved by the TracerResolver.
  3. If no Tracer is resolved, the NoopTracer will be used.

How to use this library

Some examples on how this library can be used:

Application intialization

Initialize a new tracer from the application configuration and let it to become the GlobalTracer for the application:

    Tracer configuredTracer = applicationConfiguration.buildConfiguredTracer();

Using the global tracer

Once initialized, all application code can instrument tracing by starting new spans like:

    try (Span span = GlobalTracer.get().buildSpan("someOperation").start()) {
        // ... Traced block of code ...

If no GlobalTracer is configured, this code will not throw any exceptions. Tracing is simply delegated to the NoopTracer instead.