Files
spring-cloud-sleuth/spring-cloud-sleuth-core/src
Marcin Grzejszczak 8c8c3e919b Continuing Spans (#461)
With this change we change the approach to continue spans (if they already exist) instead of starting new ones. The RPC spans would still be generated but Hystrix, Async, Callables / Runnables will reuse an existing span if there is one.

the scenarios are as follows:

Assuming that we have a trace X with span Y
* if you used tracer.wrap(Callable) or trace.wrap(Runnable) then:
  * previously you'd get a span Z created when the Callable / Runnable is executed
  * with this change you'll continue the span Y
* if you used a HystrixCommand then
  * previously you'd get a span Z together with added tags when the command got executed
  * with this change you'll continue the span Y and the tags will be added to span Y
* if you used a ExecutorService then
  * previously you'd get a span Z together with added tags when a method from ExecutorService got executed
  * with this change you'll continue the span Y and the tags will be added to span Y

Assuming that there was no span then everything will work as previously.

In order to create a new span you just have to create it manually. Example of creating a new span for an `@Async` annotated method.

```
// obviously you should inject via constructor ;)
@Autowired Tracer tracer;

@Async
public Future<String> foo() {
    Span span = tracer.createSpan("newSpan");
    try {
       // do your stuff
    } finally {
       this.tracer.close(span);
    }
}
```

fixes #174
2016-12-07 11:18:13 +01:00
..
2016-12-07 11:18:13 +01:00
2016-12-07 11:18:13 +01:00