- Web Server
- Async servlet
- Reactive servlet
- Zuul
- Web Clients
- Reactive WebClient
- Feign
- Hystrix
- Messaging
- Reactor
- RxJava
Discuss what do we do with the TraceKeys in callables / runnables
- Web Server
- Simple handler interceptor
- Web Clients
- RestTemplate
- Slf4j
- with Brave in place it will also work for any other implementation (e.g. log4j)
- Async
- Runnable / Callable
- TraceExecutors etc.
- @Async
- Scheduling
SpanLogger- Name pattern of Span Logger will not be applicable
Sampler- TODO: describe the new sampling mechanism
Metric- TODO: discuss what happens to
SpanMetricReporter- is anybody actually using it?
- TODO: discuss what happens to
With Brave instrumentation there are 2 different lifecycles.
- Span creation and stopping and span reporting.
- Span hooking to current context
When brave.Span.finish() is called the span gets stopped and reported.
In order to hook in the span to current context you need to call the try-with-resources clause via withSpanInScope try (Tracer.SpanInScope ws = this.tracing.tracer().withSpanInScope(this.span.start())) { // do sth with the span } finally { this.span.finish(); }
Before
import org.springframework.cloud.sleuth.Tracer;
Tracer tracer;
After
import brave.Tracing;
Tracing tracing;
Before
Span child = tracer.createSpan("name");
After
// tracing is brave.Tracing injected instead of Sleuth's Tracer
brave.Span span = tracing.tracer().nextSpan().name("name");
Before
Span child = tracer.createSpan("name");
try {
// do sth
} finally {
tracer.close(child);
}
After
// tracing is brave.Tracing injected instead of Sleuth's Tracer
brave.Span span = this.tracing.tracer().nextSpan().name("name");
try {
// do sth
} finally {
span.finish();
}
Before
tracer.addTag("foo", "bar");
After
// tracing is brave.Tracing injected instead of Sleuth's Tracer
this.tracing.tracer().currentSpan().tag("foo", "bar");
Before
org.springframework.cloud.sleuth.util.ArrayListSpanAccumulator
After
org.springframework.cloud.sleuth.util.ArrayListSpanReporter
org.springframework.cloud.brave.sampler.SamplerProperties#percentage renamed to org.springframework.cloud.brave.sampler.SamplerProperties#probability
and
org.springframework.cloud.sleuth.sampler.PercentageBasedSampler renamed to org.springframework.cloud.sleuth.sampler.ProbabilityBasedSampler
Related to spring-cloud/spring-cloud-sleuth#397
Before
org.springframework.cloud.sleuth.TraceRunnable
org.springframework.cloud.sleuth.TraceCallable
After
org.springframework.cloud.sleuth.instrument.async.TraceRunnable
org.springframework.cloud.sleuth.instrument.async.TraceCallable
Before
public TraceableExecutorService(final ExecutorService delegate, final Tracer tracer,
TraceKeys traceKeys, SpanNamer spanNamer) {
//...
}
public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate) {
//...
}
public TraceableExecutorService(final ExecutorService delegate, final Tracer tracer,
TraceKeys traceKeys, SpanNamer spanNamer, String spanName) {
//...
}
After
public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate) {
//...
}
public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate, String spanName) {
//...
}
Before
public TraceableScheduledExecutorService(ScheduledExecutorService delegate,
Tracer tracer, TraceKeys traceKeys, SpanNamer spanNamer) {
super(delegate, tracer, traceKeys, spanNamer);
}
After
public TraceableScheduledExecutorService(BeanFactory beanFactory, final ExecutorService delegate) {
super(beanFactory, delegate);
}
Before
@Deprecated
public TraceAsyncAspect(Tracer tracer, TraceKeys traceKeys, BeanFactory beanFactory) {
this.tracer = tracer;
this.traceKeys = traceKeys;
this.beanFactory = beanFactory;
}
public TraceAsyncAspect(Tracer tracer, TraceKeys traceKeys, SpanNamer spanNamer) {
this.tracer = tracer;
this.traceKeys = traceKeys;
this.spanNamer = spanNamer;
this.beanFactory = null;
}
After
public TraceAsyncAspect(Tracing tracing, SpanNamer spanNamer, TraceKeys traceKeys) {
//
}
In Sleuth we were able to rename the async span coming from a TraceRunnable. In Brave you can't access the span's name when it's in progress of being created. That's why we will always rename the span.
Before
org.springframework.cloud.sleuth.instrument.web.client.TraceAsyncListenableTaskExecutor
After
org.springframework.cloud.sleuth.instrument.async.TraceAsyncListenableTaskExecutor
TraceAsyncClientHttpRequestFactoryWrapper- replaced by simple interceptororg.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptorTraceAsyncRestTemplate- replaced by simple interceptororg.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptorTraceRestTemplateInterceptor- replaced bybrave.spring.web.TracingClientHttpRequestInterceptorLocalComponentTraceCallable- replaced byTraceCallableLocalComponentTraceRunnable- replaced byTraceRunnableSpanContinuingTraceCallable- replaced byTraceCallableSpanContinuingTraceRunnable- replaced byTraceRunnable
We've changed the way AsyncRestTemplate is instrumented. No longer do we instrument in a way that automatically registers a AsyncRestTemplate bean. That's why you need to provide your own bean.
Before
no AsyncRestTemplate bean was required
After
@Bean
AsyncRestTemplate myAsyncRestTemplate() {
return new AsyncRestTemplate();
}