Class OpencensusTracerFactory (2.9.0)

public final class OpencensusTracerFactory extends BaseApiTracerFactory

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.

Inheritance

Object > BaseApiTracerFactory > OpencensusTracerFactory

Constructors

OpencensusTracerFactory()

public OpencensusTracerFactory()

Instantiates a new instance capturing the io.opencensus.trace.Tracer in Tracing.getTracer.

OpencensusTracerFactory(Map<String,String> spanAttributes)

public OpencensusTracerFactory(Map<String,String> spanAttributes)

Instantiates a new instance capturing the io.opencensus.trace.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.

Parameter
NameDescription
spanAttributesMap<String,String>

the attributes to stamp on every span. Should include things like library version.

Methods

equals(Object o)

public boolean equals(Object o)
Parameter
NameDescription
oObject
Returns
TypeDescription
boolean
Overrides

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

newTracer(ApiTracer parent, SpanName spanName, ApiTracerFactory.OperationType operationType)

public ApiTracer newTracer(ApiTracer parent, SpanName spanName, ApiTracerFactory.OperationType operationType)

Create a new ApiTracer that will be a child of the current context.

Parameters
NameDescription
parentApiTracer
spanNameSpanName
operationTypeApiTracerFactory.OperationType
Returns
TypeDescription
ApiTracer
Overrides