Class OpenTelemetryTracingFactory (2.79.0)

public class OpenTelemetryTracingFactory implements ApiTracerFactory

A ApiTracerFactory to build instances of OpenTelemetryTracingTracer.

This class wraps the Tracer and pass it to OpenTelemetryTracingTracer. It will be used to record traces in OpenTelemetryTracingTracer.

This class is expected to be initialized once during client initialization.

Inheritance

java.lang.Object > OpenTelemetryTracingFactory

Implements

ApiTracerFactory

Constructors

OpenTelemetryTracingFactory(OpenTelemetry openTelemetry)

public OpenTelemetryTracingFactory(OpenTelemetry openTelemetry)

Warning: Traces may contain sensitive data such as resource names, full URLs, and error messages.

Before configuring subscribers or exporters for traces, review the contents of the spans and consult the OpenTelemetry documentation to set up filters and formatters to prevent leaking sensitive information, depending on your intended use case.

See also the OpenTelemetry Semantic Conventions.

Parameter
Name Description
openTelemetry io.opentelemetry.api.OpenTelemetry

Methods

needsContext()

public boolean needsContext()

Indicates whether this factory requires an ApiTracerContext to be injected via #withContext(ApiTracerContext) before creating tracers.

Returns
Type Description
boolean

newTracer(ApiTracer parent, ApiTracerContext apiTracerContext)

public ApiTracer newTracer(ApiTracer parent, ApiTracerContext apiTracerContext)

Create a new ApiTracer that will be a child of the current context.

Parameters
Name Description
parent ApiTracer
apiTracerContext ApiTracerContext
Returns
Type Description
ApiTracer

newTracer(ApiTracer parent, SpanName spanName, ApiTracerFactory.OperationType operationType)

public ApiTracer newTracer(ApiTracer parent, SpanName spanName, ApiTracerFactory.OperationType operationType)

Create a new ApiTracer that will be a child of the current context.

Parameters
Name Description
parent ApiTracer
spanName SpanName
operationType ApiTracerFactory.OperationType
Returns
Type Description
ApiTracer

withContext(ApiTracerContext context)

public ApiTracerFactory withContext(ApiTracerContext context)

Returns a new OpenTelemetryTracingFactory with the provided context. The Tracer is re-initialized using the artifact name and version from the library metadata.

Parameter
Name Description
context ApiTracerContext
Returns
Type Description
ApiTracerFactory