public class SpanShim extends Object implements Span, SpanWrapper
| Modifier | Constructor and Description |
|---|---|
protected |
SpanShim(io.opentracing.Span span) |
| Modifier and Type | Method and Description |
|---|---|
SpanContext |
context()
Retrieve the associated SpanContext.
|
boolean |
equals(Object obj) |
void |
finish()
Sets the end timestamp to now and records the span.
|
void |
finish(long finishMicros)
Sets an explicit end timestamp and records the span.
|
String |
getBaggageItem(String key) |
SpanShim |
log(long timestampMicros,
Map<String,?> fields)
Like log(Map<String, Object>), but with an explicit timestamp.
|
SpanShim |
log(long timestampMicroseconds,
String event)
Record an event at a specific timestamp.
|
SpanShim |
log(Map<String,?> fields)
Log key:value pairs to the Span with the current walltime timestamp.
|
SpanShim |
log(String event)
Record an event at the current walltime timestamp.
|
SpanShim |
setBaggageItem(String key,
String value)
Sets a baggage item in the Span (and its SpanContext) as a key/value pair.
|
SpanShim |
setOperationName(String operationName)
Sets the string name for the logical operation this span represents.
|
SpanShim |
setTag(String key,
boolean value)
Same as
BaseSpan.setTag(String, String), but for boolean values. |
SpanShim |
setTag(String key,
Number value)
Same as
BaseSpan.setTag(String, String), but for numeric values. |
SpanShim |
setTag(String key,
String value)
Set a key:value tag on the Span.
|
io.opentracing.Span |
span() |
String |
toString() |
public io.opentracing.Span span()
span in interface SpanWrapperpublic void finish()
SpanWith the exception of calls to BaseSpan.context(), this should be the last call made to the span instance.
Future calls to Span.finish() are defined as noops, and future calls to methods other than BaseSpan.context()
lead to undefined behavior.
finish in interface SpanBaseSpan.context()public void finish(long finishMicros)
SpanWith the exception of calls to Span.context(), this should be the last call made to the span instance, and to do otherwise leads to undefined behavior.
finish in interface SpanfinishMicros - an explicit finish time, in microseconds since the epochBaseSpan.context()public SpanContext context()
BaseSpanpublic SpanShim setTag(String key, String value)
BaseSpanpublic SpanShim setTag(String key, boolean value)
BaseSpanBaseSpan.setTag(String, String), but for boolean values.public SpanShim setTag(String key, Number value)
BaseSpanBaseSpan.setTag(String, String), but for numeric values.public final SpanShim log(Map<String,?> fields)
BaseSpanCAUTIONARY NOTE: not all Tracer implementations support key:value log fields end-to-end. Caveat emptor.
A contrived example (using Guava, which is not required):
span.log(
ImmutableMap.Builder()
.put("event", "soft error")
.put("type", "cache timeout")
.put("waited.millis", 1500)
.build());
log in interface BaseSpan<Span>fields - key:value log fields. Tracer implementations should support String, numeric, and boolean values;
some may also support arbitrary Objects.BaseSpan.log(String)public final SpanShim log(long timestampMicros, Map<String,?> fields)
BaseSpanCAUTIONARY NOTE: not all Tracer implementations support key:value log fields end-to-end. Caveat emptor.
log in interface BaseSpan<Span>timestampMicros - The explicit timestamp for the log record. Must be greater than or equal to the
Span's start timestamp.fields - key:value log fields. Tracer implementations should support String, numeric, and boolean values;
some may also support arbitrary Objects.BaseSpan.log(long, String)public SpanShim log(String event)
BaseSpan
span.log(Collections.singletonMap("event", event));
public SpanShim log(long timestampMicroseconds, String event)
BaseSpan
span.log(timestampMicroseconds, Collections.singletonMap("event", event));
log in interface BaseSpan<Span>timestampMicroseconds - The explicit timestamp for the log record. Must be greater than or equal to the
Span's start timestamp.event - the event value; often a stable identifier for a moment in the Span lifecyclepublic SpanShim setBaggageItem(String key, String value)
BaseSpansetBaggageItem in interface BaseSpan<Span>public String getBaggageItem(String key)
getBaggageItem in interface BaseSpan<Span>public SpanShim setOperationName(String operationName)
BaseSpansetOperationName in interface BaseSpan<Span>Copyright © 2016–2018 OpenTracing. All rights reserved.