AutoCloseablepublic class TracerSpan extends Span
Tracer.
It overrides all methods of Span, and then simply delegates method invocations to the Span instance that it wraps.
The only added functionality is in close(), which is used to notify the Tracer of the TracerSpan being
closed prior to invoking close on the delegate Span. This ensures that the TracerSpan can detach itself from the
Tracer context and perform any necessary cleanup.
Tracer's javadoc for details.| Modifier and Type | Method | Description |
|---|---|---|
Span |
addField(String key,
Object value) |
Add a field to the Span.
|
Span |
addFields(Map<String,?> fieldsToAdd) |
Add a fields to the Span.
|
Span |
addTraceField(String key,
Object value) |
Add a trace field to the Span.
|
Span |
addTraceFields(Map<String,?> traceFieldsToAdd) |
Add trace fields to the Span.
|
void |
close() |
Closes this span in order to submit it as an
Event to Honeycomb and perform any necessary clean up in
the process. |
protected void |
closeInternal() |
Subclasses should override this to implement the mechanism
|
double |
elapsedTimeMs() |
|
String |
getDataset() |
|
Map<String,Object> |
getFields() |
|
String |
getParentSpanId() |
|
String |
getServiceName() |
|
String |
getSpanId() |
|
String |
getSpanName() |
|
long |
getStartTime() |
|
long |
getTimestamp() |
|
PropagationContext |
getTraceContext() |
|
Map<String,Object> |
getTraceFields() |
|
String |
getTraceId() |
|
boolean |
isNoop() |
|
Span |
markStart() |
Reset the Span's timer.
|
Span |
markStart(long timestamp,
long startTime) |
Sets the times with the specified values - useful when copying Spans.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetNoopInstancepublic Span addField(String key, Object value)
Spanpublic Span addFields(Map<String,?> fieldsToAdd)
Spanpublic Span addTraceField(String key, Object value)
SpanaddTraceField in class Spankey - of the field.value - of the field.public Span addTraceFields(Map<String,?> traceFieldsToAdd)
SpanaddTraceFields in class SpantraceFieldsToAdd - to add.public Span markStart()
SpanThe Span always starts the timer upon construction of the instance. However, if the operation covered by the Span starts later you can reset its timer with this (e.g. for async use cases).
public Span markStart(long timestamp, long startTime)
Spanpublic String getParentSpanId()
getParentSpanId in class Spanpublic String getTraceId()
getTraceId in class Spanpublic String getDataset()
getDataset in class Spanpublic String getSpanName()
getSpanName in class Spanpublic String getServiceName()
getServiceName in class Spanpublic Map<String,Object> getFields()
getFields in class SpanSpan.fieldspublic Map<String,Object> getTraceFields()
getTraceFields in class SpanSpan.traceFieldspublic PropagationContext getTraceContext()
getTraceContext in class Spanpublic double elapsedTimeMs()
elapsedTimeMs in class SpanSpan.markStart()public long getTimestamp()
getTimestamp in class SpanSpan.markStart()public long getStartTime()
getStartTime in class SpanSpan.markStart()public void close()
SpanEvent to Honeycomb and perform any necessary clean up in
the process. Overrides of Span.closeInternal() contain the logic to do this.
The Span's duration is measured upon calling this method (as per Span.elapsedTimeMs()).
In order to avoid clashes, because of multiple events with the same span_id being submitted, this method
ensures that it is only called once and ignores multiple invocations. However, it does not use any
synchronization to ensure this and is therefore not thread safe.
This uses method allows Span to be used with try-with-resources statements.
close in interface AutoCloseableclose in class Spanprotected void closeInternal()
SpancloseInternal in class SpanCopyright © 2019–2020 Honeycomb. All rights reserved.