public class DefaultTracer extends Object implements Tracer
Tracer| Constructor and Description |
|---|
DefaultTracer(Sampler defaultSampler,
Random random,
SpanNamer spanNamer,
SpanLogger spanLogger,
SpanReporter spanReporter)
Deprecated.
|
DefaultTracer(Sampler defaultSampler,
Random random,
SpanNamer spanNamer,
SpanLogger spanLogger,
SpanReporter spanReporter,
boolean traceId128)
Deprecated.
|
DefaultTracer(Sampler defaultSampler,
Random random,
SpanNamer spanNamer,
SpanLogger spanLogger,
SpanReporter spanReporter,
boolean traceId128,
TraceKeys traceKeys) |
DefaultTracer(Sampler defaultSampler,
Random random,
SpanNamer spanNamer,
SpanLogger spanLogger,
SpanReporter spanReporter,
TraceKeys traceKeys) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTag(String key,
String value)
Adds a tag to the current span if tracing is currently on.
|
Span |
close(Span span)
Remove this span from the current thread, stop it and send it for collection.
|
Span |
continueSpan(Span span)
Contributes to a span started in another thread.
|
Span |
createSpan(String name)
Creates a new Span.
|
Span |
createSpan(String name,
Sampler sampler)
Start a new span if the sampler allows it or if we are already tracing in this
thread.
|
Span |
createSpan(String name,
Span parent)
Creates a new Span with a specific parent.
|
Span |
detach(Span span)
Remove this span from the current thread, but don't stop it yet or send it for
collection.
|
Span |
getCurrentSpan() |
boolean |
isTracing() |
<V> Callable<V> |
wrap(Callable<V> callable)
Wrap the callable in a TraceCallable, if tracing.
|
Runnable |
wrap(Runnable runnable)
Wrap the runnable in a TraceRunnable, if tracing.
|
@Deprecated public DefaultTracer(Sampler defaultSampler, Random random, SpanNamer spanNamer, SpanLogger spanLogger, SpanReporter spanReporter)
@Deprecated public DefaultTracer(Sampler defaultSampler, Random random, SpanNamer spanNamer, SpanLogger spanLogger, SpanReporter spanReporter, boolean traceId128)
public DefaultTracer(Sampler defaultSampler, Random random, SpanNamer spanNamer, SpanLogger spanLogger, SpanReporter spanReporter, TraceKeys traceKeys)
public DefaultTracer(Sampler defaultSampler, Random random, SpanNamer spanNamer, SpanLogger spanLogger, SpanReporter spanReporter, boolean traceId128, TraceKeys traceKeys)
public Span createSpan(String name, Span parent)
TracercreateSpan in interface Tracername - The name field for the new span to create.public Span createSpan(String name)
TracercreateSpan in interface Tracername - The name field for the new span to create.public Span createSpan(String name, Sampler sampler)
TracercreateSpan in interface Tracername - the name of the spansampler - a sampler to decide whether to create the span or notpublic Span detach(Span span)
TracerTracer.continueSpan(Span).
Example of usage:
// Span "A" was present in thread "X". Let's assume that we're in thread "Y" to which span "A" got passed
Span continuedSpan = tracer.continueSpan(spanA);
// Now span "A" got continued in thread "Y".
... // Some work is done... state of span "A" could get mutated
Span previouslyStoredSpan = tracer.detach(continuedSpan);
// Span "A" got removed from the thread Y but it wasn't yet sent for collection.
// Additional work can be done on span "A" in thread "X" and finally it can get closed and sent for collection
tracer.close(spanA);
public Span close(Span span)
Tracerpublic Span continueSpan(Span span)
TracercontinueSpan in interface Tracerpublic Span getCurrentSpan()
getCurrentSpan in interface SpanAccessorpublic boolean isTracing()
isTracing in interface SpanAccessorpublic void addTag(String key, String value)
Tracer
Every span may also have zero or more key/value Tags, which do not have
timestamps and simply annotate the spans.
Check TraceKeys for examples of most common tag keys
public <V> Callable<V> wrap(Callable<V> callable)
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.