Class DisabledTraceUtil (2.22.0)

public class DisabledTraceUtil implements TraceUtil

Tracing utility implementation, used to stub out tracing instrumentation when tracing is disabled.

Inheritance

java.lang.Object > DisabledTraceUtil

Implements

TraceUtil

Constructors

DisabledTraceUtil()

public DisabledTraceUtil()

Methods

addSettingsAttributesToCurrentSpan(SpanBuilder spanBuilder)

public SpanBuilder addSettingsAttributesToCurrentSpan(SpanBuilder spanBuilder)

Adds common SpanAttributes to the current span, useful when hand-creating a new Span without using the TraceUtil.Span interface.

Parameter
Name Description
spanBuilder io.opentelemetry.api.trace.SpanBuilder
Returns
Type Description
io.opentelemetry.api.trace.SpanBuilder

getChannelConfigurator()

public ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> getChannelConfigurator()

Returns a channel configurator for gRPC, or null if tracing is disabled.

Returns
Type Description
ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder>

getCurrentContext()

public TraceUtil.Context getCurrentContext()

Returns the current Context.

Returns
Type Description
TraceUtil.Context

getCurrentSpan()

public TraceUtil.Span getCurrentSpan()

Returns the current span.

Returns
Type Description
TraceUtil.Span

getTracer()

public Tracer getTracer()

Returns the current OpenTelemetry Tracer when OpenTelemetry SDK is provided.

Returns
Type Description
io.opentelemetry.api.trace.Tracer

startSpan(String spanName)

public DisabledTraceUtil.Span startSpan(String spanName)

Starts a new span with the given name, sets it as the current span, and returns it.

Parameter
Name Description
spanName String
Returns
Type Description
com.google.cloud.datastore.telemetry.DisabledTraceUtil.Span

startSpan(String spanName, TraceUtil.Span parentSpan)

public TraceUtil.Span startSpan(String spanName, TraceUtil.Span parentSpan)

Starts a new span with the given name and the span represented by the parentSpan as its parent, sets it as the current span and returns it.

Parameters
Name Description
spanName String
parentSpan TraceUtil.Span
Returns
Type Description
TraceUtil.Span