Package io.opentelemetry.api
Interface OpenTelemetry
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 of Resource
or Sampler
. See
OpenTelemetrySdk
and OpenTelemetrySdk.builder
for information on how to construct the
SDK OpenTelemetry
.
- See Also:
-
TracerProvider
ContextPropagators
-
Method Summary
Modifier and TypeMethodDescriptiondefault LoggerProvider
Returns theLoggerProvider
for bridging logs into OpenTelemetry.default Meter
Gets or creates a named meter instance from theMeterProvider
for thisOpenTelemetry
.default MeterProvider
Returns theMeterProvider
for thisOpenTelemetry
.io.opentelemetry.context.propagation.ContextPropagators
Returns theContextPropagators
for thisOpenTelemetry
.default Tracer
Gets or creates a named tracer instance from theTracerProvider
for thisOpenTelemetry
.default Tracer
Gets or creates a named and versioned tracer instance from theTracerProvider
in thisOpenTelemetry
.Returns theTracerProvider
for thisOpenTelemetry
.default MeterBuilder
meterBuilder
(String instrumentationScopeName) Creates aMeterBuilder
for a namedMeter
instance.static OpenTelemetry
noop()
Returns a completely no-opOpenTelemetry
.static OpenTelemetry
propagating
(io.opentelemetry.context.propagation.ContextPropagators propagators) Returns anOpenTelemetry
which will do remote propagation ofContext
using the providedContextPropagators
and is no-op otherwise.default TracerBuilder
tracerBuilder
(String instrumentationScopeName) Creates aTracerBuilder
for a namedTracer
instance.
-
Method Details
-
noop
Returns a completely no-opOpenTelemetry
. -
propagating
static OpenTelemetry propagating(io.opentelemetry.context.propagation.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
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
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
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
Returns theMeterProvider
for thisOpenTelemetry
.- Since:
- 1.10.0
-
getMeter
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
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
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
io.opentelemetry.context.propagation.ContextPropagators getPropagators()Returns theContextPropagators
for thisOpenTelemetry
.
-