If using the OpenTelemetry SDK, you may want to instantiate the OpenTelemetry to
provide configuration, for example of Resource or Sampler. See OpenTelemetrySdk and OpenTelemetrySdk.builder for information on how to construct the
SDK's OpenTelemetry implementation.
Warning
Due to the inherent complications around initialization order involving this class and its single global instance, we strongly recommend *not* using GlobalOpenTelemetry unless you have a use-case that absolutely requires it. Please favor using instances of OpenTelemetry wherever possible.
If you are using the OpenTelemetry javaagent, it is generally best to only call GlobalOpenTelemetry.get() once, and then pass the resulting reference where you need to use it.
TracerProvider, ContextPropagators
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | GlobalOpenTelemetry.
Static global instances are obfuscated when they are returned from the API to prevent users from casting them to their SDK-specific implementation. |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static volatile GlobalOpenTelemetry. | |
| private static final Logger | |
| private static final Object | |
| private static Throwable |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static OpenTelemetry | |
| public static Meter | Returns: a Meter instance.A name uniquely identifying the instrumentation scope, such as
the instrumentation library, package, or fully qualified class name. Must not be null. instrumentationScopeName)Gets or creates a named meter instance from the globally registered |
| public static MeterProvider | |
| public static ContextPropagators | getPropagators()
Returns the globally registered |
| public static Tracer | Returns: a tracer instance.A name uniquely identifying the instrumentation scope, such as
the instrumentation library, package, or fully qualified class name. Must not be null. instrumentationScopeName)Gets or creates a named tracer instance from the globally registered |
| public static Tracer | Returns: a tracer instance.A name uniquely identifying the instrumentation scope, such as
the instrumentation library, package, or fully qualified class name. Must not be null. instrumentationScopeName, String The version of the instrumentation scope (e.g., "1.0.0"). instrumentationScopeVersion)Gets or creates a named and versioned tracer instance from the globally registered |
| public static TracerProvider | |
| private static OpenTelemetry | |
| public static MeterBuilder | Returns: a MeterBuilder instance.A name uniquely identifying the instrumentation scope, such as
the instrumentation library, package, or fully qualified class name. Must not be null. instrumentationScopeName)Creates a MeterBuilder for a named |
| public static void | |
| public static void | |
| public static TracerBuilder | Returns: a TracerBuilder instance.A name uniquely identifying the instrumentation scope, such as
the instrumentation library, package, or fully qualified class name. Must not be null. instrumentationScopeName)Creates a TracerBuilder for a named |
| GLOBAL_AUTOCONFIGURE_ENABLED_PROPERTY | back to summary |
|---|---|
| private static final String GLOBAL_AUTOCONFIGURE_ENABLED_PROPERTY | |
| globalOpenTelemetry | back to summary |
|---|---|
private static volatile GlobalOpenTelemetry.
| |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| mutex | back to summary |
|---|---|
| private static final Object mutex | |
| setGlobalCaller | back to summary |
|---|---|
private static Throwable setGlobalCaller
| |
| GlobalOpenTelemetry | back to summary |
|---|---|
| private GlobalOpenTelemetry() | |
| get | back to summary |
|---|---|
| public static OpenTelemetry get() Returns the registered global
| |
| getMeter | back to summary |
|---|---|
| public static Meter getMeter(String instrumentationScopeName) Gets or creates a named meter instance from the globally registered This is a shortcut method for | |
| getMeterProvider | back to summary |
|---|---|
| public static MeterProvider getMeterProvider() Returns the globally registered
| |
| getPropagators | back to summary |
|---|---|
| public static ContextPropagators getPropagators() Returns the globally registered | |
| getTracer | back to summary |
|---|---|
| public static Tracer getTracer(String instrumentationScopeName) Gets or creates a named tracer instance from the globally registered This is a shortcut method for | |
| getTracer | back to summary |
|---|---|
| public static Tracer getTracer(String instrumentationScopeName, String instrumentationScopeVersion) Gets or creates a named and versioned tracer instance from the globally registered This is a shortcut method for
| |
| getTracerProvider | back to summary |
|---|---|
| public static TracerProvider getTracerProvider() Returns the globally registered | |
| maybeAutoConfigureAndSetGlobal | back to summary |
|---|---|
private static OpenTelemetry maybeAutoConfigureAndSetGlobal()
| |
| meterBuilder | back to summary |
|---|---|
| public static MeterBuilder meterBuilder(String instrumentationScopeName) Creates a MeterBuilder for a named This is a shortcut method for
| |
| resetForTest | back to summary |
|---|---|
| public static void resetForTest() Unsets the global | |
| set | back to summary |
|---|---|
| public static void set(OpenTelemetry openTelemetry) Sets the If you are using the OpenTelemetry SDK, you should generally use | |
| tracerBuilder | back to summary |
|---|---|
| public static TracerBuilder tracerBuilder(String instrumentationScopeName) Creates a TracerBuilder for a named This is a shortcut method for
| |
(OpenTelemetrySdk) GlobalOpenTelemetry.get().
| Modifier and Type | Field and Description |
|---|---|
| private final OpenTelemetry |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| delegate | back to summary |
|---|---|
| private final OpenTelemetry delegate | |
| ObfuscatedOpenTelemetry | back to summary |
|---|---|
| pack-priv ObfuscatedOpenTelemetry(OpenTelemetry delegate) | |
| getLogsBridge | back to summary |
|---|---|
| public LoggerProvider getLogsBridge() Overrides default io. Doc from io. Returns the The OpenTelemetry logs bridge API exists to enable bridging logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry and is NOT a replacement log API.
| |
| getMeterProvider | back to summary |
|---|---|
| public MeterProvider getMeterProvider() Overrides default io. Doc from io. Returns the
| |
| getPropagators | back to summary |
|---|---|
| public ContextPropagators getPropagators() Implements io. Doc from io. Returns the
| |
| getTracerProvider | back to summary |
|---|---|
| public TracerProvider getTracerProvider() Implements io. Doc from io. Returns the
| |
| tracerBuilder | back to summary |
|---|---|
| public TracerBuilder tracerBuilder(String instrumentationScopeName) Overrides default io. Doc from io. Creates a
| |