Closed aybabtme closed 7 years ago
I'm happy to have a shot at this, btw. I'm opening this issue to see if there's interest.
fwiw Jaeger's tracer.Close()
method behaves exactly like that, it blocks until the memory buffer is flushed.
This is a duplicate of https://github.com/lightstep/lightstep-tracer-go/issues/82, plese comment there or on the associated PR if you'd like to review.
I'd like to have a method to tell the tracer "no more spans are coming, please try to send all the spans you have buffered". Something like
Flush
but that blocks until the reporting buffer is drained.The
FlushLightStepTracer
call sorts of does that, but it does not block and may leave unreported spans in memory. For instance, if I call it when a report is already in flight, the function will return immediately. This means I can't block on the background flush to finish. TheClose()
function on theRecorder
also does not drain the buffer queue.Maybe something like:
Here the
context.Context
is so that I can timeout waiting on the drain to finish.Use case
The use case for this is for short-lived commands to be able to try and emit their spans before
os.Exit
'ing.