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 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 io.opentelemetry.context.propagation.ContextPropagators
getPropagators()
Returns theContextPropagators
for thisOpenTelemetry
.default Tracer
getTracer(String instrumentationName)
Gets or creates a named tracer instance from theTracerProvider
for thisOpenTelemetry
.default Tracer
getTracer(String instrumentationName, String instrumentationVersion)
Gets or creates a named and versioned tracer instance from theTracerProvider
in thisOpenTelemetry
.TracerProvider
getTracerProvider()
Returns theTracerProvider
for thisOpenTelemetry
.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.
-
-
-
Method Detail
-
noop
static OpenTelemetry 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
default Tracer getTracer(String instrumentationName)
Gets or creates a named tracer instance from theTracerProvider
for thisOpenTelemetry
.- Parameters:
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.- Returns:
- a tracer instance.
-
getTracer
default Tracer getTracer(String instrumentationName, String instrumentationVersion)
Gets or creates a named and versioned tracer instance from theTracerProvider
in thisOpenTelemetry
.- Parameters:
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., "1.0.0").- Returns:
- a tracer instance.
-
getPropagators
io.opentelemetry.context.propagation.ContextPropagators getPropagators()
Returns theContextPropagators
for thisOpenTelemetry
.
-
-