public interface Tracer
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Tracer.HeaderAccessor
A functional interface to access a header value.
|
static interface |
Tracer.HeaderMutator
A functional interface to set a header.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
SPAN_ID
The name of the header containing the span identifier.
|
static String |
TRACE_ID
The name of the header containing the trace identifier.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeCurrentSpan()
Finish the current span and restore the current span's parent as the current span
|
void |
closeSpan(SpanBuilder current)
Finish the supplied span and restore the supplied span's parent as the current span.
|
SpanBuilder |
createSpan()
Create a span which is a child of the current span.
|
<T> T |
executeCallable(String resource,
String operation,
Callable<T> callable)
Execute a Callable with reporting
|
void |
executeRunnable(String resource,
String operation,
Runnable runnable)
Execute a Runnable with reporting
|
SpanBuilder.SpanContext |
exportCurrentSpan()
Export a span across a thread.
|
void |
exportSpan(String resource,
String operation,
Tracer.HeaderMutator headerAccessor)
Export a span to another process using headers.
|
SpanBuilder |
getCurrentSpan()
Get the currently active span
|
SpanBuilder |
importCurrentSpan(SpanBuilder.SpanContext spanContext,
String resource,
String operation)
Import a span across a thread.
|
SpanBuilder |
importSpan(Tracer.HeaderAccessor headerAccessor)
Import a span across process boundaries using a set of headers.
|
static final String SPAN_ID
static final String TRACE_ID
<T> T executeCallable(String resource, String operation, Callable<T> callable)
T - The return type of the Callableresource - The resource being calledoperation - The operation being calledcallable - The Callable to invokevoid executeRunnable(String resource, String operation, Runnable runnable)
resource - The resource being calledoperation - The operation being calledrunnable - The runnable to invokeSpanBuilder getCurrentSpan()
SpanBuilder.SpanContext exportCurrentSpan()
SpanBuilder importCurrentSpan(SpanBuilder.SpanContext spanContext, String resource, String operation)
getCurrentSpan() must be called from the exporting Thread.
WARNING: Importing a thread will destroy the current threads stack of spans!spanContext - A SpanContext from exportCurrentSpan()resource - The resource for the new spanoperation - The operation for the new spanSpanBuilder importSpan(Tracer.HeaderAccessor headerAccessor)
headerAccessor - The function access to headers. Function supplied with header name and
should return the header value.void exportSpan(String resource, String operation, Tracer.HeaderMutator headerAccessor)
resource - The remote resource being invokedoperation - The remote operation being invokedheaderAccessor - The function access to headers. Function supplied with header name and
value.SpanBuilder createSpan()
void closeCurrentSpan()
void closeSpan(SpanBuilder current)
current - The currently active spanCopyright © 2017–2019. All rights reserved.