opencensus-java
opencensus-java copied to clipboard
Add ability to propagate Tracer object to TimeLimitedHandler externally instead of using singleton
Currently, a TimeLimitedHandler used for span exporting accesses to Tracer object instance using the singleton approach: private static final Tracer tracer = Tracing.getTracer();
If TraceComponent has created externally (not in Tracing class) there is no ability to propagate Tracer from that component to exporter that uses TimeLimited export approach (e.g. Zipkin).
This problem derives from https://github.com/census-instrumentation/opencensus-java/issues/1952
I think the Tracer object can be propagated to TimeLimitedHandler through constructor instead of a singleton. It gives more possibility to re-using existing span exporters code base without visible negative effects.