Interface TraceUtil
- All Known Implementing Classes:
DisabledTraceUtil,EnabledTraceUtil
@InternalExtensionOnly
public interface TraceUtil
Utility interface to manage OpenTelemetry tracing instrumentation based on the configuration.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a trace context.static interfaceRepresents a trace scope.static interfaceRepresents a trace span. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionio.opentelemetry.api.trace.SpanBuilderaddSettingsAttributesToCurrentSpan(io.opentelemetry.api.trace.SpanBuilder spanBuilder) Adds common SpanAttributes to the current span, useful when hand-creating a new Span without using the TraceUtil.Span interface.com.google.api.core.ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder> Returns a channel configurator for gRPC, ornullif tracing is disabled.Returns the current Context.Returns the current span.static TraceUtilgetInstance(DatastoreOptions datastoreOptions) Creates and returns an instance of the TraceUtil class.io.opentelemetry.api.trace.TracerReturns the current OpenTelemetry Tracer when OpenTelemetry SDK is provided.Starts a new span with the given name, sets it as the current span, and returns it.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.
-
Field Details
-
ATTRIBUTE_SERVICE_PREFIX
- See Also:
-
ENABLE_TRACING_ENV_VAR
- See Also:
-
LIBRARY_NAME
- See Also:
-
SPAN_NAME_LOOKUP
- See Also:
-
SPAN_NAME_ALLOCATE_IDS
- See Also:
-
SPAN_NAME_RESERVE_IDS
- See Also:
-
SPAN_NAME_COMMIT
- See Also:
-
SPAN_NAME_RUN_QUERY
- See Also:
-
SPAN_NAME_RUN_AGGREGATION_QUERY
- See Also:
-
SPAN_NAME_TRANSACTION_RUN
- See Also:
-
SPAN_NAME_BEGIN_TRANSACTION
- See Also:
-
SPAN_NAME_TRANSACTION_LOOKUP
- See Also:
-
SPAN_NAME_TRANSACTION_COMMIT
- See Also:
-
SPAN_NAME_TRANSACTION_RUN_QUERY
- See Also:
-
SPAN_NAME_ROLLBACK
- See Also:
-
SPAN_NAME_TRANSACTION_RUN_AGGREGATION_QUERY
- See Also:
-
ATTRIBUTES_KEY_DOCUMENT_COUNT
- See Also:
-
ATTRIBUTES_KEY_TRANSACTIONAL
- See Also:
-
ATTRIBUTES_KEY_TRANSACTION_ID
- See Also:
-
ATTRIBUTES_KEY_READ_CONSISTENCY
- See Also:
-
ATTRIBUTES_KEY_RECEIVED
- See Also:
-
ATTRIBUTES_KEY_MISSING
- See Also:
-
ATTRIBUTES_KEY_DEFERRED
- See Also:
-
ATTRIBUTES_KEY_MORE_RESULTS
- See Also:
-
-
Method Details
-
getInstance
Creates and returns an instance of the TraceUtil class.- Parameters:
datastoreOptions- The DatastoreOptions object that is requesting an instance of TraceUtil.- Returns:
- An instance of the TraceUtil class.
-
getChannelConfigurator
@Nullable com.google.api.core.ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder> getChannelConfigurator()Returns a channel configurator for gRPC, ornullif tracing is disabled. -
startSpan
Starts a new span with the given name, sets it as the current span, and returns it. -
startSpan
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. -
addSettingsAttributesToCurrentSpan
io.opentelemetry.api.trace.SpanBuilder addSettingsAttributesToCurrentSpan(io.opentelemetry.api.trace.SpanBuilder spanBuilder) Adds common SpanAttributes to the current span, useful when hand-creating a new Span without using the TraceUtil.Span interface. -
getCurrentSpan
Returns the current span. -
getCurrentContext
Returns the current Context. -
getTracer
io.opentelemetry.api.trace.Tracer getTracer()Returns the current OpenTelemetry Tracer when OpenTelemetry SDK is provided.
-