Interface TraceUtil (3.26.5)

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

SPAN_NAME_AGGREGATION_QUERY_GET

public static final String SPAN_NAME_AGGREGATION_QUERY_GET
Field Value
Type Description
String

SPAN_NAME_BATCH_COMMIT

public static final String SPAN_NAME_BATCH_COMMIT
Field Value
Type Description
String

SPAN_NAME_BATCH_GET_DOCUMENTS

public static final String SPAN_NAME_BATCH_GET_DOCUMENTS
Field Value
Type Description
String

SPAN_NAME_BULK_WRITER_COMMIT

public static final String SPAN_NAME_BULK_WRITER_COMMIT
Field Value
Type Description
String

SPAN_NAME_COL_REF_ADD

public static final String SPAN_NAME_COL_REF_ADD
Field Value
Type Description
String

SPAN_NAME_COL_REF_LIST_DOCUMENTS

public static final String SPAN_NAME_COL_REF_LIST_DOCUMENTS
Field Value
Type Description
String

SPAN_NAME_DOC_REF_CREATE

public static final String SPAN_NAME_DOC_REF_CREATE
Field Value
Type Description
String

SPAN_NAME_DOC_REF_DELETE

public static final String SPAN_NAME_DOC_REF_DELETE
Field Value
Type Description
String

SPAN_NAME_DOC_REF_GET

public static final String SPAN_NAME_DOC_REF_GET
Field Value
Type Description
String

SPAN_NAME_DOC_REF_LIST_COLLECTIONS

public static final String SPAN_NAME_DOC_REF_LIST_COLLECTIONS
Field Value
Type Description
String

SPAN_NAME_DOC_REF_SET

public static final String SPAN_NAME_DOC_REF_SET
Field Value
Type Description
String

SPAN_NAME_DOC_REF_UPDATE

public static final String SPAN_NAME_DOC_REF_UPDATE
Field Value
Type Description
String

SPAN_NAME_PARTITION_QUERY

public static final String SPAN_NAME_PARTITION_QUERY
Field Value
Type Description
String

SPAN_NAME_QUERY_GET

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

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

public static final String SPAN_NAME_TRANSACTION_GET_AGGREGATION_QUERY
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_GET_DOCUMENT

public static final String SPAN_NAME_TRANSACTION_GET_DOCUMENT
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_GET_DOCUMENTS

public static final String SPAN_NAME_TRANSACTION_GET_DOCUMENTS
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_GET_QUERY

public static final String SPAN_NAME_TRANSACTION_GET_QUERY
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_ROLLBACK

public static final String SPAN_NAME_TRANSACTION_ROLLBACK
Field Value
Type Description
String

SPAN_NAME_TRANSACTION_RUN

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