Class EnabledTraceUtil (2.33.0)

publicclass EnabledTraceUtilimplementsTraceUtil

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

Inheritance

java.lang.Object > EnabledTraceUtil

Implements

TraceUtil

Methods

addSettingsAttributesToCurrentSpan(SpanBuilder spanBuilder)

publicSpanBuilderaddSettingsAttributesToCurrentSpan(SpanBuilderspanBuilder)

Applies the current Datastore instance settings as attributes to the current Span

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

getChannelConfigurator()

publicApiFunction<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()

publicTraceUtil.ContextgetCurrentContext()

Returns the current Context.

Returns
Type Description
TraceUtil.Context

getCurrentSpan()

publicTraceUtil.SpangetCurrentSpan()

Returns the current span.

Returns
Type Description
TraceUtil.Span

getOpenTelemetry()

publicOpenTelemetrygetOpenTelemetry()
Returns
Type Description
io.opentelemetry.api.OpenTelemetry

getTracer()

publicTracergetTracer()

Returns the current OpenTelemetry Tracer when OpenTelemetry SDK is provided.

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

startSpan(String spanName)

publicEnabledTraceUtil.SpanstartSpan(StringspanName)

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.EnabledTraceUtil.Span

startSpan(String spanName, TraceUtil.Span parentSpan)

publicTraceUtil.SpanstartSpan(StringspanName,TraceUtil.SpanparentSpan)

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

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.