Classes
BaseApiTracer
A base implementation of ApiTracer that does nothing.
For internal use only.
BaseApiTracerFactory
Base factory that will build ApiTracers that do nothing.
For internal use only.
OpencensusTracer
Implementation of ApiTracer that uses OpenCensus.
This implementation wraps an OpenCensus Span for every tracer and annotates that Span with various events throughout the lifecycle of the logical operation.
Each span will be named ClientName.MethodName
and will have the following attributes:
attempt count
- The Number of attempts sent before the logical operation completed
status
- The status code of the last attempt
total response count
- The number of messages received across all of the attempts. This will only be set for server streaming and bidi RPCs.
total request count
- The number of messages sent across all of the attempts. This will only be set for client streaming and bidi RPCs.
batch count
- For batch requests, the number of elements in the request.
batch size
- For batch requests, the byte size of the request.
The spans will contain the following annotations:
Attempt cancelled
with the following attributes:attempt
- Zero based sequential attempt number
attempt request count
- The number of requests sent in this attempt. This will only be set for client streaming and bidi RPCs.
attempt response count
- The number of responses received in this attempt. This will only be set for server streaming and bidi RPCs.
connection
- The UUID of the connection which the attempt was sent.
Attempt failed, scheduling next attempt
with the following attributes:attempt
- Zero based sequential attempt number
status
- The status code of the failed attempt
delay
- The number of milliseconds to wait before trying again
attempt request count
- The number of requests sent in this attempt. This will only be set for client streaming and bidi RPCs.
attempt response count
- The number of responses received in this attempt. This will only be set for server streaming and bidi RPCs.
connection
- The UUID of the connection which the attempt was sent.
Attempts exhausted
with the following attributes:attempt
- Zero based sequential attempt number
status
- The status code of the failed attempt
attempt request count
- The number of requests sent in this attempt. This will only be set for client streaming and bidi RPCs.
attempt response count
- The number of responses received in this attempt. This will only be set for server streaming and bidi RPCs.
connection
- The UUID of the connection which the attempt was sent.
Attempt failed, error not retryable
with the following attributes:attempt
- Zero based sequential attempt number
status
- The status code of the failed attempt
attempt request count
- The number of requests sent in this attempt. This will only be set for client streaming and bidi RPCs.
attempt response count
- The number of responses received in this attempt. This will only be set for server streaming and bidi RPCs.
connection
- The UUID of the connection which the attempt was sent.
Attempt succeeded
with the following attributes:attempt
- Zero based sequential attempt number
attempt request count
- The number of requests sent in this attempt. This will only be set for client streaming and bidi RPCs.
attempt response count
- The number of responses received in this attempt. This will only be set for server streaming and bidi RPCs.
connection
- The UUID of the connection which the attempt was sent.
Long running operations, which are composed of an initial RPC to start the operation and a number of polling RPCs will be represented as a tree of spans. The top level span will be named after the initial RPC name suffixed with "Operation" and will have the following annotations:
Operation started
Operation failed to start
with the following attributes:status
- The status code of why the operation failed to start
Polling was cancelled
with the following attributes:attempt
- Zero based sequential poll number.
attempt request count
Scheduling next poll
with the following attributes:attempt
- Zero based sequential poll number
status
- OK if the poll succeeded, but the operation is still running.
delay
- The number of milliseconds to wait before polling again
Polling attempts exhausted
with the following attributes:attempt
- Zero based sequential poll number
status
- OK if the poll succeeded, but the operation is still running.
Polling failed
with the following attributes:attempt
- Zero based sequential poll number
status
- OK if the poll succeeded, but the operation is still running.
Polling completed
with the following attributes:attempt
- Zero based sequential poll number
The toplevel long running operation span will also contain child spans to describe the retry attempts for the initial RPC and each poll as described in the general span section above.
This class is thread compatible. It expects callers to follow grpc's threading model: there is only one thread that invokes the operation* and attempt* methods. Please see com.google.api.gax.rpc.ApiStreamObserver for more information.
OpencensusTracerFactory
A ApiTracerFactory to build instances of OpencensusTracer.
This class wraps the Tracer provided by Opencensus in Tracing.getTracer()
. It
will be used to create new spans and wrap them in OpencensusTracer defined in gax.
This class is thread safe.
SpanName
A value class to represent the name of the operation in an ApiTracer.
TracedBatchingCallable<RequestT,ResponseT>
This callable wraps a batching callable chain in a ApiTracer.
For internal use only.
TracedBidiCallable<RequestT,ResponseT>
A wrapper callable that will wrap a callable chain in a trace.
For internal use only.
TracedClientStreamingCallable<RequestT,ResponseT>
A wrapper callable that will wrap a callable chain in a trace.
This can be safely called from multiple threads. However the request ApiStreamObserver can only be used from a single thread.
For internal use only.
TracedOperationCallable<RequestT,ResponseT,MetadataT>
This callable wraps a OperationCallable in a ApiTracer.
For internal use only.
TracedOperationInitialCallable<RequestT>
Traces the initial RPC of a long running operation.
It will trace it like a child unary RPC and will also contribute to the parent tracer (created by TracedOperationCallable) the result of the call.
TracedServerStreamingCallable<RequestT,ResponseT>
A wrapper callable that will wrap a callable chain in a trace.
For internal use only.
TracedUnaryCallable<RequestT,ResponseT>
This callable wraps a callable chain in a ApiTracer.
For internal use only.
Interfaces
ApiTracer
Implementations of this class trace the logical flow of a google cloud client.
A single instance of a tracer represents a logical operation that can be annotated throughout its lifecycle. Constructing an instance of a subclass will implicitly signal the start of a new operation.
For internal use only. google-cloud-java libraries should extend BaseApiTracer.
ApiTracer.Scope
A context class to be used with #inScope() and a try-with-resources block. Closing a Scope removes any context that the underlying implementation might've set in #inScope().
ApiTracerFactory
A factory to create new instances of ApiTracers.
In general a single instance of an ApiTracer will correspond to a single logical operation.
For internal use only. google-cloud-java libraries should extend BaseApiTracerFactory.
Enums
ApiTracerFactory.OperationType
The type of operation the ApiTracer is tracing.