Interface TraceUtil (2.24.3)

public interface TraceUtil

Utility interface to manage OpenTelemetry tracing instrumentation based on the configuration.

Static Fields

ATTRIBUTES_KEY_DEFERRED

public static final String ATTRIBUTES_KEY_DEFERRED
Field Value
Type Description
String

ATTRIBUTES_KEY_DOCUMENT_COUNT

public static final String ATTRIBUTES_KEY_DOCUMENT_COUNT
Field Value
Type Description
String

ATTRIBUTES_KEY_MISSING

public static final String ATTRIBUTES_KEY_MISSING
Field Value
Type Description
String

ATTRIBUTES_KEY_MORE_RESULTS

public static final String ATTRIBUTES_KEY_MORE_RESULTS
Field Value
Type Description
String

ATTRIBUTES_KEY_READ_CONSISTENCY

public static final String ATTRIBUTES_KEY_READ_CONSISTENCY
Field Value
Type Description
String

ATTRIBUTES_KEY_RECEIVED

public static final String ATTRIBUTES_KEY_RECEIVED
Field Value
Type Description
String

ATTRIBUTES_KEY_TRANSACTIONAL

public static final String ATTRIBUTES_KEY_TRANSACTIONAL
Field Value
Type Description
String

ATTRIBUTES_KEY_TRANSACTION_ID

public static final String ATTRIBUTES_KEY_TRANSACTION_ID
Field Value
Type Description
String

ATTRIBUTE_SERVICE_PREFIX

public static final String ATTRIBUTE_SERVICE_PREFIX
Field Value
Type Description
String

ENABLE_TRACING_ENV_VAR

public static final String ENABLE_TRACING_ENV_VAR
Field Value
Type Description
String

LIBRARY_NAME

public static final String LIBRARY_NAME
Field Value
Type Description
String

SPAN_NAME_ALLOCATE_IDS

public static final String SPAN_NAME_ALLOCATE_IDS
Field Value
Type Description
String

SPAN_NAME_BEGIN_TRANSACTION

public static final String SPAN_NAME_BEGIN_TRANSACTION
Field Value
Type Description
String

SPAN_NAME_COMMIT

public static final String SPAN_NAME_COMMIT
Field Value
Type Description
String

SPAN_NAME_LOOKUP

public static final String SPAN_NAME_LOOKUP
Field Value
Type Description
String

SPAN_NAME_RESERVE_IDS

public static final String SPAN_NAME_RESERVE_IDS
Field Value
Type Description
String

SPAN_NAME_ROLLBACK

public static final String SPAN_NAME_ROLLBACK
Field Value
Type Description
String

SPAN_NAME_RUN_AGGREGATION_QUERY

public static final String SPAN_NAME_RUN_AGGREGATION_QUERY
Field Value
Type Description
String

SPAN_NAME_RUN_QUERY

public static final String SPAN_NAME_RUN_QUERY
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_COMMIT

public static final String SPAN_NAME_TRANSACTION_COMMIT
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_LOOKUP

public static final String SPAN_NAME_TRANSACTION_LOOKUP
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_RUN

public static final String SPAN_NAME_TRANSACTION_RUN
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_RUN_AGGREGATION_QUERY

public static final String SPAN_NAME_TRANSACTION_RUN_AGGREGATION_QUERY
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_RUN_QUERY

public static final String SPAN_NAME_TRANSACTION_RUN_QUERY
Field Value
Type Description
String

Static Methods

getInstance(DatastoreOptions datastoreOptions)

public static TraceUtil getInstance(DatastoreOptions datastoreOptions)

Creates and returns an instance of the TraceUtil class.

Parameter
Name Description
datastoreOptions DatastoreOptions

The DatastoreOptions object that is requesting an instance of TraceUtil.

Returns
Type Description
TraceUtil

An instance of the TraceUtil class.

Methods

addSettingsAttributesToCurrentSpan(SpanBuilder spanBuilder)

public abstract 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 abstract 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 abstract TraceUtil.Context getCurrentContext()

Returns the current Context.

Returns
Type Description
TraceUtil.Context

getCurrentSpan()

public abstract TraceUtil.Span getCurrentSpan()

Returns the current span.

Returns
Type Description
TraceUtil.Span

getTracer()

public abstract Tracer getTracer()

Returns the current OpenTelemetry Tracer when OpenTelemetry SDK is provided.

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

startSpan(String spanName)

public abstract TraceUtil.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
TraceUtil.Span

startSpan(String spanName, TraceUtil.Span parentSpan)

public abstract 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