Top Description Methods
io.opentelemetry.api

public Interface OpenTelemetry

Known Direct Implementers
io.opentelemetry.api.DefaultOpenTelemetry, io.opentelemetry.api.GlobalOpenTelemetry.ObfuscatedOpenTelemetry
Imports
io.opentelemetry.api.logs.LoggerProvider, io.opentelemetry.api.metrics.Meter, .MeterBuilder, .MeterProvider, io.opentelemetry.api.trace.Tracer, .TracerBuilder, .TracerProvider, io.opentelemetry.context.propagation.ContextPropagators

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 TypeMethod and Description
public default LoggerProvider
getLogsBridge()

Returns the LoggerProvider for bridging logs into OpenTelemetry.

public default Meter

Returns:

a Meter instance.
getMeter
(String
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 MeterProvider for this OpenTelemetry.

public default MeterProvider
public ContextPropagators
public default Tracer

Returns:

a tracer instance.
getTracer
(String
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 TracerProvider for this OpenTelemetry.

public default Tracer

Returns:

a tracer instance.
getTracer
(String
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 TracerProvider in this OpenTelemetry.

public TracerProvider
public default MeterBuilder

Returns:

a MeterBuilder instance.
meterBuilder
(String
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 Meter instance.

public static OpenTelemetry
noop()

Returns a completely no-op OpenTelemetry.

public static OpenTelemetry
propagating(ContextPropagators propagators)

Returns an OpenTelemetry which will do remote propagation of io.opentelemetry.context.Context using the provided ContextPropagators and is no-op otherwise.

public default TracerBuilder

Returns:

a TracerBuilder instance.
tracerBuilder
(String
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 Tracer instance.

Method Detail

getLogsBridgeback to summary
public default LoggerProvider getLogsBridge()

Returns the LoggerProvider 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
getMeterback to summary
public default Meter getMeter(String instrumentationScopeName)

Gets or creates a named meter instance from the MeterProvider for this OpenTelemetry.

Parameters
instrumentationScopeName:String

A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.

Returns:Meter

a Meter instance.

Since
1.10.0
getMeterProviderback to summary
public default MeterProvider getMeterProvider()

Returns the MeterProvider for this OpenTelemetry.

Since
1.10.0
getPropagatorsback to summary
public ContextPropagators getPropagators()

Returns the ContextPropagators for this OpenTelemetry.

getTracerback to summary
public default Tracer getTracer(String instrumentationScopeName)

Gets or creates a named tracer instance from the TracerProvider for this OpenTelemetry.

Parameters
instrumentationScopeName:String

A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.

Returns:Tracer

a tracer instance.

getTracerback to summary
public default Tracer getTracer(String instrumentationScopeName, String instrumentationScopeVersion)

Gets or creates a named and versioned tracer instance from the TracerProvider in this OpenTelemetry.

Parameters
instrumentationScopeName:String

A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.

instrumentationScopeVersion:String

The version of the instrumentation scope (e.g., "1.0.0").

Returns:Tracer

a tracer instance.

getTracerProviderback to summary
public TracerProvider getTracerProvider()

Returns the TracerProvider for this OpenTelemetry.

meterBuilderback to summary
public default MeterBuilder meterBuilder(String instrumentationScopeName)

Creates a MeterBuilder for a named Meter instance.

Parameters
instrumentationScopeName:String

A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.

Returns:MeterBuilder

a MeterBuilder instance.

Since
1.10.0
noopback to summary
public static OpenTelemetry noop()

Returns a completely no-op OpenTelemetry.

propagatingback to summary
public static OpenTelemetry propagating(ContextPropagators propagators)

Returns an OpenTelemetry which will do remote propagation of io.opentelemetry.context.Context using the provided ContextPropagators and is no-op otherwise.

tracerBuilderback to summary
public default TracerBuilder tracerBuilder(String instrumentationScopeName)

Creates a TracerBuilder for a named Tracer instance.

Parameters
instrumentationScopeName:String

A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.

Returns:TracerBuilder

a TracerBuilder instance.

Since
1.4.0