Uh oh!
There was an error while loading. Please reload this page.
[improvement] Add AsyncTracer that tracks enqueued-time and run-time of a deferred action - #117
Conversation
carterkozak
commented
Mar 29, 2019
Why is it important that we can start a span, then complete it on multiple threads? tracing-java makes assumptions about threads that become foot-guns when applied to asynchronous usage. It might be time for a v2 API. |
ellisjoe
commented
Mar 29, 2019
Yeah, we're explicitly interested in tracing async things (eg: how long tasks spend in queues or waiting for their client side limiters) |
carterkozak
commented
Mar 29, 2019
Can we produce a new function for this case with fewer sharp edges? I'm worried about queueing multiple operations, and having them all complete copies of the same span. We need some way to enforce the concept of span ownership. |
robert3005
commented
Mar 29, 2019
carterkozak
commented
Mar 29, 2019
Yes, that was a bug and a foot-gun. Perhaps this behavior should live in a separate |
| private final Trace deferredTrace; | ||
| private final String operation; | ||
| @Nullable | ||
| private final String parentSpanId; |
There was a problem hiding this comment.
If we go with this approach it will require a serialVersionUID bump
| this.parentSpanId = null; | ||
| this.operation = null; | ||
| } | ||
| this.operation = operation.orElse(DEFAULT_OPERATION); |
There was a problem hiding this comment.
Forwarding @dfox's comment about the default operation name: #110 (comment)
carterkozak
commented
Mar 29, 2019
Rough notes on the detached span idea so I remember later: /* Does not modify thread state, the current span is used as detached spans parent * if it exists, otherwise a detached span is created with a new trace that has no * thread state. */DetachedSpandetached = Tracer.startDetachedSpan("operation")interfaceDetachedSpan {
/* Executes the Runnable with tracing state applied. */voidrun(Stringoperation, Runnablerunnable)
/* Executes the Callable with tracing state applied. */
<T> Tcall(Stringoperation, Callable<T> callable)
/* Complete this span */voidclose();
} |
442b77b to
81b71d7Comparecarterkozak
commented
Mar 29, 2019
Thanks @robert3005 👍 |
Uh oh!
There was an error while loading. Please reload this page.
| private final Trace deferredTrace; | ||
| private final String operation; | ||
| public AsyncTracer() { |
There was a problem hiding this comment.
Given that this is a new class, we should have made the operation required.
Before this PR
DeferredTracer only preserves traceid and last span id
After this PR
Add AsyncTracer that preserves full span stack of parent trace
cc @ellisjoe