-
public interface EmbraceSpanRepresents a Span that can be started and stopped with the appropriate ErrorCode if applicable. This wraps the OpenTelemetry Span by adding an additional layer for local validation
-
-
Method Summary
Modifier and Type Method Description Booleanstart()Start recording of the Span. abstract Booleanstart(Long startTimeMs)Start recording of the Span with the given start time. Booleanstop()Stop the recording of the Span to mark a successful completion of the underlying operation. Booleanstop(ErrorCode errorCode)Stop the recording of the Span with an ErrorCode, a non-null value indicating an unsuccessful completion of the underlying operation with the given reason. Booleanstop(Long endTimeMs)Stop the recording of the Span at the given time to mark the successful completion of the underlying operation. abstract Booleanstop(ErrorCode errorCode, Long endTimeMs)Stop the recording of the Span with an ErrorCode the the specific time, a non-null value indicating an unsuccessful completion of the underlying operation with the given reason. BooleanaddEvent(String name)Add an EmbraceSpanEvent with the given name at the current time. BooleanaddEvent(String name, Long timestampMs)Add an EmbraceSpanEvent with the given name and timestampMs. abstract BooleanaddEvent(String name, Long timestampMs, Map<String, String> attributes)Add an EmbraceSpanEvent with the given name. BooleanrecordException(Throwable exception)Record the given Throwable as a Span Event at the current time. abstract BooleanrecordException(Throwable exception, Map<String, String> attributes)Record the given Throwable as a Span Event at the current with the given set of Attributes. abstract BooleanaddAttribute(String key, String value)Add the given key-value pair as an Attribute to the Event. abstract BooleanupdateName(String newName)Update the name of the span. BooleanaddLink(EmbraceSpan linkedSpan)Add a link to the given EmbraceSpan BooleanaddLink(SpanContext linkedSpanContext)Add a link to the span with the given SpanContext BooleanaddLink(EmbraceSpan linkedSpan, Map<String, String> attributes)Add a link to the given EmbraceSpan with the given attributes abstract BooleanaddLink(SpanContext linkedSpanContext, Map<String, String> attributes)Add a link to the span with the given SpanContext with the given attributes abstract SpanContextgetSpanContext()The SpanContext for this EmbraceSpan instance. abstract StringgetTraceId()ID of the Trace that this Span belongs to. abstract StringgetSpanId()ID of the Span. abstract BooleangetIsRecording()Returns true if and only if this Span has been started and has not been stopped abstract EmbraceSpangetParent()The Span that is the parent of this Span. abstract AutoTerminationModegetAutoTerminationMode()The auto termination mode for this span -
-
Method Detail
-
start
Boolean start()
Start recording of the Span. Returns true if this call triggered the start of the recording. Returns false if the Span has already been started or has been stopped.
-
start
abstract Boolean start(Long startTimeMs)
Start recording of the Span with the given start time. Returns true if this call triggered the start of the recording. Returns false if the Span has already been started or has been stopped.
-
stop
Boolean stop()
Stop the recording of the Span to mark a successful completion of the underlying operation. Returns true if this call triggered the stopping of the recording. Returns false if the Span has not been started or if has already been stopped.
-
stop
Boolean stop(ErrorCode errorCode)
Stop the recording of the Span with an ErrorCode, a non-null value indicating an unsuccessful completion of the underlying operation with the given reason. Returns true if this call triggered the stopping of the recording. Returns false if the Span has not been started or if has already been stopped.
-
stop
Boolean stop(Long endTimeMs)
Stop the recording of the Span at the given time to mark the successful completion of the underlying operation. Returns true if this call triggered the stopping of the recording. Returns false if the Span has not been started or if has already been stopped.
-
stop
abstract Boolean stop(ErrorCode errorCode, Long endTimeMs)
Stop the recording of the Span with an ErrorCode the the specific time, a non-null value indicating an unsuccessful completion of the underlying operation with the given reason. Returns true if this call triggered the stopping of the recording. Returns false if the Span has not been started or if has already been stopped.
-
addEvent
Boolean addEvent(String name)
Add an EmbraceSpanEvent with the given name at the current time. Returns false if the Event was definitely not successfully added. Returns true if the validation at the Embrace level has passed and the call to add the Event at the OpenTelemetry level was successful.
-
addEvent
Boolean addEvent(String name, Long timestampMs)
Add an EmbraceSpanEvent with the given name and timestampMs. Optionally, a set of attributes associated with the event can be passed in. Returns false if the Event was definitely not successfully added. Returns true if the validation at the Embrace level has passed and the call to add the Event at the OpenTelemetry level was successful.
-
addEvent
abstract Boolean addEvent(String name, Long timestampMs, Map<String, String> attributes)
Add an EmbraceSpanEvent with the given name. If timestampMs is null, the current time will be used. Optionally, the specific time of the event and a set of attributes can be passed in associated with the event. Returns false if the Event was definitely not successfully added. Returns true if the validation at the Embrace level has passed and the call to add the Event at the OpenTelemetry level was successful.
-
recordException
Boolean recordException(Throwable exception)
Record the given Throwable as a Span Event at the current time. Returns false if event was definitely not recorded. Returns true if the validation at the Embrace level has passed and the call to add the Event at the OpenTelemetry level was successful.
-
recordException
abstract Boolean recordException(Throwable exception, Map<String, String> attributes)
Record the given Throwable as a Span Event at the current with the given set of Attributes. Returns false if event was definitely not recorded. Returns true if the validation at the Embrace level has passed and the call to add the Event at the OpenTelemetry level was successful.
-
addAttribute
abstract Boolean addAttribute(String key, String value)
Add the given key-value pair as an Attribute to the Event. Returns false if the Attribute was definitely not added. Returns true if the validation at the Embrace Level has passed and the call to add the Attribute at the OpenTelemetry level was successful.
-
updateName
abstract Boolean updateName(String newName)
Update the name of the span. Returns false if the update was not successful, like when it has already been stopped
-
addLink
Boolean addLink(EmbraceSpan linkedSpan)
Add a link to the given EmbraceSpan
-
addLink
Boolean addLink(SpanContext linkedSpanContext)
Add a link to the span with the given SpanContext
-
addLink
Boolean addLink(EmbraceSpan linkedSpan, Map<String, String> attributes)
Add a link to the given EmbraceSpan with the given attributes
-
addLink
abstract Boolean addLink(SpanContext linkedSpanContext, Map<String, String> attributes)
Add a link to the span with the given SpanContext with the given attributes
-
getSpanContext
abstract SpanContext getSpanContext()
The SpanContext for this EmbraceSpan instance. This is null if the span has not been started.
-
getTraceId
abstract String getTraceId()
ID of the Trace that this Span belongs to. The format adheres to the OpenTelemetry standard for Trace IDs
-
getSpanId
abstract String getSpanId()
ID of the Span. The format adheres to the OpenTelemetry standard for Span IDs
-
getIsRecording
abstract Boolean getIsRecording()
Returns true if and only if this Span has been started and has not been stopped
-
getParent
abstract EmbraceSpan getParent()
The Span that is the parent of this Span. If this is null, it means this Span is the root of the Trace.
-
getAutoTerminationMode
abstract AutoTerminationMode getAutoTerminationMode()
The auto termination mode for this span
-
-
-
-