How many instances of Tracer should I use with opencensus?

12 Views Asked by At

The documentation on the Tracer class gives some examples but does not provide recommendations on what is the desired lifecycle of a Tracer instance. It is possible to reuse the same instance for multiple traces. Should I practice that or should I create an new instance every time? Are there performance considerations or other caveats?

One reason to create a new instance could be setting a desired operation ID through SpanContext(trace_id=...) however the same can be achieved through

span.context_tracer.span_context.trace_id = my_trace_id

What is the best practice here?

0

There are 0 best solutions below