Package io.sentry
Class Scope
java.lang.Object
io.sentry.Scope
- All Implemented Interfaces:
IScope
Scope data to be sent with the event
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacethe IWithPropagationContext callbackstatic interfaceThe IWithTransaction callback -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttachment(@NotNull Attachment attachment) Adds an attachment to the Scope's list of attachments.voidaddBreadcrumb(@NotNull Breadcrumb breadcrumb) Adds a breadcrumb to the breadcrumbs queue It also executes the BeforeBreadcrumb callback if setvoidaddBreadcrumb(@NotNull Breadcrumb breadcrumb, @Nullable Hint hint) Adds a breadcrumb to the breadcrumbs queue.voidaddEventProcessor(@NotNull EventProcessor eventProcessor) Adds an event processor to the Scope's event processors listvoidclear()Resets the Scope to its default statevoidClear all attachments.voidClear all the breadcrumbsvoidvoidClears the transaction.@NotNull IScopeclone()Clones the Scope@Nullable SessionEnds a session, unbinds it from the scope and returns it.@NotNull List<Attachment>Returns the Scopes's attachments@NotNull Queue<Breadcrumb>Returns the Scope's breadcrumbs queue@NotNull ContextsReturns the Scope's contexts@NotNull List<EventProcessor>Returns the Scope's event processorsReturns the Scope's extra mapReturns the Scope's fingerprint list@Nullable SentryLevelgetLevel()Returns the Scope's SentryLevel@NotNull SentryOptions@NotNull PropagationContext@NotNull SentryIdReturns the Scope's current replay_id, previously set byIScope.setReplayId(SentryId)@Nullable RequestReturns the Scope's request@Nullable StringReturns the Scope's current screen, previously set byIScope.setScreen(String)@Nullable Session@Nullable ISpangetSpan()Returns current active Span or Transaction.getTags()Returns the Scope's tags@Nullable ITransactionReturns active transaction or null if there is no active transaction.@Nullable StringReturns the Scope's transaction name.@Nullable UsergetUser()Returns the Scope's uservoidremoveContexts(@NotNull String key) Removes a value from the Scope's contextsvoidremoveExtra(@NotNull String key) Removes an extra from the Scope's extrasvoidRemoves a tag from the Scope's tagsvoidsetContexts(@NotNull String key, @NotNull Boolean value) Sets the Scope's contextsvoidsetContexts(@NotNull String key, @NotNull Character value) Sets the Scope's contextsvoidsetContexts(@NotNull String key, @NotNull Number value) Sets the Scope's contextsvoidsetContexts(@NotNull String key, @NotNull Object value) Sets the Scope's contextsvoidsetContexts(@NotNull String key, @NotNull Object[] value) Sets the Scope's contextsvoidsetContexts(@NotNull String key, @NotNull String value) Sets the Scope's contextsvoidsetContexts(@NotNull String key, @NotNull Collection<?> value) Sets the Scope's contextsvoidSets an extra to the Scope's extra mapvoidsetFingerprint(@NotNull List<String> fingerprint) Sets the Scope's fingerprint listvoidsetLevel(@Nullable SentryLevel level) Sets the Scope's SentryLevel Level from scope exceptionally take precedence over the eventvoidsetPropagationContext(@NotNull PropagationContext propagationContext) voidsetReplayId(@NotNull SentryId replayId) Sets the Scope's current replay_idvoidsetRequest(@Nullable Request request) Sets the Scope's requestvoidSets the Scope's current screenvoidSets a tag to Scope's tagsvoidsetTransaction(@NotNull String transaction) Sets the Scope's transaction.voidsetTransaction(@Nullable ITransaction transaction) Sets the current active transactionvoidSets the Scope's user@Nullable io.sentry.Scope.SessionPairReturns a previous session (now closed) bound to this scope together with the newly created one@NotNull PropagationContextwithPropagationContext(@NotNull Scope.IWithPropagationContext callback) @Nullable SessionwithSession(@NotNull io.sentry.Scope.IWithSession sessionCallback) Callback to do atomic operations on sessionvoidwithTransaction(@NotNull Scope.IWithTransaction callback) Mutates the current transaction atomically
-
Constructor Details
-
Scope
Scope's ctor- Parameters:
options- the options
-
-
Method Details
-
getLevel
Returns the Scope's SentryLevel -
setLevel
Sets the Scope's SentryLevel Level from scope exceptionally take precedence over the event -
getTransactionName
Returns the Scope's transaction name.- Specified by:
getTransactionNamein interfaceIScope- Returns:
- the transaction
-
setTransaction
Sets the Scope's transaction.- Specified by:
setTransactionin interfaceIScope- Parameters:
transaction- the transaction
-
getSpan
Returns current active Span or Transaction. -
setTransaction
Sets the current active transaction- Specified by:
setTransactionin interfaceIScope- Parameters:
transaction- the transaction
-
getUser
Returns the Scope's user -
setUser
Sets the Scope's user -
getScreen
Returns the Scope's current screen, previously set byIScope.setScreen(String) -
setScreen
Sets the Scope's current screen -
getReplayId
Description copied from interface:IScopeReturns the Scope's current replay_id, previously set byIScope.setReplayId(SentryId)- Specified by:
getReplayIdin interfaceIScope- Returns:
- the id of the current session replay
-
setReplayId
Description copied from interface:IScopeSets the Scope's current replay_id- Specified by:
setReplayIdin interfaceIScope- Parameters:
replayId- the id of the current session replay
-
getRequest
Returns the Scope's request- Specified by:
getRequestin interfaceIScope- Returns:
- the request
-
setRequest
Sets the Scope's request- Specified by:
setRequestin interfaceIScope- Parameters:
request- the request
-
getFingerprint
Returns the Scope's fingerprint list- Specified by:
getFingerprintin interfaceIScope- Returns:
- the fingerprint list
-
setFingerprint
Sets the Scope's fingerprint list- Specified by:
setFingerprintin interfaceIScope- Parameters:
fingerprint- the fingerprint list
-
getBreadcrumbs
Returns the Scope's breadcrumbs queue- Specified by:
getBreadcrumbsin interfaceIScope- Returns:
- the breadcrumbs queue
-
addBreadcrumb
Adds a breadcrumb to the breadcrumbs queue. It also executes the BeforeBreadcrumb callback if set- Specified by:
addBreadcrumbin interfaceIScope- Parameters:
breadcrumb- the breadcrumbhint- the hint
-
addBreadcrumb
Adds a breadcrumb to the breadcrumbs queue It also executes the BeforeBreadcrumb callback if set- Specified by:
addBreadcrumbin interfaceIScope- Parameters:
breadcrumb- the breadcrumb
-
clearBreadcrumbs
public void clearBreadcrumbs()Clear all the breadcrumbs- Specified by:
clearBreadcrumbsin interfaceIScope
-
clearTransaction
public void clearTransaction()Clears the transaction.- Specified by:
clearTransactionin interfaceIScope
-
getTransaction
Returns active transaction or null if there is no active transaction.- Specified by:
getTransactionin interfaceIScope- Returns:
- the transaction
-
clear
public void clear()Resets the Scope to its default state -
getTags
Returns the Scope's tags -
setTag
Sets a tag to Scope's tags -
removeTag
Removes a tag from the Scope's tags -
getExtras
Returns the Scope's extra map -
setExtra
Sets an extra to the Scope's extra map -
removeExtra
Removes an extra from the Scope's extras- Specified by:
removeExtrain interfaceIScope- Parameters:
key- the key
-
getContexts
Returns the Scope's contexts- Specified by:
getContextsin interfaceIScope- Returns:
- the contexts
-
setContexts
Sets the Scope's contexts- Specified by:
setContextsin interfaceIScope- Parameters:
key- the context keyvalue- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContextsin interfaceIScope- Parameters:
key- the context keyvalue- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContextsin interfaceIScope- Parameters:
key- the context keyvalue- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContextsin interfaceIScope- Parameters:
key- the context keyvalue- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContextsin interfaceIScope- Parameters:
key- the context keyvalue- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContextsin interfaceIScope- Parameters:
key- the context keyvalue- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContextsin interfaceIScope- Parameters:
key- the context keyvalue- the context value
-
removeContexts
Removes a value from the Scope's contexts- Specified by:
removeContextsin interfaceIScope- Parameters:
key- the Key
-
getAttachments
Returns the Scopes's attachments- Specified by:
getAttachmentsin interfaceIScope- Returns:
- the attachments
-
addAttachment
Adds an attachment to the Scope's list of attachments. The SDK adds the attachment to every event and transaction sent to Sentry.- Specified by:
addAttachmentin interfaceIScope- Parameters:
attachment- The attachment to add to the Scope's list of attachments.
-
clearAttachments
public void clearAttachments()Clear all attachments.- Specified by:
clearAttachmentsin interfaceIScope
-
getEventProcessors
Returns the Scope's event processors- Specified by:
getEventProcessorsin interfaceIScope- Returns:
- the event processors list
-
addEventProcessor
Adds an event processor to the Scope's event processors list- Specified by:
addEventProcessorin interfaceIScope- Parameters:
eventProcessor- the event processor
-
withSession
@Internal @Nullable public @Nullable Session withSession(@NotNull @NotNull io.sentry.Scope.IWithSession sessionCallback) Callback to do atomic operations on session- Specified by:
withSessionin interfaceIScope- Parameters:
sessionCallback- the IWithSession callback- Returns:
- a clone of the Session after executing the callback and mutating the session
-
startSession
@Internal @Nullable public @Nullable io.sentry.Scope.SessionPair startSession()Returns a previous session (now closed) bound to this scope together with the newly created one- Specified by:
startSessionin interfaceIScope- Returns:
- the SessionPair with the previous closed session if exists and the current session
-
endSession
Ends a session, unbinds it from the scope and returns it.- Specified by:
endSessionin interfaceIScope- Returns:
- the previous session
-
withTransaction
Mutates the current transaction atomically- Specified by:
withTransactionin interfaceIScope- Parameters:
callback- the IWithTransaction callback
-
getOptions
- Specified by:
getOptionsin interfaceIScope
-
getSession
- Specified by:
getSessionin interfaceIScope
-
clearSession
@Internal public void clearSession()- Specified by:
clearSessionin interfaceIScope
-
setPropagationContext
@Internal public void setPropagationContext(@NotNull @NotNull PropagationContext propagationContext) - Specified by:
setPropagationContextin interfaceIScope
-
getPropagationContext
- Specified by:
getPropagationContextin interfaceIScope
-
withPropagationContext
@Internal @NotNull public @NotNull PropagationContext withPropagationContext(@NotNull @NotNull Scope.IWithPropagationContext callback) - Specified by:
withPropagationContextin interfaceIScope
-
clone
Clones the Scope
-