Interface TraceUtil

All Known Implementing Classes:
DisabledTraceUtil, EnabledTraceUtil

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.
  • Field Details

  • Method Details

    • getInstance

      @InternalApi static TraceUtil getInstance(@Nonnull FirestoreOptions firestoreOptions)
      Creates and returns an instance of the TraceUtil class.
      Parameters:
      firestoreOptions - The FirestoreOptions 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, or null if tracing is disabled.
    • startSpan

      TraceUtil.Span startSpan(String spanName)
      Starts a new span with the given name, sets it as the current span, and returns it.
    • startSpan

      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.
    • currentSpan

      @Nonnull TraceUtil.Span currentSpan()
      Returns the current span.
    • currentContext

      @Nonnull TraceUtil.Context currentContext()
      Returns the current Context.