-
public interface TracingApiThe public API used to add traces to your application. Note that recordCompletedSpan can be used before the SDK is initialized. The actual trace won't be recorded until the SDK is started, but it's safe to use this prior to SDK initialization.
-
-
Method Summary
Modifier and Type Method Description EmbraceSpancreateSpan(String name, AutoTerminationMode autoTerminationMode)Create an EmbraceSpan with the given name that will be the root span of a new trace. abstract EmbraceSpancreateSpan(String name, EmbraceSpan parent, AutoTerminationMode autoTerminationMode)Create an EmbraceSpan with the given name and parent. EmbraceSpanstartSpan(String name, AutoTerminationMode autoTerminationMode)Create, start, and return a new EmbraceSpan with the given name that will be the root span of a new trace. EmbraceSpanstartSpan(String name, EmbraceSpan parent, AutoTerminationMode autoTerminationMode)Create, start, and return a new EmbraceSpan with the given name and parent. abstract EmbraceSpanstartSpan(String name, EmbraceSpan parent, Long startTimeMs, AutoTerminationMode autoTerminationMode)Create, start, and return a new EmbraceSpan with the given name, parent, and start time (epoch time in milliseconds). <T extends Any> TrecordSpan(String name, AutoTerminationMode autoTerminationMode, Function0<T> code)Execute the given block of code and record a new trace around it. <T extends Any> TrecordSpan(String name, EmbraceSpan parent, AutoTerminationMode autoTerminationMode, Function0<T> code)Execute the given block of code and record a new span around it with the given parent. <T extends Any> TrecordSpan(String name, Map<String, String> attributes, List<EmbraceSpanEvent> events, AutoTerminationMode autoTerminationMode, Function0<T> code)Execute the given block of code and record a new trace around it with optional attributes and list of EmbraceSpanEvent. abstract <T extends Any> TrecordSpan(String name, EmbraceSpan parent, Map<String, String> attributes, List<EmbraceSpanEvent> events, AutoTerminationMode autoTerminationMode, Function0<T> code)Execute the given block of code and record a new span around it with the given parent with optional attributes and list of EmbraceSpanEvent. BooleanrecordCompletedSpan(String name, Long startTimeMs, Long endTimeMs)Record a span with the given name, start time, and end time (epoch time in milliseconds). BooleanrecordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, ErrorCode errorCode)Record a span with the given name, error code, start time, and end time (epoch time in milliseconds). BooleanrecordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, EmbraceSpan parent)Record a span with the given name, parent, start time, and end time (epoch time in milliseconds). BooleanrecordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, ErrorCode errorCode, EmbraceSpan parent)Record a span with the given name, parent, error code, start time, and end time (epoch time in milliseconds). BooleanrecordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, Map<String, String> attributes, List<EmbraceSpanEvent> events)Record a span with the given name, start time, and end time (epoch time in milliseconds). abstract BooleanrecordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, ErrorCode errorCode, EmbraceSpan parent, Map<String, String> attributes, List<EmbraceSpanEvent> events)Record a span with the given name, error code, parent, start time, and end time (epoch time in milliseconds). abstract EmbraceSpangetSpan(String spanId)Return the EmbraceSpan corresponding to the given spanId if it is active or it has completed in the current session. -
-
Method Detail
-
createSpan
EmbraceSpan createSpan(String name, AutoTerminationMode autoTerminationMode)
Create an EmbraceSpan with the given name that will be the root span of a new trace. Returns null if the EmbraceSpan cannot be created given the current conditions of the SDK or an invalid name.
Note: the EmbraceSpan created will not be started. For a method that creates and starts the span, use startSpan
-
createSpan
abstract EmbraceSpan createSpan(String name, EmbraceSpan parent, AutoTerminationMode autoTerminationMode)
Create an EmbraceSpan with the given name and parent. Passing in a parent that is null result in a new trace with this EmbraceSpan as its root. Returns null if the EmbraceSpan cannot be created, e.g if the parent has not been started, the name is invalid, or some other factor due to the current conditions of the SDK.
Note: the EmbraceSpan created will not be started. For a method that creates and starts the span, use startSpan
-
startSpan
EmbraceSpan startSpan(String name, AutoTerminationMode autoTerminationMode)
Create, start, and return a new EmbraceSpan with the given name that will be the root span of a new trace. Returns null if the EmbraceSpan cannot be created or started.
-
startSpan
EmbraceSpan startSpan(String name, EmbraceSpan parent, AutoTerminationMode autoTerminationMode)
Create, start, and return a new EmbraceSpan with the given name and parent. Returns null if the EmbraceSpan cannot be created or started, like if the parent has been started.
-
startSpan
abstract EmbraceSpan startSpan(String name, EmbraceSpan parent, Long startTimeMs, AutoTerminationMode autoTerminationMode)
Create, start, and return a new EmbraceSpan with the given name, parent, and start time (epoch time in milliseconds). Returns null if the EmbraceSpan cannot be created or started, like if the parent has been started.
-
recordSpan
<T extends Any> T recordSpan(String name, AutoTerminationMode autoTerminationMode, Function0<T> code)
Execute the given block of code and record a new trace around it. If the span cannot be created, the block of code will still run and return correctly. If an exception or error is thrown inside the block, the span will end at the point of the throw and the Throwable will be rethrown.
-
recordSpan
<T extends Any> T recordSpan(String name, EmbraceSpan parent, AutoTerminationMode autoTerminationMode, Function0<T> code)
Execute the given block of code and record a new span around it with the given parent. Passing in a parent that is null will result in a new trace with the new span as its root. If the span cannot be created, the block of code will still run and return correctly. If an exception or error is thrown inside the block, the span will end at the point of the throw and the Throwable will be rethrown.
-
recordSpan
<T extends Any> T recordSpan(String name, Map<String, String> attributes, List<EmbraceSpanEvent> events, AutoTerminationMode autoTerminationMode, Function0<T> code)
Execute the given block of code and record a new trace around it with optional attributes and list of EmbraceSpanEvent. If the span cannot be created, the block of code will still run and return correctly. If an exception or error is thrown inside the block, the span will end at the point of the throw and the Throwable will be rethrown.
-
recordSpan
abstract <T extends Any> T recordSpan(String name, EmbraceSpan parent, Map<String, String> attributes, List<EmbraceSpanEvent> events, AutoTerminationMode autoTerminationMode, Function0<T> code)
Execute the given block of code and record a new span around it with the given parent with optional attributes and list of EmbraceSpanEvent. Passing in a parent that is null will result in a new trace with the new span as its root. If the span cannot be created, the block of code will still run and return correctly. If an exception or error is thrown inside the block, the span will end at the point of the throw and the Throwable will be rethrown.
-
recordCompletedSpan
Boolean recordCompletedSpan(String name, Long startTimeMs, Long endTimeMs)
Record a span with the given name, start time, and end time (epoch time in milliseconds). The created span will be the root span of a new trace.
-
recordCompletedSpan
Boolean recordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, ErrorCode errorCode)
Record a span with the given name, error code, start time, and end time (epoch time in milliseconds). The created span will be the root span of a new trace. A non-null ErrorCode can be passed in to denote the operation the span represents was ended unsuccessfully under the stated circumstances.
-
recordCompletedSpan
Boolean recordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, EmbraceSpan parent)
Record a span with the given name, parent, start time, and end time (epoch time in milliseconds). Passing in a parent that is null will result in a new trace with the new span as its root.
-
recordCompletedSpan
Boolean recordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, ErrorCode errorCode, EmbraceSpan parent)
Record a span with the given name, parent, error code, start time, and end time (epoch time in milliseconds). Passing in a parent that is null will result in a new trace with the new span as its root. A non-null ErrorCode can be passed in to denote the operation the span represents was ended unsuccessfully under the stated circumstances.
-
recordCompletedSpan
Boolean recordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, Map<String, String> attributes, List<EmbraceSpanEvent> events)
Record a span with the given name, start time, and end time (epoch time in milliseconds). The created span will be the root span of a new trace. You can also pass in a Map with String keys and values to be used as the attributes of the recorded span, or a List of EmbraceSpanEvent to be used as the events of the recorded span.
-
recordCompletedSpan
abstract Boolean recordCompletedSpan(String name, Long startTimeMs, Long endTimeMs, ErrorCode errorCode, EmbraceSpan parent, Map<String, String> attributes, List<EmbraceSpanEvent> events)
Record a span with the given name, error code, parent, start time, and end time (epoch time in milliseconds). Passing in a parent that is null will result in a new trace with the new span as its root. A non-null ErrorCode can be passed in to denote the operation the span represents was ended unsuccessfully under the stated circumstances. You can also pass in a Map with String keys and values to be used as the attributes of the recorded span, or a List of EmbraceSpanEvent to be used as the events of the recorded span.
-
getSpan
abstract EmbraceSpan getSpan(String spanId)
Return the EmbraceSpan corresponding to the given spanId if it is active or it has completed in the current session. Returns null if a span corresponding to the given spanId cannot be found, which can happen if this span never existed or if was completed in a prior session.
-
-
-
-