public static interface Tracer.SpanBuilder
Modifier and Type | Method and Description |
---|---|
Tracer.SpanBuilder |
addReference(String referenceType,
SpanContext referencedContext)
Add a reference from the Span being built to a distinct (usually parent) Span.
|
Tracer.SpanBuilder |
asChildOf(BaseSpan<?> parent)
A shorthand for addReference(References.CHILD_OF, parent.context()).
|
Tracer.SpanBuilder |
asChildOf(SpanContext parent)
A shorthand for addReference(References.CHILD_OF, parent).
|
Tracer.SpanBuilder |
ignoreActiveSpan()
Do not create an implicit
References.CHILD_OF reference to the ActiveSpanSource.activeSpan() ). |
Span |
start()
Deprecated.
use
startManual() or startActive() instead. |
ActiveSpan |
startActive()
Returns a newly started and activated
ActiveSpan . |
Span |
startManual()
|
Tracer.SpanBuilder |
withStartTimestamp(long microseconds)
Specify a timestamp of when the Span was started, represented in microseconds since epoch.
|
Tracer.SpanBuilder |
withTag(String key,
boolean value)
Same as
BaseSpan.setTag(String, boolean) , but for the span being built. |
Tracer.SpanBuilder |
withTag(String key,
Number value)
Same as
BaseSpan.setTag(String, Number) , but for the span being built. |
Tracer.SpanBuilder |
withTag(String key,
String value)
Same as
BaseSpan.setTag(String, String) , but for the span being built. |
Tracer.SpanBuilder asChildOf(SpanContext parent)
If parent==null, this is a noop.
Tracer.SpanBuilder asChildOf(BaseSpan<?> parent)
If parent==null, this is a noop.
Tracer.SpanBuilder addReference(String referenceType, SpanContext referencedContext)
If
Tracer
's ActiveSpanSource.activeSpan()
is not null, and
addReference(java.lang.String, io.opentracing.SpanContext)
, and
ignoreActiveSpan()
is not invoked,
References.CHILD_OF
reference is created to the
ActiveSpanSource.activeSpan()
SpanContext
when either startActive()
or
startManual()
is invoked.referenceType
- the reference type, typically one of the constants defined in ReferencesreferencedContext
- the SpanContext being referenced; e.g., for a References.CHILD_OF referenceType, the
referencedContext is the parent. If referencedContext==null, the call to
addReference(java.lang.String, io.opentracing.SpanContext)
is a noop.References
Tracer.SpanBuilder ignoreActiveSpan()
References.CHILD_OF
reference to the ActiveSpanSource.activeSpan()
).Tracer.SpanBuilder withTag(String key, String value)
BaseSpan.setTag(String, String)
, but for the span being built.Tracer.SpanBuilder withTag(String key, boolean value)
BaseSpan.setTag(String, boolean)
, but for the span being built.Tracer.SpanBuilder withTag(String key, Number value)
BaseSpan.setTag(String, Number)
, but for the span being built.Tracer.SpanBuilder withStartTimestamp(long microseconds)
ActiveSpan startActive()
ActiveSpan
.
The returned ActiveSpan
supports try-with-resources. For example:
try (ActiveSpan span = tracer.buildSpan("...").startActive()) {
// (Do work)
span.setTag( ... ); // etc, etc
} // Span finishes automatically unless deferred via ActiveSpan.capture()
If
Tracer
's ActiveSpanSource.activeSpan()
is not null, and
addReference(java.lang.String, io.opentracing.SpanContext)
, and
ignoreActiveSpan()
is not invoked,
References.CHILD_OF
reference is created to the
ActiveSpanSource.activeSpan()
's SpanContext
when either
startManual()
or startActive()
is invoked.
Note: startActive()
is a shorthand for
tracer.makeActive(spanBuilder.startManual())
.
ActiveSpan
, already registered via the ActiveSpanSource
ActiveSpanSource
,
ActiveSpan
Span startManual()
ActiveSpanSource
startActive()
@Deprecated Span start()
startManual()
or startActive()
instead.Copyright © 2016–2017 OpenTracing. All rights reserved.