Package io.sentry
Class Span
java.lang.Object
io.sentry.Span
- All Implemented Interfaces:
ISpan
-
Constructor Summary
ConstructorsConstructorDescriptionSpan(@NotNull TransactionContext context, @NotNull SentryTracer sentryTracer, @NotNull IHub hub, @Nullable SentryDate startTimestamp, @NotNull SpanOptions options) -
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) Used to finish unfinished spans bySentryTracer.getData()@Nullable ObjectReturns extra data from span or transaction.@Nullable StringReturns the span description.@Nullable SentryDateReturns the end date of this span or transaction.@NotNull LocalMetricsAggregatorReturns the metrics aggregator for this span.@NotNull Map<String,MeasurementValue> @NotNull StringReturns the span operation.@Nullable SpanId@Nullable TracesSamplingDecision@NotNull SpanContextGets the span context.@NotNull SpanId@NotNull SentryDateReturns the start date of this span or transaction.@Nullable SpanStatusReturns the span status@Nullable StringgetTags()@Nullable ThrowableGets the throwable that was thrown during the execution of the span.@NotNull SentryIdbooleanReturns if span has finished.booleanisNoOp()Whether this span instance is a NOOP that doesn't collect information@Nullable Boolean@Nullable BooleanvoidSets 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.
-
Constructor Details
-
Span
public Span(@NotNull @NotNull TransactionContext context, @NotNull @NotNull SentryTracer sentryTracer, @NotNull @NotNull IHub hub, @Nullable @Nullable SentryDate startTimestamp, @NotNull @NotNull SpanOptions options)
-
-
Method Details
-
getStartDate
Description copied from interface:ISpanReturns the start date of this span or transaction.- Specified by:
getStartDatein interfaceISpan- Returns:
- the start date
-
getFinishDate
Description copied from interface:ISpanReturns the end date of this span or transaction.- Specified by:
getFinishDatein interfaceISpan- Returns:
- the end date
-
startChild
Description copied from interface:ISpanStarts a child Span.- Specified by:
startChildin interfaceISpan- Parameters:
operation- - new span operation name- Returns:
- a new transaction span
-
startChild
@NotNull public @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description, @Nullable @Nullable SentryDate timestamp, @NotNull @NotNull Instrumenter instrumenter, @NotNull @NotNull SpanOptions spanOptions) - Specified by:
startChildin interfaceISpan
-
startChild
@NotNull public @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description) Description copied from interface:ISpanStarts a child Span.- Specified by:
startChildin interfaceISpan- Parameters:
operation- - new span operation namedescription- - new span description name- Returns:
- a new transaction span
-
startChild
@NotNull public @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description, @NotNull @NotNull SpanOptions spanOptions) - Specified by:
startChildin interfaceISpan
-
startChild
@NotNull public @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description, @Nullable @Nullable SentryDate timestamp, @NotNull @NotNull Instrumenter instrumenter) - Specified by:
startChildin interfaceISpan
-
toSentryTrace
Description copied from interface:ISpanReturns the trace information that could be sent as a sentry-trace header.- Specified by:
toSentryTracein interfaceISpan- Returns:
- SentryTraceHeader.
-
traceContext
Description copied from interface:ISpanReturns the trace context.- Specified by:
traceContextin interfaceISpan- Returns:
- a trace context or
nullifSentryOptions.isTraceSampling()is disabled.
-
toBaggageHeader
@Nullable public @Nullable BaggageHeader toBaggageHeader(@Nullable @Nullable List<String> thirdPartyBaggageHeaders) Description copied from interface:ISpanReturns the baggage that can be sent as "baggage" header.- Specified by:
toBaggageHeaderin interfaceISpan- Returns:
- BaggageHeader or
nullifSentryOptions.isTraceSampling()is disabled.
-
finish
public void finish()Description copied from interface:ISpanSets span timestamp marking this span as finished. -
finish
Description copied from interface:ISpanSets span timestamp marking this span as finished. -
finish
Used to finish unfinished spans bySentryTracer. -
setOperation
Description copied from interface:ISpanSets span operation.- Specified by:
setOperationin interfaceISpan- Parameters:
operation- - the operation
-
getOperation
Description copied from interface:ISpanReturns the span operation.- Specified by:
getOperationin interfaceISpan- Returns:
- the operation
-
setDescription
Description copied from interface:ISpanSets span description.- Specified by:
setDescriptionin interfaceISpan- Parameters:
description- - the description.
-
getDescription
Description copied from interface:ISpanReturns the span description.- Specified by:
getDescriptionin interfaceISpan- Returns:
- the description
-
setStatus
Description copied from interface:ISpanSets span status. -
getStatus
Description copied from interface:ISpanReturns the span status -
getSpanContext
Description copied from interface:ISpanGets the span context.- Specified by:
getSpanContextin interfaceISpan- Returns:
- the span context
-
setTag
Description copied from interface:ISpanSets the tag on span or transaction. -
getTag
-
isFinished
public boolean isFinished()Description copied from interface:ISpanReturns if span has finished.- Specified by:
isFinishedin interfaceISpan- Returns:
- if span has finished.
-
getData
-
isSampled
-
isProfileSampled
-
getSamplingDecision
-
setThrowable
Description copied from interface:ISpanSets the throwable that was thrown during the execution of the span.- Specified by:
setThrowablein interfaceISpan- Parameters:
throwable- - the throwable.
-
getThrowable
Description copied from interface:ISpanGets the throwable that was thrown during the execution of the span.- Specified by:
getThrowablein interfaceISpan- Returns:
- throwable or
nullif none
-
getTraceId
-
getSpanId
-
getParentSpanId
-
getTags
-
setData
Description copied from interface:ISpanSets extra data on span or transaction. -
getData
Description copied from interface:ISpanReturns extra data from span or transaction. -
setMeasurement
Description copied from interface:ISpanSet 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.
- Specified by:
setMeasurementin interfaceISpan- Parameters:
name- the name of the measurementvalue- the value of the measurement
-
setMeasurement
public void setMeasurement(@NotNull @NotNull String name, @NotNull @NotNull Number value, @NotNull @NotNull MeasurementUnit unit) Description copied from interface:ISpanSet a measurement with specific unit.NOTE: Setting a measurement with the same name on the same transaction multiple times only keeps the last value.
- Specified by:
setMeasurementin interfaceISpan- Parameters:
name- the name of the measurementvalue- the value of the measurementunit- the unit the value is measured in
-
getMeasurements
-
updateEndDate
Description copied from interface:ISpanUpdates the end date of the span. Note: This will only update the end date if the span is already finished.- Specified by:
updateEndDatein interfaceISpan- Parameters:
date- the end date to set- Returns:
- true if the end date was updated, false otherwise
-
isNoOp
public boolean isNoOp()Description copied from interface:ISpanWhether this span instance is a NOOP that doesn't collect information -
getLocalMetricsAggregator
Description copied from interface:ISpanReturns the metrics aggregator for this span.- Specified by:
getLocalMetricsAggregatorin interfaceISpan- Returns:
- the metrics aggregator
-