-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for "current span" formerly supported with thread binders
This implements a "current span" concept which represents the in-flight operation. `Tracer.currentSpan()` can be used to add custom tags to a span and `Tracer.nextSpan()` can be used to create a child of whatever is in-flight. The backend of this is `CurrentTraceContext` which can be extended to support SLF4J or Finagle synchronization. It also exposes concurrent wrappers for types like `ExecutorService`. Particularly, this includes the ability to get the "current span" and assign is to a scope. In most cases the implementation will be backed by thread locals, whether that's directly (as brave's former thread state was) or indirectly via a GRPC or Finagle Context. The (power) user apis are located in the Tracer api: * `Span currentSpan` - retrieves any span in scope or null * `Span nextSpan` - creates a new child or trace if there's no current span * `SpanInScope withSpanInScope(span)` - makes a span current and available to calls within the scope The SPI for this is called `CurrentTraceContext`, and it can be implemented to support MDC integration or alternate span storage * `TraceContext get()` - returns the current trace context or null * `Scope newScope(context)` - creates a scope where calls to get will return the input By default, `CurrentTraceContext` is implemented by a thread local, though there are tests to show it can be implemented by Finagle (or gRPC or otherwise).
- Loading branch information
Adrian Cole
committed
Apr 3, 2017
1 parent
9fe3c96
commit 06e2fe9
Showing
20 changed files
with
1,108 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.