Package io.sentry
Class SentryTracer
java.lang.Object
io.sentry.SentryTracer
- All Implemented Interfaces:
ISpan
,ITransaction
-
Constructor Summary
ConstructorDescriptionSentryTracer
(@NotNull TransactionContext context, @NotNull IHub hub) SentryTracer
(@NotNull TransactionContext context, @NotNull IHub hub, boolean waitForChildren, @Nullable TransactionFinishedCallback transactionFinishedCallback) -
Method Summary
Modifier and TypeMethodDescriptionvoid
finish()
Sets span timestamp marking this span as finished.void
finish
(@Nullable SpanStatus status) Sets span timestamp marking this span as finished.void
finish
(@Nullable SpanStatus status, @Nullable Date finishDate) Sets span timestamp marking this span as finished.@NotNull Contexts
getData()
@Nullable Object
Returns extra data from span or transaction.@Nullable String
Returns the span description.@NotNull SentryId
Returns transaction's event id.@Nullable Double
@Nullable Span
Returns the latest span that is not finished.@NotNull String
getName()
Returns transaction name.@NotNull String
Returns the span operation.@Nullable TracesSamplingDecision
@NotNull SpanContext
Gets the span context.getSpans()
@NotNull Date
@Nullable SpanStatus
Returns the span status@Nullable String
@Nullable Throwable
Gets the throwable that was thrown during the execution of the span.@Nullable Double
@NotNull TransactionNameSource
Returns the source of the transaction name.boolean
Returns if span has finished.boolean
isNoOp()
Whether this span instance is a NOOP that doesn't collect information@Nullable Boolean
Returns if the profile of a transaction is sampled.@Nullable Boolean
Returns if transaction is sampled.void
Schedules when transaction should be automatically finished.void
setContext
(@NotNull String key, @NotNull Object context) void
Sets extra data on span or transaction.void
setDescription
(@Nullable String description) Sets span description.void
setMeasurement
(@NotNull String name, @NotNull Number value) Set a measurement without unit.void
setMeasurement
(@NotNull String name, @NotNull Number value, @NotNull MeasurementUnit unit) Set a measurement with specific unit.void
Sets transaction name.void
setName
(@NotNull String name, @NotNull TransactionNameSource transactionNameSource) void
setOperation
(@NotNull String operation) Sets span operation.void
setStatus
(@Nullable SpanStatus status) Sets span status.void
Sets the tag on span or transaction.void
setThrowable
(@Nullable Throwable throwable) Sets the throwable that was thrown during the execution of the span.@NotNull ISpan
startChild
(@NotNull String operation) Starts a child Span.@NotNull ISpan
startChild
(@NotNull String operation, @Nullable String description) Starts a child Span.@NotNull ISpan
startChild
(@NotNull String operation, @Nullable String description, @Nullable Date timestamp, @NotNull Instrumenter instrumenter) @Nullable BaggageHeader
toBaggageHeader
(@Nullable List<String> thirdPartyBaggageHeaders) Returns the baggage that can be sent as "baggage" header.@NotNull SentryTraceHeader
Returns the trace information that could be sent as a sentry-trace header.@Nullable TraceContext
Returns the trace context.
-
Constructor Details
-
SentryTracer
-
SentryTracer
public SentryTracer(@NotNull @NotNull TransactionContext context, @NotNull @NotNull IHub hub, boolean waitForChildren, @Nullable @Nullable TransactionFinishedCallback transactionFinishedCallback)
-
-
Method Details
-
scheduleFinish
public void scheduleFinish()Description copied from interface:ITransaction
Schedules when transaction should be automatically finished.- Specified by:
scheduleFinish
in interfaceITransaction
-
getChildren
-
getStartTimestamp
-
getTimestamp
-
startChild
Description copied from interface:ISpan
Starts a child Span.- Specified by:
startChild
in 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 Date timestamp, @NotNull @NotNull Instrumenter instrumenter) - Specified by:
startChild
in interfaceISpan
-
startChild
@NotNull public @NotNull ISpan startChild(@NotNull @NotNull String operation, @Nullable @Nullable String description) Description copied from interface:ISpan
Starts a child Span.- Specified by:
startChild
in interfaceISpan
- Parameters:
operation
- - new span operation namedescription
- - new span description name- Returns:
- a new transaction span
-
toSentryTrace
Description copied from interface:ISpan
Returns the trace information that could be sent as a sentry-trace header.- Specified by:
toSentryTrace
in interfaceISpan
- Returns:
- SentryTraceHeader.
-
finish
public void finish()Description copied from interface:ISpan
Sets span timestamp marking this span as finished. -
finish
Description copied from interface:ISpan
Sets span timestamp marking this span as finished. -
finish
@Internal public void finish(@Nullable @Nullable SpanStatus status, @Nullable @Nullable Date finishDate) Description copied from interface:ISpan
Sets span timestamp marking this span as finished. -
traceContext
Description copied from interface:ISpan
Returns the trace context.- Specified by:
traceContext
in interfaceISpan
- Returns:
- a trace context or
null
ifSentryOptions.isTraceSampling()
is disabled.
-
toBaggageHeader
@Nullable public @Nullable BaggageHeader toBaggageHeader(@Nullable @Nullable List<String> thirdPartyBaggageHeaders) Description copied from interface:ISpan
Returns the baggage that can be sent as "baggage" header.- Specified by:
toBaggageHeader
in interfaceISpan
- Returns:
- BaggageHeader or
null
ifSentryOptions.isTraceSampling()
is disabled.
-
setOperation
Description copied from interface:ISpan
Sets span operation.- Specified by:
setOperation
in interfaceISpan
- Parameters:
operation
- - the operation
-
getOperation
Description copied from interface:ISpan
Returns the span operation.- Specified by:
getOperation
in interfaceISpan
- Returns:
- the operation
-
setDescription
Description copied from interface:ISpan
Sets span description.- Specified by:
setDescription
in interfaceISpan
- Parameters:
description
- - the description.
-
getDescription
Description copied from interface:ISpan
Returns the span description.- Specified by:
getDescription
in interfaceISpan
- Returns:
- the description
-
setStatus
Description copied from interface:ISpan
Sets span status. -
getStatus
Description copied from interface:ISpan
Returns the span status -
setThrowable
Description copied from interface:ISpan
Sets the throwable that was thrown during the execution of the span.- Specified by:
setThrowable
in interfaceISpan
- Parameters:
throwable
- - the throwable.
-
getThrowable
Description copied from interface:ISpan
Gets the throwable that was thrown during the execution of the span.- Specified by:
getThrowable
in interfaceISpan
- Returns:
- throwable or
null
if none
-
getSpanContext
Description copied from interface:ISpan
Gets the span context.- Specified by:
getSpanContext
in interfaceISpan
- Returns:
- the span context
-
setTag
Description copied from interface:ISpan
Sets the tag on span or transaction. -
getTag
-
isFinished
public boolean isFinished()Description copied from interface:ISpan
Returns if span has finished.- Specified by:
isFinished
in interfaceISpan
- Returns:
- if span has finished.
-
setData
Description copied from interface:ISpan
Sets extra data on span or transaction. -
getData
Description copied from interface:ISpan
Returns extra data from span or transaction. -
setMeasurement
Description copied from interface:ISpan
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.
- Specified by:
setMeasurement
in 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:ISpan
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.
- Specified by:
setMeasurement
in interfaceISpan
- Parameters:
name
- the name of the measurementvalue
- the value of the measurementunit
- the unit the value is measured in
-
getData
-
isSampled
Description copied from interface:ITransaction
Returns if transaction is sampled.- Specified by:
isSampled
in interfaceITransaction
- Returns:
- is sampled
-
isProfileSampled
Description copied from interface:ITransaction
Returns if the profile of a transaction is sampled.- Specified by:
isProfileSampled
in interfaceITransaction
- Returns:
- profile is sampled
-
getSamplingDecision
- Specified by:
getSamplingDecision
in interfaceITransaction
-
setName
Description copied from interface:ITransaction
Sets transaction name.- Specified by:
setName
in interfaceITransaction
- Parameters:
name
- - transaction name
-
setName
@Internal public void setName(@NotNull @NotNull String name, @NotNull @NotNull TransactionNameSource transactionNameSource) - Specified by:
setName
in interfaceITransaction
-
getName
Description copied from interface:ITransaction
Returns transaction name.- Specified by:
getName
in interfaceITransaction
- Returns:
- transaction name
-
getTransactionNameSource
Description copied from interface:ITransaction
Returns the source of the transaction name.- Specified by:
getTransactionNameSource
in interfaceITransaction
- Returns:
- transaction name source
-
getSpans
- Specified by:
getSpans
in interfaceITransaction
-
getLatestActiveSpan
Description copied from interface:ITransaction
Returns the latest span that is not finished.- Specified by:
getLatestActiveSpan
in interfaceITransaction
- Returns:
- span or null if not found.
-
getEventId
Description copied from interface:ITransaction
Returns transaction's event id.- Specified by:
getEventId
in interfaceITransaction
- Returns:
- the event id
-
getHighPrecisionTimestamp
-
setContext
- Specified by:
setContext
in interfaceITransaction
-
getContexts
- Specified by:
getContexts
in interfaceITransaction
-
isNoOp
public boolean isNoOp()Description copied from interface:ISpan
Whether this span instance is a NOOP that doesn't collect information
-