@InternalApi(value="For google-cloud-java client use only") public final class OpencensusTracerFactory extends Object implements ApiTracerFactory
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.
ApiTracerFactory.OperationType| Constructor and Description |
|---|
OpencensusTracerFactory()
Instantiates a new instance capturing the
Tracer in Tracing.getTracer. |
OpencensusTracerFactory(Map<String,String> spanAttributes)
Instantiates a new instance capturing the
Tracer in Tracing.getTracer. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
hashCode() |
ApiTracer |
newTracer(ApiTracer parent,
SpanName spanName,
ApiTracerFactory.OperationType operationType)
Create a new
ApiTracer that will be a child of the current context. |
public OpencensusTracerFactory()
Tracer in Tracing.getTracer.public OpencensusTracerFactory(Map<String,String> spanAttributes)
Tracer in Tracing.getTracer. It will also override the service name of the grpc stub with a custom
client name. This is useful disambiguate spans created outer manual written wrappers and around
generated gapic spans.spanAttributes - the attributes to stamp on every span. Should include things like library
version.public ApiTracer newTracer(ApiTracer parent, SpanName spanName, ApiTracerFactory.OperationType operationType)
ApiTracer that will be a child of the current context.newTracer in interface ApiTracerFactoryparent - the parent of this tracerspanName - the name of the new spanoperationType - the type of operation that the tracer will trace