True if there is an identifier for the current trace.
Get the current trace identifier.
Get the current trace identifier. If no identifiers have been pushed, a default one is provided.
Return true if tracing is enabled with a good tracer pushed and at least one tracer decides to actively trace the current id.
Return true if the current trace id is terminal.
Create a derived id from the current TraceId.
Record a raw Record.
Record a raw Record. This will record to a _unique_ set of tracers in the stack.
This is a tracing system similar to Dapper:
“Dapper, a Large-Scale Distributed Systems Tracing Infrastructure”, Benjamin H. Sigelman, Luiz André Barroso, Mike Burrows, Pat Stephenson, Manoj Plakal, Donald Beaver, Saul Jaspan, Chandan Shanbhag, 2010.
It is meant to be independent of whatever underlying RPC mechanism is being used, and it is up to the underlying codec to implement the transport.
Trace
(a singleton object) maintains the state of the tracing stack stored in com.twitter.finagle.context.Contexts. The current TraceId has aterminal
flag, indicating whether it can be overridden with a different TraceId. Setting the current TraceId as terminal forces all future annotation to share that TraceId. When reporting, we report to all tracers in the list ofTracer
s.The Tracing API is structured in a way it's caller's responsibility to check if the current stack of tracers is actively tracing (
Trace.isActivelyTracing
) to avoid unnecessarily allocations.It's recommended to "capture" a Tracing instance while performing multiple tracing operations to minimize the number of com.twitter.finagle.context.Contexts lookups and increase throughput.
Use
Trace.getInstance()
andTrace.newInstance()
in Java.