[azure exporter] Manual flushing of Tracer exporter
Willem-J-an opened this issue · 1 comments
Is your feature request related to a problem?
When running in specific contexts, e.g. databricks; the atexit flush is not reliable. It only flushes the spans around 60% of the time.
Describe the solution you'd like.
I would like to be able to manually flush the tracer exporter to ensure my spans are exported before letting my application exit.
Describe alternatives you've considered.
tracer.finish() - Will not block until flushing has occured
Retrieving active exporter threads and stopping them; thread.stop(timeout=x)
Calling private _stop method on the tracer.exporter
Additional context.
Discussed here
The way this currently works relies on the opencensus.common.schedule.Queue object and specifically the _gets method. Here's what I have found. The _gets is always operating in the worker thread. It only exits when either the count reaches the max_batch_size, export_interval time has elapsed, or a QueueEvent is queued. I tried flushing the queue with exporter._queue.flush()
. This inserts a SYNC queue event, but still does not interrupt the _gets for some reason. Will continue to explore options.