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
Modifier and TypeClassDescriptionstatic interface
the IWithPropagationContext callbackstatic interface
The IWithTransaction callback -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttachment
(@NotNull Attachment attachment) Adds an attachment to the Scope's list of attachments.void
addBreadcrumb
(@NotNull Breadcrumb breadcrumb) Adds a breadcrumb to the breadcrumbs queue It also executes the BeforeBreadcrumb callback if setvoid
addBreadcrumb
(@NotNull Breadcrumb breadcrumb, @Nullable Hint hint) Adds a breadcrumb to the breadcrumbs queue.void
addEventProcessor
(@NotNull EventProcessor eventProcessor) Adds an event processor to the Scope's event processors listvoid
clear()
Resets the Scope to its default statevoid
Clear all attachments.void
Clear all the breadcrumbsvoid
void
Clears the transaction.@NotNull IScope
clone()
Clones the Scope@Nullable Session
Ends 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 Contexts
Returns the Scope's contexts@NotNull List<EventProcessor>
Returns the Scope's event processorsReturns the Scope's extra mapReturns the Scope's fingerprint list@Nullable SentryLevel
getLevel()
Returns the Scope's SentryLevel@NotNull SentryOptions
@NotNull PropagationContext
@NotNull SentryId
Returns the Scope's current replay_id, previously set byIScope.setReplayId(SentryId)
@Nullable Request
Returns the Scope's request@Nullable String
Returns the Scope's current screen, previously set byIScope.setScreen(String)
@Nullable Session
@Nullable ISpan
getSpan()
Returns current active Span or Transaction.getTags()
Returns the Scope's tags@Nullable ITransaction
Returns active transaction or null if there is no active transaction.@Nullable String
Returns the Scope's transaction name.@Nullable User
getUser()
Returns the Scope's uservoid
removeContexts
(@NotNull String key) Removes a value from the Scope's contextsvoid
removeExtra
(@NotNull String key) Removes an extra from the Scope's extrasvoid
Removes a tag from the Scope's tagsvoid
setContexts
(@NotNull String key, @NotNull Boolean value) Sets the Scope's contextsvoid
setContexts
(@NotNull String key, @NotNull Character value) Sets the Scope's contextsvoid
setContexts
(@NotNull String key, @NotNull Number value) Sets the Scope's contextsvoid
setContexts
(@NotNull String key, @NotNull Object value) Sets the Scope's contextsvoid
setContexts
(@NotNull String key, @NotNull Object[] value) Sets the Scope's contextsvoid
setContexts
(@NotNull String key, @NotNull String value) Sets the Scope's contextsvoid
setContexts
(@NotNull String key, @NotNull Collection<?> value) Sets the Scope's contextsvoid
Sets an extra to the Scope's extra mapvoid
setFingerprint
(@NotNull List<String> fingerprint) Sets the Scope's fingerprint listvoid
setLevel
(@Nullable SentryLevel level) Sets the Scope's SentryLevel Level from scope exceptionally take precedence over the eventvoid
setPropagationContext
(@NotNull PropagationContext propagationContext) void
setReplayId
(@NotNull SentryId replayId) Sets the Scope's current replay_idvoid
setRequest
(@Nullable Request request) Sets the Scope's requestvoid
Sets the Scope's current screenvoid
Sets a tag to Scope's tagsvoid
setTransaction
(@NotNull String transaction) Sets the Scope's transaction.void
setTransaction
(@Nullable ITransaction transaction) Sets the current active transactionvoid
Sets the Scope's user@Nullable io.sentry.Scope.SessionPair
Returns a previous session (now closed) bound to this scope together with the newly created one@NotNull PropagationContext
withPropagationContext
(@NotNull Scope.IWithPropagationContext callback) @Nullable Session
withSession
(@NotNull io.sentry.Scope.IWithSession sessionCallback) Callback to do atomic operations on sessionvoid
withTransaction
(@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:
getTransactionName
in interfaceIScope
- Returns:
- the transaction
-
setTransaction
Sets the Scope's transaction.- Specified by:
setTransaction
in interfaceIScope
- Parameters:
transaction
- the transaction
-
getSpan
Returns current active Span or Transaction. -
setTransaction
Sets the current active transaction- Specified by:
setTransaction
in 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:IScope
Returns the Scope's current replay_id, previously set byIScope.setReplayId(SentryId)
- Specified by:
getReplayId
in interfaceIScope
- Returns:
- the id of the current session replay
-
setReplayId
Description copied from interface:IScope
Sets the Scope's current replay_id- Specified by:
setReplayId
in interfaceIScope
- Parameters:
replayId
- the id of the current session replay
-
getRequest
Returns the Scope's request- Specified by:
getRequest
in interfaceIScope
- Returns:
- the request
-
setRequest
Sets the Scope's request- Specified by:
setRequest
in interfaceIScope
- Parameters:
request
- the request
-
getFingerprint
Returns the Scope's fingerprint list- Specified by:
getFingerprint
in interfaceIScope
- Returns:
- the fingerprint list
-
setFingerprint
Sets the Scope's fingerprint list- Specified by:
setFingerprint
in interfaceIScope
- Parameters:
fingerprint
- the fingerprint list
-
getBreadcrumbs
Returns the Scope's breadcrumbs queue- Specified by:
getBreadcrumbs
in interfaceIScope
- Returns:
- the breadcrumbs queue
-
addBreadcrumb
Adds a breadcrumb to the breadcrumbs queue. It also executes the BeforeBreadcrumb callback if set- Specified by:
addBreadcrumb
in 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:
addBreadcrumb
in interfaceIScope
- Parameters:
breadcrumb
- the breadcrumb
-
clearBreadcrumbs
public void clearBreadcrumbs()Clear all the breadcrumbs- Specified by:
clearBreadcrumbs
in interfaceIScope
-
clearTransaction
public void clearTransaction()Clears the transaction.- Specified by:
clearTransaction
in interfaceIScope
-
getTransaction
Returns active transaction or null if there is no active transaction.- Specified by:
getTransaction
in 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:
removeExtra
in interfaceIScope
- Parameters:
key
- the key
-
getContexts
Returns the Scope's contexts- Specified by:
getContexts
in interfaceIScope
- Returns:
- the contexts
-
setContexts
Sets the Scope's contexts- Specified by:
setContexts
in interfaceIScope
- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContexts
in interfaceIScope
- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContexts
in interfaceIScope
- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContexts
in interfaceIScope
- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContexts
in interfaceIScope
- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContexts
in interfaceIScope
- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
Sets the Scope's contexts- Specified by:
setContexts
in interfaceIScope
- Parameters:
key
- the context keyvalue
- the context value
-
removeContexts
Removes a value from the Scope's contexts- Specified by:
removeContexts
in interfaceIScope
- Parameters:
key
- the Key
-
getAttachments
Returns the Scopes's attachments- Specified by:
getAttachments
in 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:
addAttachment
in interfaceIScope
- Parameters:
attachment
- The attachment to add to the Scope's list of attachments.
-
clearAttachments
public void clearAttachments()Clear all attachments.- Specified by:
clearAttachments
in interfaceIScope
-
getEventProcessors
Returns the Scope's event processors- Specified by:
getEventProcessors
in interfaceIScope
- Returns:
- the event processors list
-
addEventProcessor
Adds an event processor to the Scope's event processors list- Specified by:
addEventProcessor
in 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:
withSession
in 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:
startSession
in 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:
endSession
in interfaceIScope
- Returns:
- the previous session
-
withTransaction
Mutates the current transaction atomically- Specified by:
withTransaction
in interfaceIScope
- Parameters:
callback
- the IWithTransaction callback
-
getOptions
- Specified by:
getOptions
in interfaceIScope
-
getSession
- Specified by:
getSession
in interfaceIScope
-
clearSession
@Internal public void clearSession()- Specified by:
clearSession
in interfaceIScope
-
setPropagationContext
@Internal public void setPropagationContext(@NotNull @NotNull PropagationContext propagationContext) - Specified by:
setPropagationContext
in interfaceIScope
-
getPropagationContext
- Specified by:
getPropagationContext
in interfaceIScope
-
withPropagationContext
@Internal @NotNull public @NotNull PropagationContext withPropagationContext(@NotNull @NotNull Scope.IWithPropagationContext callback) - Specified by:
withPropagationContext
in interfaceIScope
-
clone
Clones the Scope
-