EmbraceSpan

public interface EmbraceSpan

Represents 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

Functions

Link copied to clipboard
public 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.

Link copied to clipboard
public 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.

public 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.

Link copied to clipboard
public 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.

Link copied to clipboard
public abstract String getSpanId()

ID of the Span. The format adheres to the OpenTelemetry standard for Span IDs

Link copied to clipboard
public abstract String getTraceId()

ID of the Trace that this Span belongs to. The format adheres to the OpenTelemetry standard for Trace IDs

Link copied to clipboard
public abstract Boolean isRecording()

Returns true if and only if this Span has been started and has not been stopped

Link copied to clipboard
public 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.

public 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.

Link copied to clipboard
public 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.

public 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.

public 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.

public 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.