Package org.opensearch.telemetry.tracing
Interface Span
- All Known Implementing Classes:
AbstractSpan,NoopSpan
@ExperimentalApi
public interface Span
An interface that represents a tracing span.
Spans are created by the Tracer.startSpan method.
Span must be ended by calling SpanScope.close which internally calls Span's endSpan.
- Opensearch.experimental:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, Boolean value) Adds boolean type attribute in the spanvoidaddAttribute(String key, Double value) Adds double type attribute in the spanvoidaddAttribute(String key, Long value) Adds long type attribute in the spanvoidaddAttribute(String key, String value) Adds string type attribute in the spanvoidAdds an event in the spanvoidendSpan()Ends the spanReturns span's parent spanReturns spanId of the spanReturns the name of theSpanReturns traceId of the spanvoidRecords error in the span
-
Method Details
-
endSpan
void endSpan()Ends the span -
getParentSpan
Span getParentSpan()Returns span's parent span -
getSpanName
String getSpanName()Returns the name of theSpan -
addAttribute
Adds string type attribute in the span- Parameters:
key- of the attributevalue- value of the attribute
-
addAttribute
Adds long type attribute in the span- Parameters:
key- of the attributevalue- value of the attribute
-
addAttribute
Adds double type attribute in the span- Parameters:
key- of the attributevalue- value of the attribute
-
addAttribute
Adds boolean type attribute in the span- Parameters:
key- of the attributevalue- value of the attribute
-
setError
Records error in the span- Parameters:
exception- exception to be recorded
-
addEvent
Adds an event in the span- Parameters:
event- name of the event
-
getTraceId
String getTraceId()Returns traceId of the span- Returns:
- span's traceId
-
getSpanId
String getSpanId()Returns spanId of the span- Returns:
- span's spanId
-