@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.
| Constructor and Description |
|---|
OpencensusTracerFactory()
Instantiates a new instance capturing the
Tracer in Tracing.getTracer. |
OpencensusTracerFactory(String clientNameOverride)
Instantiates a new instance capturing the
Tracer in Tracing.getTracer. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
hashCode() |
ApiTracer |
newRootTracer(SpanName spanName)
Create a new
ApiTracer that will ignore the current context and start a new toplevel
trace. |
ApiTracer |
newTracer(SpanName spanName)
Create a new
ApiTracer that will be a child of the current context. |
public OpencensusTracerFactory()
Tracer in Tracing.getTracer.public OpencensusTracerFactory(@Nullable String clientNameOverride)
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.clientNameOverride - the client name that will override all of the spans' client name.public ApiTracer newTracer(SpanName spanName)
ApiTracer that will be a child of the current context.newTracer in interface ApiTracerFactorypublic ApiTracer newRootTracer(SpanName spanName)
ApiTracerFactoryApiTracer that will ignore the current context and start a new toplevel
trace.newRootTracer in interface ApiTracerFactory