Skip to content

Instantly share code, notes, and snippets.

@marcingrzejszczak
Last active April 21, 2021 11:48
Show Gist options
  • Select an option

  • Save marcingrzejszczak/d3c15a0c11dda71970e42c513c9c0e09 to your computer and use it in GitHub Desktop.

Select an option

Save marcingrzejszczak/d3c15a0c11dda71970e42c513c9c0e09 to your computer and use it in GitHub Desktop.

Revisions

  1. marcingrzejszczak revised this gist Jan 11, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -384,6 +384,10 @@ _TraceFilter_
    - removed `addRequestTags`
    - removed `addResponseTags`

    ## Sleuth Stream

    This feature is completely removed. If you want to send spans via messaging use the zipkin client with kafka or rabbit dependency.

    ## Documentation

    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
  2. marcingrzejszczak revised this gist Jan 11, 2018. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -45,11 +45,11 @@ In order to hook in the span to current context you need to call the try-with-re
    ### Removed features

    - `SpanLogger`
    - Name pattern of Span Logger will not be applicable
    - 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: describe the new sampling mechanism in the documentation
    - `Metrics`
    - we delegate to `ReporterMetrics` from Zipkin
    - `SleuthProperties` props:
    - `supportsJoin` - will come from Brave

  3. marcingrzejszczak revised this gist Jan 10, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -132,6 +132,10 @@ After
    this.tracing.tracer().currentSpan().tag("foo", "bar");
    ```

    ### Baggage needs to be whitelisted

    In Sleuth we used to create headers that had the `baggage` prefix

    ## `ArayListSpanAccumulator` renamed to `ArrayListSpanReporter`

    Before
  4. marcingrzejszczak revised this gist Jan 10, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,6 @@

    ## TODO:

    - Zuul
    - Messaging
    - Baggage

    @@ -29,7 +28,8 @@ Discuss what do we do with the `TraceKeys` in callables / runnables
    - Spans via annotations
    - Web Clients
    - Reactive WebClient

    - Zuul

    # Migrations

    ## Core
  5. marcingrzejszczak revised this gist Jan 9, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,6 @@
    ## TODO:

    - Zuul
    - Web Clients
    - Reactive WebClient
    - Messaging
    - Baggage

    @@ -29,7 +27,9 @@ Discuss what do we do with the `TraceKeys` in callables / runnables
    - Scheduling
    - Hystrix
    - Spans via annotations

    - Web Clients
    - Reactive WebClient

    # Migrations

    ## Core
  6. marcingrzejszczak revised this gist Jan 9, 2018. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -2,22 +2,21 @@

    ## TODO:

    - Web Server
    - Async servlet
    - Reactive servlet
    - Zuul
    - Web Clients
    - Reactive WebClient
    - Messaging
    - Reactor
    - RxJava
    - Baggage

    Discuss what do we do with the `TraceKeys` in callables / runnables

    ## Done:

    - Web Server
    - Simple handler interceptor
    - Async servlet
    - Reactive servlet
    - Reactor
    - RxJava
    - Web Clients
    - RestTemplate
    - Feign
  7. marcingrzejszczak revised this gist Jan 8, 2018. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -370,6 +370,17 @@ There was a case in Sleuth where one passed the span id, the debug flag was set

    For the first span ever we don't set the all the response codes anymore. We're tagging status codes from 100-200 and 400+.

    ### No support for multiple value headers

    Brave doesn't support a list of values in the header. Since we delegate the header parsing to Brave we don't support those anymore either.

    ### Removed features

    _TraceFilter_

    - removed `addRequestTags`
    - removed `addResponseTags`

    ## Documentation

    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
  8. marcingrzejszczak revised this gist Jan 8, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -366,6 +366,10 @@ There was a case in Sleuth where one passed the trace id, the debug flag was set

    There was a case in Sleuth where one passed the span id, the debug flag was set to `1` and there was no trace id. In that case we continued the span. With Brave this is an exceptional situation and the debug flag will get ignored. The sampling decision will take place via the provided `Sampler`.

    ### No response code tags for parent span

    For the first span ever we don't set the all the response codes anymore. We're tagging status codes from 100-200 and 400+.

    ## Documentation

    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
  9. marcingrzejszczak revised this gist Jan 8, 2018. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -356,6 +356,16 @@ public SleuthHystrixConcurrencyStrategy(Tracing tracing,
    SpanNamer spanNamer, ErrorParser errorParser)
    ```

    ## Web Servers

    ### No span id == new trace

    There was a case in Sleuth where one passed the trace id, the debug flag was set to `1` and there was no span id. In that case we continued the span. With Brave, a new trace id will be created.

    ### No trace id == invalid span

    There was a case in Sleuth where one passed the span id, the debug flag was set to `1` and there was no trace id. In that case we continued the span. With Brave this is an exceptional situation and the debug flag will get ignored. The sampling decision will take place via the provided `Sampler`.

    ## Documentation

    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
  10. marcingrzejszczak revised this gist Jan 7, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -51,6 +51,8 @@ In order to hook in the span to current context you need to call the try-with-re
    - TODO: describe the new sampling mechanism
    - `Metric`
    - TODO: discuss what happens to `SpanMetricReporter` - is anybody actually using it?
    - `SleuthProperties` props:
    - `supportsJoin` - will come from Brave

    ### Sleuth's Tracer to brave.Tracing

  11. marcingrzejszczak revised this gist Jan 7, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,7 @@ Discuss what do we do with the `TraceKeys` in callables / runnables
    - @Async
    - Scheduling
    - Hystrix
    - Spans via annotations

    # Migrations

  12. marcingrzejszczak revised this gist Jan 7, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -8,8 +8,6 @@
    - Zuul
    - Web Clients
    - Reactive WebClient
    - Feign
    - Hystrix
    - Messaging
    - Reactor
    - RxJava
    @@ -22,13 +20,15 @@ Discuss what do we do with the `TraceKeys` in callables / runnables
    - Simple handler interceptor
    - Web Clients
    - RestTemplate
    - Feign
    - Slf4j
    - with Brave in place it will also work for any other implementation (e.g. log4j)
    - Async
    - Runnable / Callable
    - TraceExecutors etc.
    - @Async
    - Scheduling
    - Hystrix

    # Migrations

  13. marcingrzejszczak revised this gist Jan 7, 2018. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -334,6 +334,25 @@ When a request was sent via `RestTemplate` it will name the span with the method

    - `HttpTraceKeysInjector`

    ## Hystrix

    The `SleuthHystrixConcurrencyStrategy` will always creates a new span. Brave doesn't like continuing spans too much and it makes things more complex. `SleuthHystrixConcurrencyStrategy` will also not add any additional tags.

    ### Changed constructor of `SleuthHystrixConcurrencyStrategy`

    Before

    ```
    public SleuthHystrixConcurrencyStrategy(Tracing tracing, TraceKeys traceKeys)
    ```

    After

    ```
    public SleuthHystrixConcurrencyStrategy(Tracing tracing,
    SpanNamer spanNamer, ErrorParser errorParser)
    ```

    ## Documentation

    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
  14. marcingrzejszczak revised this gist Jan 6, 2018. 1 changed file with 46 additions and 17 deletions.
    63 changes: 46 additions & 17 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Notes
    # Notes

    ## TODO:

    @@ -15,7 +15,7 @@
    - RxJava

    Discuss what do we do with the `TraceKeys` in callables / runnables

    ## Done:

    - Web Server
    @@ -30,27 +30,27 @@ Discuss what do we do with the `TraceKeys` in callables / runnables
    - @Async
    - Scheduling

    ## Removed features

    - `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?

    # Migrations

    ## Core

    With Brave instrumentation there are 2 different lifecycles.
    With Brave instrumentation there are 2 different lifecycles.

    - Span creation and stopping and span reporting.
    - 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(); }`

    ### Removed features

    - `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?

    ### Sleuth's Tracer to brave.Tracing

    Before
    @@ -148,7 +148,7 @@ org.springframework.cloud.sleuth.util.ArrayListSpanReporter

    `org.springframework.cloud.brave.sampler.SamplerProperties#percentage` renamed to `org.springframework.cloud.brave.sampler.SamplerProperties#probability`

    and
    and

    `org.springframework.cloud.sleuth.sampler.PercentageBasedSampler` renamed to `org.springframework.cloud.sleuth.sampler.ProbabilityBasedSampler`

    @@ -198,7 +198,7 @@ After
    public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate) {
    //...
    }
    public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate, String spanName) {
    //...
    @@ -279,7 +279,6 @@ TODO: Double check that this is true ^^
    *Removed classes* :

    - `TraceAsyncClientHttpRequestFactoryWrapper` - replaced by simple interceptor `org.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptor`
    - `TraceAsyncRestTemplate` - replaced by simple interceptor `org.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptor`
    - `TraceRestTemplateInterceptor` - replaced by `brave.spring.web.TracingClientHttpRequestInterceptor`
    - `LocalComponentTraceCallable` - replaced by `TraceCallable`
    - `LocalComponentTraceRunnable` - replaced by `TraceRunnable`
    @@ -305,6 +304,36 @@ return new AsyncRestTemplate();
    }
    ```

    *Removed classes* :

    - `TraceAsyncRestTemplate` - replaced by simple interceptor `org.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptor`

    ### `RestTemplate` interceptors removed

    We will use those from Brave.

    Before

    ```
    org.springframework.cloud.sleuth.instrument.web.client.TraceRestTemplateInterceptor
    ```

    After

    ```
    brave.spring.web.TracingClientHttpRequestInterceptor
    ```

    ### Brave `RestTemplate` interceptor name and tag spans differently

    When a request was sent via `RestTemplate` it will name the span with the method name e.g. `GET`. If you want to have the previous way of naming spans and the default span tags you have turn on the `spring.sleuth.http.legacy.enabled=true` flag.

    ### Removed features

    *Removed classes* :

    - `HttpTraceKeysInjector`

    ## Documentation

    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
  15. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -69,6 +69,12 @@ import brave.Tracing;
    Tracing tracing;
    ```

    ### Brave's spans are not started by default

    In Sleuth whenever you've created a span it got attached to the current context and started. In Brave you have to manage both manually. When the span is created, it's not started. You need to explicitly call `start()` on the span to make it reportable to Zipkin. The tracing context will be passed but the span will not be sent to Zipkin if you don't start it.

    TODO: Double check this ^^

    ### Child span creation

    Before
    @@ -297,4 +303,8 @@ After
    AsyncRestTemplate myAsyncRestTemplate() {
    return new AsyncRestTemplate();
    }
    ```
    ```

    ## Documentation

    There is no longer `CR`, `CS`, `SS`, `SR` logs. We're using Zipkin v2. Now `span.kind` tells you how to interpret `span.timestamp`, `duration` and `remoteEndpoint`. Kind in `CLIENT` `SERVER` `PRODUCER` `CONSUMER`
  16. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -264,7 +264,13 @@ After
    org.springframework.cloud.sleuth.instrument.async.TraceAsyncListenableTaskExecutor
    ```

    ### Removed classes
    ### Removed features

    It seems that we have overengineered the async trace context passing. It seems that with the async template's interceptor with a wrapper around the `ListenableFutureCallback` we don't need to wrap the connection factories anymore.

    TODO: Double check that this is true ^^

    *Removed classes* :

    - `TraceAsyncClientHttpRequestFactoryWrapper` - replaced by simple interceptor `org.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptor`
    - `TraceAsyncRestTemplate` - replaced by simple interceptor `org.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptor`
  17. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 44 additions and 1 deletion.
    45 changes: 44 additions & 1 deletion sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -248,4 +248,47 @@ public TraceAsyncAspect(Tracing tracing, SpanNamer spanNamer, TraceKeys traceKey

    ### `TraceAsyncAspect` overrides the name of the current span

    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.
    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.

    ### `TraceAsyncListenableTaskExecutor` moved from `web.client` to `async` package

    Before

    ```
    org.springframework.cloud.sleuth.instrument.web.client.TraceAsyncListenableTaskExecutor
    ```

    After

    ```
    org.springframework.cloud.sleuth.instrument.async.TraceAsyncListenableTaskExecutor
    ```

    ### Removed classes

    - `TraceAsyncClientHttpRequestFactoryWrapper` - replaced by simple interceptor `org.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptor`
    - `TraceAsyncRestTemplate` - replaced by simple interceptor `org.springframework.cloud.brave.instrument.web.client.AsyncTracingClientHttpRequestInterceptor`
    - `TraceRestTemplateInterceptor` - replaced by `brave.spring.web.TracingClientHttpRequestInterceptor`
    - `LocalComponentTraceCallable` - replaced by `TraceCallable`
    - `LocalComponentTraceRunnable` - replaced by `TraceRunnable`
    - `SpanContinuingTraceCallable` - replaced by `TraceCallable`
    - `SpanContinuingTraceRunnable` - replaced by `TraceRunnable`

    ## Web clients (RestTemplate, WebClient, AsyncRestTemplate)

    ### `AsyncRestTemplate` no longer a bean

    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();
    }
    ```
  18. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -244,4 +244,8 @@ After
    public TraceAsyncAspect(Tracing tracing, SpanNamer spanNamer, TraceKeys traceKeys) {
    //
    }
    ```
    ```

    ### `TraceAsyncAspect` overrides the name of the current span

    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.
  19. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,6 @@
    - Messaging
    - Reactor
    - RxJava
    - Scheduling

    Discuss what do we do with the `TraceKeys` in callables / runnables

    @@ -29,6 +28,7 @@ Discuss what do we do with the `TraceKeys` in callables / runnables
    - Runnable / Callable
    - TraceExecutors etc.
    - @Async
    - Scheduling

    ## Removed features

  20. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@
    - RxJava
    - Scheduling

    Discuss what do we do with the `TraceKeys`
    Discuss what do we do with the `TraceKeys` in callables / runnables

    ## Done:

    @@ -241,7 +241,7 @@ Before
    After

    ```
    public TraceAsyncAspect(Tracing tracing, SpanNamer spanNamer) {
    public TraceAsyncAspect(Tracing tracing, SpanNamer spanNamer, TraceKeys traceKeys) {
    //
    }
    ```
  21. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 32 additions and 3 deletions.
    35 changes: 32 additions & 3 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -9,14 +9,13 @@
    - Web Clients
    - Reactive WebClient
    - Feign
    - Async
    - TraceExecutors etc.
    - @Async
    - Hystrix
    - Messaging
    - Reactor
    - RxJava
    - Scheduling

    Discuss what do we do with the `TraceKeys`

    ## Done:

    @@ -28,6 +27,8 @@
    - with Brave in place it will also work for any other implementation (e.g. log4j)
    - Async
    - Runnable / Callable
    - TraceExecutors etc.
    - @Async

    ## Removed features

    @@ -216,3 +217,31 @@ public TraceableScheduledExecutorService(BeanFactory beanFactory, final Executor
    super(beanFactory, delegate);
    }
    ```

    ### `TraceAsyncAspect` changed constructor

    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) {
    //
    }
    ```
  22. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 24 additions and 0 deletions.
    24 changes: 24 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -191,4 +191,28 @@ After
    public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate) {
    //...
    }
    public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate, String spanName) {
    //...
    }
    ```

    ### `TraceableScheduledExecutorService` changed constructor

    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);
    }
    ```
  23. marcingrzejszczak revised this gist Jan 4, 2018. 1 changed file with 57 additions and 17 deletions.
    74 changes: 57 additions & 17 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,17 @@

    # Migrations

    ## Sleuth's Tracer to brave.Tracing
    ## Core

    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(); }`

    ### Sleuth's Tracer to brave.Tracing

    Before

    @@ -58,7 +68,7 @@ import brave.Tracing;
    Tracing tracing;
    ```

    ## Child span creation
    ### Child span creation

    Before

    @@ -73,7 +83,7 @@ After
    brave.Span span = tracing.tracer().nextSpan().name("name");
    ```

    ## Span closing
    ### Span closing

    Before

    @@ -98,7 +108,7 @@ try {
    }
    ```

    ## Span tagging
    ### Span tagging

    Before

    @@ -113,42 +123,72 @@ After
    this.tracing.tracer().currentSpan().tag("foo", "bar");
    ```

    ## `TraceRunnable` and `TraceCallable` moved to `instrument.async`
    ## `ArayListSpanAccumulator` renamed to `ArrayListSpanReporter`

    Before

    ```
    org.springframework.cloud.sleuth.TraceRunnable
    org.springframework.cloud.sleuth.TraceCallable
    org.springframework.cloud.sleuth.util.ArrayListSpanAccumulator
    ```

    After

    ```
    org.springframework.cloud.sleuth.instrument.async.TraceRunnable
    org.springframework.cloud.sleuth.instrument.async.TraceCallable
    org.springframework.cloud.sleuth.util.ArrayListSpanReporter
    ```

    ## `ArayListSpanAccumulator` renamed to `ArrayListSpanReporter`
    ## Percentage -> Probability

    `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 https://github.com/spring-cloud/spring-cloud-sleuth/issues/397

    ## Async

    ### `TraceRunnable` and `TraceCallable` moved to `instrument.async`

    Before

    ```
    org.springframework.cloud.sleuth.util.ArrayListSpanAccumulator
    org.springframework.cloud.sleuth.TraceRunnable
    org.springframework.cloud.sleuth.TraceCallable
    ```

    After

    ```
    org.springframework.cloud.sleuth.util.ArrayListSpanReporter
    org.springframework.cloud.sleuth.instrument.async.TraceRunnable
    org.springframework.cloud.sleuth.instrument.async.TraceCallable
    ```

    ## Percentage -> Probability
    ### `TraceableExecutorService` has the constructor with `BeanFactory` remaining

    `org.springframework.cloud.brave.sampler.SamplerProperties#percentage` renamed to `org.springframework.cloud.brave.sampler.SamplerProperties#probability`
    Before

    and
    ```
    public TraceableExecutorService(final ExecutorService delegate, final Tracer tracer,
    TraceKeys traceKeys, SpanNamer spanNamer) {
    //...
    }
    `org.springframework.cloud.sleuth.sampler.PercentageBasedSampler` renamed to `org.springframework.cloud.sleuth.sampler.ProbabilityBasedSampler`
    public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate) {
    //...
    }
    Related to https://github.com/spring-cloud/spring-cloud-sleuth/issues/397
    public TraceableExecutorService(final ExecutorService delegate, final Tracer tracer,
    TraceKeys traceKeys, SpanNamer spanNamer, String spanName) {
    //...
    }
    ```

    After

    ```
    public TraceableExecutorService(BeanFactory beanFactory, final ExecutorService delegate) {
    //...
    }
    ```
  24. marcingrzejszczak revised this gist Jan 3, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,6 @@
    - Feign
    - Async
    - TraceExecutors etc.
    - Runnable / Callable
    - @Async
    - Hystrix
    - Messaging
    @@ -27,6 +26,8 @@
    - RestTemplate
    - Slf4j
    - with Brave in place it will also work for any other implementation (e.g. log4j)
    - Async
    - Runnable / Callable

    ## Removed features

  25. marcingrzejszczak revised this gist Jan 3, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -142,6 +142,12 @@ After
    org.springframework.cloud.sleuth.util.ArrayListSpanReporter
    ```

    ## `org.springframework.cloud.brave.sampler.SamplerProperties#percentage` renamed to `org.springframework.cloud.brave.sampler.SamplerProperties#probability`
    ## Percentage -> Probability

    `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 https://github.com/spring-cloud/spring-cloud-sleuth/issues/397
  26. marcingrzejszczak revised this gist Jan 3, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -141,3 +141,7 @@ After
    ```
    org.springframework.cloud.sleuth.util.ArrayListSpanReporter
    ```

    ## `org.springframework.cloud.brave.sampler.SamplerProperties#percentage` renamed to `org.springframework.cloud.brave.sampler.SamplerProperties#probability`

    Related to https://github.com/spring-cloud/spring-cloud-sleuth/issues/397
  27. marcingrzejszczak revised this gist Jan 3, 2018. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -127,3 +127,17 @@ After
    org.springframework.cloud.sleuth.instrument.async.TraceRunnable
    org.springframework.cloud.sleuth.instrument.async.TraceCallable
    ```

    ## `ArayListSpanAccumulator` renamed to `ArrayListSpanReporter`

    Before

    ```
    org.springframework.cloud.sleuth.util.ArrayListSpanAccumulator
    ```

    After

    ```
    org.springframework.cloud.sleuth.util.ArrayListSpanReporter
    ```
  28. marcingrzejszczak revised this gist Jan 3, 2018. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Notes

    ## TODO:

    - Web Server
    @@ -35,6 +37,8 @@
    - `Metric`
    - TODO: discuss what happens to `SpanMetricReporter` - is anybody actually using it?

    # Migrations

    ## Sleuth's Tracer to brave.Tracing

    Before
    @@ -107,3 +111,19 @@ After
    // tracing is brave.Tracing injected instead of Sleuth's Tracer
    this.tracing.tracer().currentSpan().tag("foo", "bar");
    ```

    ## `TraceRunnable` and `TraceCallable` moved to `instrument.async`

    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
    ```
  29. marcingrzejszczak revised this gist Jan 3, 2018. 1 changed file with 30 additions and 0 deletions.
    30 changes: 30 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,39 @@
    ## TODO:

    - Web Server
    - Async servlet
    - Reactive servlet
    - Zuul
    - Web Clients
    - Reactive WebClient
    - Feign
    - Async
    - TraceExecutors etc.
    - Runnable / Callable
    - @Async
    - Hystrix
    - Messaging
    - Reactor
    - RxJava
    - Scheduling

    ## Done:

    - Web Server
    - Simple handler interceptor
    - Web Clients
    - RestTemplate
    - Slf4j
    - with Brave in place it will also work for any other implementation (e.g. log4j)

    ## Removed features

    - `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?

    ## Sleuth's Tracer to brave.Tracing

  30. marcingrzejszczak created this gist Jan 3, 2018.
    79 changes: 79 additions & 0 deletions sleuth_brave.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,79 @@
    ## Removed features

    - `SpanLogger`
    - Name pattern of Span Logger will not be applicable
    - `Sampler`
    - TODO: describe the new sampling mechanism

    ## Sleuth's Tracer to brave.Tracing

    Before

    ```
    import org.springframework.cloud.sleuth.Tracer;
    Tracer tracer;
    ```

    After

    ```
    import brave.Tracing;
    Tracing tracing;
    ```

    ## Child span creation

    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");
    ```

    ## Span closing

    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();
    }
    ```

    ## Span tagging

    Before

    ```
    tracer.addTag("foo", "bar");
    ```

    After

    ```
    // tracing is brave.Tracing injected instead of Sleuth's Tracer
    this.tracing.tracer().currentSpan().tag("foo", "bar");
    ```