public class Tracer extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
Tracer.Builder |
| Modifier and Type | Field and Description |
|---|---|
static String |
SAMPLER_CLASSES_KEY |
static String |
SPAN_RECEIVER_CLASSES_KEY |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addSampler(Sampler sampler)
Add a new Sampler.
|
void |
close() |
static Tracer |
curThreadTracer() |
boolean |
equals(Object other)
Compare two tracer objects.
|
static Span |
getCurrentSpan() |
static SpanId |
getCurrentSpanId() |
Sampler[] |
getSamplers()
Returns an array of all the current Samplers.
|
String |
getTracerId() |
TracerPool |
getTracerPool() |
int |
hashCode()
Get the hash code of a Tracer object.
|
TraceScope |
newNullScope()
Return a null trace scope.
|
TraceScope |
newScope(String description)
Create a new trace scope.
|
TraceScope |
newScope(String description,
SpanId parentId)
Create a new trace scope.
|
TraceExecutorService |
newTraceExecutorService(ExecutorService impl) |
TraceExecutorService |
newTraceExecutorService(ExecutorService impl,
String scopeName) |
ScheduledTraceExecutorService |
newTraceExecutorService(ScheduledExecutorService impl) |
ScheduledTraceExecutorService |
newTraceExecutorService(ScheduledExecutorService impl,
String scopeName) |
boolean |
removeSampler(Sampler sampler)
Remove a Sampler.
|
String |
toString() |
<V> Callable<V> |
wrap(Callable<V> callable,
String description)
Wrap the callable in a TraceCallable, if tracing.
|
Runnable |
wrap(Runnable runnable,
String description)
Wrap the runnable in a TraceRunnable, if tracing
|
public static final String SPAN_RECEIVER_CLASSES_KEY
public static final String SAMPLER_CLASSES_KEY
public static Tracer curThreadTracer()
public String getTracerId()
public TraceScope newScope(String description, SpanId parentId)
description - The description of the new span to create.parentId - If this is a valid span ID, it will be added to
the parents of the new span we create.public TraceScope newScope(String description)
description - The description of the new span to create.public TraceScope newNullScope()
public <V> Callable<V> wrap(Callable<V> callable, String description)
V - The subclass of callable.callable - The callable to wrap.description - A description of the callable, or null if there
is no description.public Runnable wrap(Runnable runnable, String description)
runnable - The runnable to wrap.description - A description of the runnable, or null if there is
no description.public TraceExecutorService newTraceExecutorService(ExecutorService impl)
public TraceExecutorService newTraceExecutorService(ExecutorService impl, String scopeName)
public ScheduledTraceExecutorService newTraceExecutorService(ScheduledExecutorService impl)
public ScheduledTraceExecutorService newTraceExecutorService(ScheduledExecutorService impl, String scopeName)
public TracerPool getTracerPool()
public Sampler[] getSamplers()
public boolean addSampler(Sampler sampler)
sampler - The new sampler to add.
You cannot add a particular Sampler object more
than once. You may add multiple Sampler objects
of the same type, although this is not recommended.public boolean removeSampler(Sampler sampler)
sampler - The sampler to remove.public static Span getCurrentSpan()
public static SpanId getCurrentSpanId()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic int hashCode()
public boolean equals(Object other)
Copyright © 2016 The Apache Software Foundation. All Rights Reserved.