The TraceManager.detach() method should be called by wrapper
tasks submitted to background threads. This change fixes it
in TraceCallable and TraceRunnable. Possibly still some work
to do for Hystrix.
The "detached" flag didn't seem to be doing anything, so I
removed it in the process.
Fixes gh-64, fixes gh-61
Instrumentation should be able to get by with only 2
interfaces: TraceManager and TraceAccessor (the former is
not needed if you aren't starting a new Span). No explicit
access to thread locals or manipulation of thread context
is required (except locally where necessary).
A Span is enclosed by a Trace (actually a view of the complete
Trace that would be constructed remotely).
We need @within (not @target) to capture method executions inside
annotated controllers. With @target all beans with methods returning
Callable get wrapped in case at runtime there is a target match.
KV annotations are just "annotations", and the "start" and "stop"
annotations in zipkin are "acquire" and "release" (since, in
particular the latter can in principle happen more than once
and not necessarily the last thing that happens to a span).
TODO: decide if TraceContextHolder is really holding a Span
or a TraceContext (or TraceScope). Maybe think of a better
name for TraceScope.
Span name is properly optional in Zipkin, but it makes the logs
in Sleuth a lot easier to read. Process ID is optional because it
is a Sleuth feature, but it seems useful.
This reverts commit b4d71727bf.
This might not be the ultimate solution but it should give us
something to look at and collect some data. It doesn't solve the
sampling problem, or the headers copying problem.
See gh-14