@ThreadSafe
public final class OpenTelemetry
extends java.lang.Object
Tracer
, Meter
and BaggageManager
.
The telemetry objects are lazy-loaded singletons resolved via ServiceLoader
mechanism.
TracerProvider
,
MeterProviderFactory
,
BaggageManagerFactory
Modifier and Type | Method and Description |
---|---|
static BaggageManager |
getBaggageManager()
Returns a singleton
BaggageManager . |
static Meter |
getMeter(java.lang.String instrumentationName)
Gets or creates a named meter instance.
|
static Meter |
getMeter(java.lang.String instrumentationName,
java.lang.String instrumentationVersion)
Gets or creates a named and versioned meter instance.
|
static MeterProvider |
getMeterProvider()
Returns a singleton
MeterProvider . |
static io.opentelemetry.context.propagation.ContextPropagators |
getPropagators()
Returns a
ContextPropagators object, which can be used to access the set of registered
propagators for each supported format. |
static Tracer |
getTracer(java.lang.String instrumentationName)
Gets or creates a named tracer instance.
|
static Tracer |
getTracer(java.lang.String instrumentationName,
java.lang.String instrumentationVersion)
Gets or creates a named and versioned tracer instance.
|
static TracerProvider |
getTracerProvider()
Returns a singleton
TracerProvider . |
static void |
setPropagators(io.opentelemetry.context.propagation.ContextPropagators propagators)
Sets the
ContextPropagators object, which can be used to access the set of registered
propagators for each supported format. |
public static TracerProvider getTracerProvider()
TracerProvider
.DefaultTracerProvider.getInstance()
.java.lang.IllegalStateException
- if a specified TracerProvider (via system properties) could not
be found.public static Tracer getTracer(java.lang.String instrumentationName)
This is a shortcut method for getTracerProvider().get(instrumentationName)
.
instrumentationName
- The name of the instrumentation library, not the name of the
instrument*ed* library (e.g., "io.opentelemetry.contrib.mongodb"). Must not be null.public static Tracer getTracer(java.lang.String instrumentationName, java.lang.String instrumentationVersion)
This is a shortcut method for
getTracerProvider().get(instrumentationName, instrumentationVersion)
.
instrumentationName
- The name of the instrumentation library, not the name of the
instrument*ed* library (e.g., "io.opentelemetry.contrib.mongodb"). Must not be null.instrumentationVersion
- The version of the instrumentation library (e.g.,
"semver:1.0.0").public static MeterProvider getMeterProvider()
MeterProvider
.DefaultMeterProvider.getInstance()
.java.lang.IllegalStateException
- if a specified MeterProvider (via system properties) could not be
found.public static Meter getMeter(java.lang.String instrumentationName)
This is a shortcut method for getMeterProvider().get(instrumentationName)
.
instrumentationName
- The name of the instrumentation library, not the name of the
instrument*ed* library.public static Meter getMeter(java.lang.String instrumentationName, java.lang.String instrumentationVersion)
This is a shortcut method for
getMeterProvider().get(instrumentationName, instrumentationVersion)
.
instrumentationName
- The name of the instrumentation library, not the name of the
instrument*ed* library.instrumentationVersion
- The version of the instrumentation library.public static BaggageManager getBaggageManager()
BaggageManager
.DefaultBaggageManager.getInstance()
.java.lang.IllegalStateException
- if a specified manager (via system properties) could not be
found.public static io.opentelemetry.context.propagation.ContextPropagators getPropagators()
ContextPropagators
object, which can be used to access the set of registered
propagators for each supported format.ContextPropagators
object
with HttpTraceContext
registered.java.lang.IllegalStateException
- if a specified manager (via system properties) could not be
found.public static void setPropagators(io.opentelemetry.context.propagation.ContextPropagators propagators)
ContextPropagators
object, which can be used to access the set of registered
propagators for each supported format.propagators
- the ContextPropagators
object to be registered.java.lang.IllegalStateException
- if a specified manager (via system properties) could not be
found.java.lang.NullPointerException
- if propagators
is null
.