Class OpencensusTracerFactory (2.53.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
Name Description
spanAttributes Map<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
Name Description
o Object
Returns
Type Description
boolean
Overrides

hashCode()

public int hashCode()
Returns
Type Description
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
Name Description
parent ApiTracer
spanName SpanName
operationType ApiTracerFactory.OperationType
Returns
Type Description
ApiTracer
Overrides