Package io.opentelemetry.api
Interface OpenTelemetry
-
- All Known Implementing Classes:
DefaultOpenTelemetry
,GlobalOpenTelemetry.ObfuscatedOpenTelemetry
,OpenTelemetrySdk
public interface OpenTelemetry
The entrypoint to telemetry functionality for tracing, metrics and baggage.If using the OpenTelemetry SDK, you may want to instantiate the
OpenTelemetry
to provide configuration, for example ofResource
orSampler
. SeeOpenTelemetrySdk
andOpenTelemetrySdk.builder
for information on how to construct the SDKOpenTelemetry
.- See Also:
TracerProvider
,ContextPropagators
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default LoggerProvider
getLogsBridge()
Returns theLoggerProvider
for bridging logs into OpenTelemetry.default Meter
getMeter(java.lang.String instrumentationScopeName)
Gets or creates a named meter instance from theMeterProvider
for thisOpenTelemetry
.default MeterProvider
getMeterProvider()
Returns theMeterProvider
for thisOpenTelemetry
.ContextPropagators
getPropagators()
Returns theContextPropagators
for thisOpenTelemetry
.default Tracer
getTracer(java.lang.String instrumentationScopeName)
Gets or creates a named tracer instance from theTracerProvider
for thisOpenTelemetry
.default Tracer
getTracer(java.lang.String instrumentationScopeName, java.lang.String instrumentationScopeVersion)
Gets or creates a named and versioned tracer instance from theTracerProvider
in thisOpenTelemetry
.TracerProvider
getTracerProvider()
Returns theTracerProvider
for thisOpenTelemetry
.default MeterBuilder
meterBuilder(java.lang.String instrumentationScopeName)
Creates aMeterBuilder
for a namedMeter
instance.static OpenTelemetry
noop()
Returns a completely no-opOpenTelemetry
.static OpenTelemetry
propagating(ContextPropagators propagators)
Returns anOpenTelemetry
which will do remote propagation ofContext
using the providedContextPropagators
and is no-op otherwise.default TracerBuilder
tracerBuilder(java.lang.String instrumentationScopeName)
Creates aTracerBuilder
for a namedTracer
instance.
-
-
-
Method Detail
-
noop
static OpenTelemetry noop()
Returns a completely no-opOpenTelemetry
.
-
propagating
static OpenTelemetry propagating(ContextPropagators propagators)
Returns anOpenTelemetry
which will do remote propagation ofContext
using the providedContextPropagators
and is no-op otherwise.
-
getTracerProvider
TracerProvider getTracerProvider()
Returns theTracerProvider
for thisOpenTelemetry
.
-
getTracer
default Tracer getTracer(java.lang.String instrumentationScopeName)
Gets or creates a named tracer instance from theTracerProvider
for thisOpenTelemetry
.- Parameters:
instrumentationScopeName
- A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.- Returns:
- a tracer instance.
-
getTracer
default Tracer getTracer(java.lang.String instrumentationScopeName, java.lang.String instrumentationScopeVersion)
Gets or creates a named and versioned tracer instance from theTracerProvider
in thisOpenTelemetry
.- Parameters:
instrumentationScopeName
- A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.instrumentationScopeVersion
- The version of the instrumentation scope (e.g., "1.0.0").- Returns:
- a tracer instance.
-
tracerBuilder
default TracerBuilder tracerBuilder(java.lang.String instrumentationScopeName)
Creates aTracerBuilder
for a namedTracer
instance.- Parameters:
instrumentationScopeName
- A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.- Returns:
- a TracerBuilder instance.
- Since:
- 1.4.0
-
getMeterProvider
default MeterProvider getMeterProvider()
Returns theMeterProvider
for thisOpenTelemetry
.- Since:
- 1.10.0
-
getMeter
default Meter getMeter(java.lang.String instrumentationScopeName)
Gets or creates a named meter instance from theMeterProvider
for thisOpenTelemetry
.- Parameters:
instrumentationScopeName
- A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.- Returns:
- a Meter instance.
- Since:
- 1.10.0
-
meterBuilder
default MeterBuilder meterBuilder(java.lang.String instrumentationScopeName)
Creates aMeterBuilder
for a namedMeter
instance.- Parameters:
instrumentationScopeName
- A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.- Returns:
- a MeterBuilder instance.
- Since:
- 1.10.0
-
getLogsBridge
default LoggerProvider getLogsBridge()
Returns theLoggerProvider
for bridging logs into OpenTelemetry.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.
- Since:
- 1.27.0
-
getPropagators
ContextPropagators getPropagators()
Returns theContextPropagators
for thisOpenTelemetry
.
-
-