Class BaseApiTracer

java.lang.Object
com.google.api.gax.tracing.BaseApiTracer
All Implemented Interfaces:
ApiTracer
Direct Known Subclasses:
OpencensusTracer

@InternalApi("For internal use by google-cloud-java clients only") public class BaseApiTracer extends Object implements ApiTracer
A base implementation of ApiTracer that does nothing. With the deprecation of Java 7 support, all the methods in ApiTracer are now made default, we no longer need a base class that does nothing. This class should be removed once all the references to it are removed in Google Cloud Client Libraries.

For internal use only.

  • Constructor Details

    • BaseApiTracer

      protected BaseApiTracer()
  • Method Details

    • getInstance

      public static ApiTracer getInstance()
    • inScope

      public ApiTracer.Scope inScope()
      Description copied from interface: ApiTracer
      Asks the underlying implementation to install itself as a thread local. This allows for interop between clients using gax and external resources to share the same implementation of the tracing. For example OpenCensus will install a thread local that can read by the GRPC.
      Specified by:
      inScope in interface ApiTracer
    • operationSucceeded

      public void operationSucceeded()
      Description copied from interface: ApiTracer
      Signals that the overall operation has finished successfully. The tracer is now considered closed and should no longer be used.
      Specified by:
      operationSucceeded in interface ApiTracer
    • operationCancelled

      public void operationCancelled()
      Description copied from interface: ApiTracer
      Signals that the operation was cancelled by the user. The tracer is now considered closed and should no longer be used.
      Specified by:
      operationCancelled in interface ApiTracer
    • operationFailed

      public void operationFailed(Throwable error)
      Description copied from interface: ApiTracer
      Signals that the overall operation has failed and no further attempts will be made. The tracer is now considered closed and should no longer be used.
      Specified by:
      operationFailed in interface ApiTracer
      Parameters:
      error - the final error that caused the operation to fail.
    • connectionSelected

      public void connectionSelected(String id)
      Description copied from interface: ApiTracer
      Annotates the operation with selected connection id from the ChannelPool.
      Specified by:
      connectionSelected in interface ApiTracer
      Parameters:
      id - the local connection identifier of the selected connection.
    • attemptStarted

      public void attemptStarted(int attemptNumber)
      Description copied from interface: ApiTracer
      Adds an annotation that an attempt is about to start. In general this should occur at the very start of the operation. The attemptNumber is zero based. So the initial attempt will be 0.
      Specified by:
      attemptStarted in interface ApiTracer
      Parameters:
      attemptNumber - the zero based sequential attempt number.
    • attemptStarted

      public void attemptStarted(Object request, int attemptNumber)
      Description copied from interface: ApiTracer
      Adds an annotation that an attempt is about to start with additional information from the request. In general this should occur at the very start of the operation. The attemptNumber is zero based. So the initial attempt will be 0.
      Specified by:
      attemptStarted in interface ApiTracer
      Parameters:
      request - request of this attempt.
      attemptNumber - the zero based sequential attempt number.
    • attemptSucceeded

      public void attemptSucceeded()
      Description copied from interface: ApiTracer
      Adds an annotation that the attempt succeeded.
      Specified by:
      attemptSucceeded in interface ApiTracer
    • attemptCancelled

      public void attemptCancelled()
      Description copied from interface: ApiTracer
      Add an annotation that the attempt was cancelled by the user.
      Specified by:
      attemptCancelled in interface ApiTracer
    • attemptFailed

      @ObsoleteApi("Use attemptFailedDuration(Throwable, java.time.Duration) instead") public void attemptFailed(Throwable error, org.threeten.bp.Duration delay)
      Specified by:
      attemptFailed in interface ApiTracer
    • attemptFailedRetriesExhausted

      public void attemptFailedRetriesExhausted(Throwable error)
      Description copied from interface: ApiTracer
      Adds an annotation that the attempt failed and that no further attempts will be made because retry limits have been reached.
      Specified by:
      attemptFailedRetriesExhausted in interface ApiTracer
      Parameters:
      error - the last error received before retries were exhausted.
    • attemptPermanentFailure

      public void attemptPermanentFailure(Throwable error)
      Description copied from interface: ApiTracer
      Adds an annotation that the attempt failed and that no further attempts will be made because the last error was not retryable.
      Specified by:
      attemptPermanentFailure in interface ApiTracer
      Parameters:
      error - the error that caused the final attempt to fail.
    • lroStartFailed

      public void lroStartFailed(Throwable error)
      Description copied from interface: ApiTracer
      Signals that the initial RPC for the long running operation failed.
      Specified by:
      lroStartFailed in interface ApiTracer
      Parameters:
      error - the error that caused the long running operation fail.
    • lroStartSucceeded

      public void lroStartSucceeded()
      Description copied from interface: ApiTracer
      Signals that the initial RPC successfully started the long running operation. The long running operation will now be polled for completion.
      Specified by:
      lroStartSucceeded in interface ApiTracer
    • responseReceived

      public void responseReceived()
      Description copied from interface: ApiTracer
      Adds an annotation that a streaming response has been received.
      Specified by:
      responseReceived in interface ApiTracer
    • requestSent

      public void requestSent()
      Description copied from interface: ApiTracer
      Adds an annotation that a streaming request has been sent.
      Specified by:
      requestSent in interface ApiTracer
    • batchRequestSent

      public void batchRequestSent(long elementCount, long requestSize)
      Description copied from interface: ApiTracer
      Adds an annotation that a batch of writes has been flushed.
      Specified by:
      batchRequestSent in interface ApiTracer
      Parameters:
      elementCount - the number of elements in the batch.
      requestSize - the size of the batch in bytes.