Interface TraceUtil (3.30.0)

public interface TraceUtil

A utility interface for trace collection. Classes that implement this interface may make their own design choices for how they approach trace collection. For instance, they may be no-op, or they may use a particular tracing framework such as OpenTelemetry.

Static Fields

ATTRIBUTE_KEY_ATTEMPT

public static final String ATTRIBUTE_KEY_ATTEMPT
Field Value
Type Description
String

ATTRIBUTE_KEY_ATTEMPTS_ALLOWED

public static final String ATTRIBUTE_KEY_ATTEMPTS_ALLOWED
Field Value
Type Description
String

ATTRIBUTE_KEY_ATTEMPTS_REMAINING

public static final String ATTRIBUTE_KEY_ATTEMPTS_REMAINING
Field Value
Type Description
String

ATTRIBUTE_KEY_DOC_COUNT

public static final String ATTRIBUTE_KEY_DOC_COUNT
Field Value
Type Description
String

ATTRIBUTE_KEY_IS_RETRY_WITH_CURSOR

public static final String ATTRIBUTE_KEY_IS_RETRY_WITH_CURSOR
Field Value
Type Description
String

ATTRIBUTE_KEY_IS_TRANSACTIONAL

public static final String ATTRIBUTE_KEY_IS_TRANSACTIONAL
Field Value
Type Description
String

ATTRIBUTE_KEY_NUM_RESPONSES

public static final String ATTRIBUTE_KEY_NUM_RESPONSES
Field Value
Type Description
String

ATTRIBUTE_KEY_TRANSACTION_TYPE

public static final String ATTRIBUTE_KEY_TRANSACTION_TYPE
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

Static Methods

getInstance(FirestoreOptions firestoreOptions)

public static TraceUtil getInstance(FirestoreOptions firestoreOptions)

Creates and returns an instance of the TraceUtil class.

Parameter
Name Description
firestoreOptions FirestoreOptions

The FirestoreOptions object that is requesting an instance of TraceUtil.

Returns
Type Description
TraceUtil

An instance of the TraceUtil class.

Methods

currentContext()

public abstract TraceUtil.Context currentContext()

Returns the current Context.

Returns
Type Description
TraceUtil.Context

currentSpan()

public abstract TraceUtil.Span currentSpan()

Returns the current span.

Returns
Type Description
TraceUtil.Span

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>

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.Context parent)

public abstract TraceUtil.Span startSpan(String spanName, TraceUtil.Context parent)

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

Parameters
Name Description
spanName String
parent TraceUtil.Context
Returns
Type Description
TraceUtil.Span