public interface BaseSpan<S extends BaseSpan>
BaseSpan
represents the OpenTracing specification's span contract with the exception of methods to finish
said span. For those, either use Span.finish()
or ActiveSpan.deactivate()
depending on the
programming model.Modifier and Type | Method and Description |
---|---|
SpanContext |
context()
Retrieve the associated SpanContext.
|
String |
getBaggageItem(String key) |
S |
log(long timestampMicroseconds,
Map<String,?> fields)
Like log(Map<String, Object>), but with an explicit timestamp.
|
S |
log(long timestampMicroseconds,
String event)
Record an event at a specific timestamp.
|
S |
log(long timestampMicroseconds,
String eventName,
Object payload)
Deprecated.
use
log(Map) like this
span.log(timestampMicroseconds, Map.of("event", "timeout"))
or
span.log(timestampMicroseconds, Map.of("event", "exception", "payload", stackTrace)) |
S |
log(Map<String,?> fields)
Log key:value pairs to the Span with the current walltime timestamp.
|
S |
log(String event)
Record an event at the current walltime timestamp.
|
S |
log(String eventName,
Object payload)
Deprecated.
use
log(Map) like this
span.log(Map.of("event", "timeout"))
or
span.log(timestampMicroseconds, Map.of("event", "exception", "payload", stackTrace)) |
S |
setBaggageItem(String key,
String value)
Sets a baggage item in the Span (and its SpanContext) as a key/value pair.
|
S |
setOperationName(String operationName)
Sets the string name for the logical operation this span represents.
|
S |
setTag(String key,
boolean value)
Same as
setTag(String, String) , but for boolean values. |
S |
setTag(String key,
Number value)
Same as
setTag(String, String) , but for numeric values. |
S |
setTag(String key,
String value)
Set a key:value tag on the Span.
|
SpanContext context()
S setTag(String key, boolean value)
setTag(String, String)
, but for boolean values.S setTag(String key, Number value)
setTag(String, String)
, but for numeric values.S log(Map<String,?> fields)
CAUTIONARY 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());
fields
- key:value log fields. Tracer implementations should support String, numeric, and boolean values;
some may also support arbitrary Objects.log(String)
S log(long timestampMicroseconds, Map<String,?> fields)
CAUTIONARY NOTE: not all Tracer implementations support key:value log fields end-to-end. Caveat emptor.
timestampMicroseconds
- 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.log(long, String)
S log(String event)
span.log(Collections.singletonMap("event", event));
event
- the event value; often a stable identifier for a moment in the Span lifecycleS log(long timestampMicroseconds, String event)
span.log(timestampMicroseconds, Collections.singletonMap("event", event));
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 lifecycleS setBaggageItem(String key, String value)
String getBaggageItem(String key)
S setOperationName(String operationName)
@Deprecated S log(String eventName, Object payload)
log(Map)
like this
span.log(Map.of("event", "timeout"))
or
span.log(timestampMicroseconds, Map.of("event", "exception", "payload", stackTrace))
@Deprecated S log(long timestampMicroseconds, String eventName, Object payload)
log(Map)
like this
span.log(timestampMicroseconds, Map.of("event", "timeout"))
or
span.log(timestampMicroseconds, Map.of("event", "exception", "payload", stackTrace))
Copyright © 2016–2017 OpenTracing. All rights reserved.