@ThreadSafe public final class OpenTelemetry extends Object
Tracer, Meter
and CorrelationContextManager.
The telemetry objects are lazy-loaded singletons resolved via ServiceLoader mechanism.
| Modifier and Type | Method and Description |
|---|---|
static CorrelationContextManager |
getCorrelationContextManager()
Returns a singleton
CorrelationContextManager. |
static Meter |
getMeter(String instrumentationName)
Gets or creates a named meter instance.
|
static Meter |
getMeter(String instrumentationName,
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(String instrumentationName)
Gets or creates a named tracer instance.
|
static Tracer |
getTracer(String instrumentationName,
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().IllegalStateException - if a specified TracerProvider (via system properties) could not
be found.public static Tracer getTracer(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(String instrumentationName, 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().IllegalStateException - if a specified MeterProvider (via system properties) could not be
found.public static Meter getMeter(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(String instrumentationName, 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 CorrelationContextManager getCorrelationContextManager()
CorrelationContextManager.DefaultCorrelationContextManager.getInstance().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.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.IllegalStateException - if a specified manager (via system properties) could not be
found.NullPointerException - if propagators is null.