Package io.sentry
Interface ISpan
- All Known Subinterfaces:
ITransaction
- All Known Implementing Classes:
NoOpSpan,NoOpTransaction,SentryTracer,Span
public interface ISpan
Represents performance monitoring Span.
-
Method Summary
Modifier and TypeMethodDescriptionvoidfinish()Sets span timestamp marking this span as finished.voidfinish(@Nullable SpanStatus status) Sets span timestamp marking this span as finished.voidfinish(@Nullable SpanStatus status, @Nullable SentryDate timestamp) Sets span timestamp marking this span as finished.@Nullable ObjectReturns extra data from span or transaction.@Nullable StringReturns the span description.@Nullable SentryDateReturns the end date of this span or transaction.@NotNull StringReturns the span operation.@NotNull SpanContextGets the span context.@NotNull SentryDateReturns the start date of this span or transaction.@Nullable SpanStatusReturns the span status@Nullable String@Nullable ThrowableGets the throwable that was thrown during the execution of the span.booleanReturns if span has finished.booleanisNoOp()Whether this span instance is a NOOP that doesn't collect informationvoidSets extra data on span or transaction.voidsetDescription(@Nullable String description) Sets span description.voidsetMeasurement(@NotNull String name, @NotNull Number value) Set a measurement without unit.voidsetMeasurement(@NotNull String name, @NotNull Number value, @NotNull MeasurementUnit unit) Set a measurement with specific unit.voidsetOperation(@NotNull String operation) Sets span operation.voidsetStatus(@Nullable SpanStatus status) Sets span status.voidSets the tag on span or transaction.voidsetThrowable(@Nullable Throwable throwable) Sets the throwable that was thrown during the execution of the span.@NotNull ISpanstartChild(@NotNull String operation) Starts a child Span.@NotNull ISpanstartChild(@NotNull String operation, @Nullable String description) Starts a child Span.@NotNull ISpanstartChild(@NotNull String operation, @Nullable String description, @NotNull SpanOptions spanOptions) @NotNull ISpanstartChild(@NotNull String operation, @Nullable String description, @Nullable SentryDate timestamp, @NotNull Instrumenter instrumenter) @NotNull ISpanstartChild(@NotNull String operation, @Nullable String description, @Nullable SentryDate timestamp, @NotNull Instrumenter instrumenter, @NotNull SpanOptions spanOptions) @Nullable BaggageHeadertoBaggageHeader(@Nullable List<String> thirdPartyBaggageHeaders) Returns the baggage that can be sent as "baggage" header.@NotNull SentryTraceHeaderReturns the trace information that could be sent as a sentry-trace header.@Nullable TraceContextReturns the trace context.booleanupdateEndDate(@NotNull SentryDate date) Updates the end date of the span.
-
Method Details
-
startChild
Starts a child Span.- Parameters:
operation- - new span operation name- Returns:
- a new transaction span
-
startChild
@Internal @NotNull @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description, @NotNull @NotNull SpanOptions spanOptions) -
startChild
@Internal @NotNull @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description, @Nullable @Nullable SentryDate timestamp, @NotNull @NotNull Instrumenter instrumenter) -
startChild
@Internal @NotNull @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description, @Nullable @Nullable SentryDate timestamp, @NotNull @NotNull Instrumenter instrumenter, @NotNull @NotNull SpanOptions spanOptions) -
startChild
@NotNull @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description) Starts a child Span.- Parameters:
operation- - new span operation namedescription- - new span description name- Returns:
- a new transaction span
-
toSentryTrace
Returns the trace information that could be sent as a sentry-trace header.- Returns:
- SentryTraceHeader.
-
traceContext
Returns the trace context.- Returns:
- a trace context or
nullifSentryOptions.isTraceSampling()is disabled.
-
toBaggageHeader
@Nullable @Experimental @Nullable BaggageHeader toBaggageHeader(@Nullable @Nullable List<String> thirdPartyBaggageHeaders) Returns the baggage that can be sent as "baggage" header.- Returns:
- BaggageHeader or
nullifSentryOptions.isTraceSampling()is disabled.
-
finish
void finish()Sets span timestamp marking this span as finished. -
finish
Sets span timestamp marking this span as finished.- Parameters:
status- - the status
-
finish
Sets span timestamp marking this span as finished.- Parameters:
status- - the statustimestamp- - the end timestamp
-
setOperation
Sets span operation.- Parameters:
operation- - the operation
-
getOperation
Returns the span operation.- Returns:
- the operation
-
setDescription
Sets span description.- Parameters:
description- - the description.
-
getDescription
Returns the span description.- Returns:
- the description
-
setStatus
Sets span status.- Parameters:
status- - the status.
-
getStatus
Returns the span status- Returns:
- the status
-
setThrowable
Sets the throwable that was thrown during the execution of the span.- Parameters:
throwable- - the throwable.
-
getThrowable
Gets the throwable that was thrown during the execution of the span.- Returns:
- throwable or
nullif none
-
getSpanContext
Gets the span context.- Returns:
- the span context
-
setTag
Sets the tag on span or transaction.- Parameters:
key- the tag keyvalue- the tag value
-
getTag
-
isFinished
boolean isFinished()Returns if span has finished.- Returns:
- if span has finished.
-
setData
Sets extra data on span or transaction.- Parameters:
key- the data keyvalue- the data value
-
getData
Returns extra data from span or transaction.- Returns:
- the data
-
setMeasurement
Set a measurement without unit. When setting the measurement without the unit, no formatting will be applied to the measurement value in the Sentry product, and the value will be shown as is.NOTE: Setting a measurement with the same name on the same transaction multiple times only keeps the last value.
- Parameters:
name- the name of the measurementvalue- the value of the measurement
-
setMeasurement
void setMeasurement(@NotNull @NotNull String name, @NotNull @NotNull Number value, @NotNull @NotNull MeasurementUnit unit) Set a measurement with specific unit.NOTE: Setting a measurement with the same name on the same transaction multiple times only keeps the last value.
- Parameters:
name- the name of the measurementvalue- the value of the measurementunit- the unit the value is measured in
-
updateEndDate
Updates the end date of the span. Note: This will only update the end date if the span is already finished.- Parameters:
date- the end date to set- Returns:
- true if the end date was updated, false otherwise
-
getStartDate
Returns the start date of this span or transaction.- Returns:
- the start date
-
getFinishDate
Returns the end date of this span or transaction.- Returns:
- the end date
-
isNoOp
@Internal boolean isNoOp()Whether this span instance is a NOOP that doesn't collect information- Returns:
- true if NOOP
-