Class BaseApiTracer

  • All Implemented Interfaces:
    ApiTracer
    Direct Known Subclasses:
    OpencensusTracer

    @InternalApi("For internal use by google-cloud-java clients only")
    public class BaseApiTracer
    extends java.lang.Object
    implements ApiTracer
    A base implementation of ApiTracer that does nothing.

    For internal use only.

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseApiTracer()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void attemptCancelled()
      Add an annotation that the attempt was cancelled by the user.
      void attemptFailed​(java.lang.Throwable error, org.threeten.bp.Duration delay)
      Adds an annotation that the attempt failed, but another attempt will be made after the delay.
      void attemptFailedRetriesExhausted​(java.lang.Throwable error)
      Adds an annotation that the attempt failed and that no further attempts will be made because retry limits have been reached.
      void attemptPermanentFailure​(java.lang.Throwable error)
      Adds an annotation that the attempt failed and that no further attempts will be made because the last error was not retryable.
      void attemptStarted​(int attemptNumber)
      Adds an annotation that an attempt is about to start.
      void attemptStarted​(java.lang.Object request, int attemptNumber)
      Adds an annotation that an attempt is about to start with additional information from the request.
      void attemptSucceeded()
      Adds an annotation that the attempt succeeded.
      void batchRequestSent​(long elementCount, long requestSize)
      Adds an annotation that a batch of writes has been flushed.
      void connectionSelected​(java.lang.String id)
      Annotates the operation with selected connection id from the ChannelPool.
      static ApiTracer getInstance()  
      ApiTracer.Scope inScope()
      Asks the underlying implementation to install itself as a thread local.
      void lroStartFailed​(java.lang.Throwable error)
      Signals that the initial RPC for the long running operation failed.
      void lroStartSucceeded()
      Signals that the initial RPC successfully started the long running operation.
      void operationCancelled()
      Signals that the operation was cancelled by the user.
      void operationFailed​(java.lang.Throwable error)
      Signals that the overall operation has failed and no further attempts will be made.
      void operationSucceeded()
      Signals that the overall operation has finished successfully.
      void requestSent()
      Adds an annotation that a streaming request has been sent.
      void responseReceived()
      Adds an annotation that a streaming response has been received.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseApiTracer

        protected BaseApiTracer()
    • Method Detail

      • 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​(java.lang.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​(java.lang.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​(java.lang.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

        public void attemptFailed​(java.lang.Throwable error,
                                  org.threeten.bp.Duration delay)
        Description copied from interface: ApiTracer
        Adds an annotation that the attempt failed, but another attempt will be made after the delay.
        Specified by:
        attemptFailed in interface ApiTracer
        Parameters:
        error - the transient error that caused the attempt to fail.
        delay - the amount of time to wait before the next attempt will start.
      • attemptFailedRetriesExhausted

        public void attemptFailedRetriesExhausted​(java.lang.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​(java.lang.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​(java.lang.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.