Package io.opentelemetry.api
Interface OpenTelemetry
-
- All Known Implementing Classes:
DefaultOpenTelemetry,GlobalOpenTelemetry.ObfuscatedOpenTelemetry,OpenTelemetrySdk
public interface OpenTelemetryThe entrypoint to telemetry functionality for tracing, metrics and baggage.If using the OpenTelemetry SDK, you may want to instantiate the
OpenTelemetryto provide configuration, for example ofResourceorSampler. SeeOpenTelemetrySdkandOpenTelemetrySdk.builderfor 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 LoggerProvidergetLogsBridge()Returns theLoggerProviderfor bridging logs into OpenTelemetry.default MetergetMeter(java.lang.String instrumentationScopeName)Gets or creates a named meter instance from theMeterProviderfor thisOpenTelemetry.default MeterProvidergetMeterProvider()Returns theMeterProviderfor thisOpenTelemetry.ContextPropagatorsgetPropagators()Returns theContextPropagatorsfor thisOpenTelemetry.default TracergetTracer(java.lang.String instrumentationScopeName)Gets or creates a named tracer instance from theTracerProviderfor thisOpenTelemetry.default TracergetTracer(java.lang.String instrumentationScopeName, java.lang.String instrumentationScopeVersion)Gets or creates a named and versioned tracer instance from theTracerProviderin thisOpenTelemetry.TracerProvidergetTracerProvider()Returns theTracerProviderfor thisOpenTelemetry.default MeterBuildermeterBuilder(java.lang.String instrumentationScopeName)Creates aMeterBuilderfor a namedMeterinstance.static OpenTelemetrynoop()Returns a completely no-opOpenTelemetry.static OpenTelemetrypropagating(ContextPropagators propagators)Returns anOpenTelemetrywhich will do remote propagation ofContextusing the providedContextPropagatorsand is no-op otherwise.default TracerBuildertracerBuilder(java.lang.String instrumentationScopeName)Creates aTracerBuilderfor a namedTracerinstance.
-
-
-
Method Detail
-
noop
static OpenTelemetry noop()
Returns a completely no-opOpenTelemetry.
-
propagating
static OpenTelemetry propagating(ContextPropagators propagators)
Returns anOpenTelemetrywhich will do remote propagation ofContextusing the providedContextPropagatorsand is no-op otherwise.
-
getTracerProvider
TracerProvider getTracerProvider()
Returns theTracerProviderfor thisOpenTelemetry.
-
getTracer
default Tracer getTracer(java.lang.String instrumentationScopeName)
Gets or creates a named tracer instance from theTracerProviderfor 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 theTracerProviderin 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 aTracerBuilderfor a namedTracerinstance.- 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 theMeterProviderfor thisOpenTelemetry.- Since:
- 1.10.0
-
getMeter
default Meter getMeter(java.lang.String instrumentationScopeName)
Gets or creates a named meter instance from theMeterProviderfor 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 aMeterBuilderfor a namedMeterinstance.- 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 theLoggerProviderfor 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 theContextPropagatorsfor thisOpenTelemetry.
-
-