Big refactor of sleuth core API

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).
This commit is contained in:
Dave Syer
2015-09-09 15:00:12 +01:00
parent 8351c9ba2c
commit ffa97c1f20
58 changed files with 1005 additions and 917 deletions

View File

@@ -21,7 +21,7 @@ import java.util.Random;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Trace;
import org.springframework.cloud.sleuth.TraceManager;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component;
public class SampleBackground {
@Autowired
private Trace trace;
private TraceManager traceManager;
@SneakyThrows
@Async
@@ -40,7 +40,7 @@ public class SampleBackground {
final Random random = new Random();
int millis = random.nextInt(1000);
Thread.sleep(millis);
this.trace.addAnnotation("background-sleep-millis", String.valueOf(millis));
this.traceManager.addAnnotation("background-sleep-millis", String.valueOf(millis));
}
}