TracingContext
public class ThreadLocalTracingContext extends Object implements TracingContext
TracingContext
uses a non-static ThreadLocal
to store the current tracing stack, which will work
under ordinary circumstances to isolate spans associated with a single request from other concurrent requests. Using
a non-static ThreadLocal allows for the possibility of having multiple Tracer
instances working in the service at the same time, using the same threads, but working on different requests.Constructor | Description |
---|---|
ThreadLocalTracingContext() |
Modifier and Type | Method | Description |
---|---|---|
Deque<TracerSpan> |
get() |
Return the stack of spans in the current trace (for this service).
|
boolean |
isEmpty() |
Check whether the current Span stack if empty.
|
TracerSpan |
peekFirst() |
Grab the latest Span in the current stack without removing it.
|
TracerSpan |
peekLast() |
Grab the founding Span in the current stack without removing it.
|
TracerSpan |
pop() |
Pop the latest Span off the stack for the current service trace and return it.
|
void |
push(TracerSpan span) |
Add a new Span to the current service-scope of the trace.
|
int |
size() |
The size of the current span stack
|
public Deque<TracerSpan> get()
TracingContext
get
in interface TracingContext
Deque
of spans. Never null.public int size()
TracingContext
size
in interface TracingContext
public TracerSpan peekLast()
TracingContext
peekLast
in interface TracingContext
public TracerSpan peekFirst()
TracingContext
peekFirst
in interface TracingContext
public boolean isEmpty()
TracingContext
isEmpty
in interface TracingContext
public void push(TracerSpan span)
TracingContext
push
in interface TracingContext
span
- The span to addpublic TracerSpan pop()
TracingContext
pop
in interface TracingContext
Copyright © 2019–2020 Honeycomb. All rights reserved.