Package io.sentry
Class Scope
- java.lang.Object
-
- io.sentry.Scope
-
public final class Scope extends java.lang.Object
Scope data to be sent with the event
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Scope.IWithTransaction
the IWithTransaction callback
-
Constructor Summary
Constructors Constructor Description Scope(@NotNull SentryOptions options)
Scope's ctor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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 java.lang.Object hint)
Adds a breadcrumb to the breadcrumbs queue It also executes the BeforeBreadcrumb callback if setvoid
addEventProcessor(@NotNull EventProcessor eventProcessor)
Adds an event processor to the Scope's event processors listvoid
clear()
Resets the Scope to its default statevoid
clearAttachments()
Clear all attachments.void
clearBreadcrumbs()
Clear all the breadcrumbsvoid
clearTransaction()
Clears the transaction.@NotNull Contexts
getContexts()
Returns the Scope's contexts@Nullable SentryLevel
getLevel()
Returns the Scope's SentryLevel@Nullable Request
getRequest()
Returns the Scope's request@Nullable ISpan
getSpan()
Returns current active Span or Transaction.@NotNull java.util.Map<java.lang.String,java.lang.String>
getTags()
Returns the Scope's tags@Nullable ITransaction
getTransaction()
Returns active transaction or null if there is no active transaction.@Nullable java.lang.String
getTransactionName()
Returns the Scope's transaction name.@Nullable User
getUser()
Returns the Scope's uservoid
removeContexts(@NotNull java.lang.String key)
Removes a value from the Scope's contextsvoid
removeExtra(@NotNull java.lang.String key)
Removes an extra from the Scope's extrasvoid
removeTag(@NotNull java.lang.String key)
Removes a tag from the Scope's tagsvoid
setContexts(@NotNull java.lang.String key, @NotNull java.lang.Boolean value)
Sets the Scope's contextsvoid
setContexts(@NotNull java.lang.String key, @NotNull java.lang.Character value)
Sets the Scope's contextsvoid
setContexts(@NotNull java.lang.String key, @NotNull java.lang.Number value)
Sets the Scope's contextsvoid
setContexts(@NotNull java.lang.String key, @NotNull java.lang.Object value)
Sets the Scope's contextsvoid
setContexts(@NotNull java.lang.String key, @NotNull java.lang.Object[] value)
Sets the Scope's contextsvoid
setContexts(@NotNull java.lang.String key, @NotNull java.lang.String value)
Sets the Scope's contextsvoid
setContexts(@NotNull java.lang.String key, @NotNull java.util.Collection<?> value)
Sets the Scope's contextsvoid
setExtra(@NotNull java.lang.String key, @NotNull java.lang.String value)
Sets an extra to the Scope's extra mapvoid
setFingerprint(@NotNull java.util.List<java.lang.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
setRequest(@Nullable Request request)
Sets the Scope's requestvoid
setTag(@NotNull java.lang.String key, @NotNull java.lang.String value)
Sets a tag to Scope's tagsvoid
setTransaction(@NotNull java.lang.String transaction)
Sets the Scope's transaction.void
setTransaction(@Nullable ITransaction transaction)
Sets the current active transactionvoid
setUser(@Nullable User user)
Sets the Scope's uservoid
withTransaction(@NotNull Scope.IWithTransaction callback)
Mutates the current transaction atomically
-
-
-
Constructor Detail
-
Scope
public Scope(@NotNull @NotNull SentryOptions options)
Scope's ctor- Parameters:
options
- the options
-
-
Method Detail
-
getLevel
@Nullable public @Nullable SentryLevel getLevel()
Returns the Scope's SentryLevel- Returns:
- the SentryLevel
-
setLevel
public void setLevel(@Nullable @Nullable SentryLevel level)
Sets the Scope's SentryLevel Level from scope exceptionally take precedence over the event- Parameters:
level
- the SentryLevel
-
getTransactionName
@Nullable public @Nullable java.lang.String getTransactionName()
Returns the Scope's transaction name.- Returns:
- the transaction
-
setTransaction
public void setTransaction(@NotNull @NotNull java.lang.String transaction)
Sets the Scope's transaction.- Parameters:
transaction
- the transaction
-
getSpan
@Nullable public @Nullable ISpan getSpan()
Returns current active Span or Transaction.- Returns:
- current active Span or Transaction or null if transaction has not been set.
-
setTransaction
public void setTransaction(@Nullable @Nullable ITransaction transaction)
Sets the current active transaction- Parameters:
transaction
- the transaction
-
getUser
@Nullable public @Nullable User getUser()
Returns the Scope's user- Returns:
- the user
-
setUser
public void setUser(@Nullable @Nullable User user)
Sets the Scope's user- Parameters:
user
- the user
-
getRequest
@Nullable public @Nullable Request getRequest()
Returns the Scope's request- Returns:
- the request
-
setRequest
public void setRequest(@Nullable @Nullable Request request)
Sets the Scope's request- Parameters:
request
- the request
-
setFingerprint
public void setFingerprint(@NotNull @NotNull java.util.List<java.lang.String> fingerprint)
Sets the Scope's fingerprint list- Parameters:
fingerprint
- the fingerprint list
-
addBreadcrumb
public void addBreadcrumb(@NotNull @NotNull Breadcrumb breadcrumb, @Nullable @Nullable java.lang.Object hint)
Adds a breadcrumb to the breadcrumbs queue It also executes the BeforeBreadcrumb callback if set- Parameters:
breadcrumb
- the breadcrumbhint
- the hint
-
addBreadcrumb
public void addBreadcrumb(@NotNull @NotNull Breadcrumb breadcrumb)
Adds a breadcrumb to the breadcrumbs queue It also executes the BeforeBreadcrumb callback if set- Parameters:
breadcrumb
- the breadcrumb
-
clearBreadcrumbs
public void clearBreadcrumbs()
Clear all the breadcrumbs
-
clearTransaction
public void clearTransaction()
Clears the transaction.
-
getTransaction
@Nullable public @Nullable ITransaction getTransaction()
Returns active transaction or null if there is no active transaction.- Returns:
- the transaction
-
clear
public void clear()
Resets the Scope to its default state
-
getTags
@Internal @NotNull public @NotNull java.util.Map<java.lang.String,java.lang.String> getTags()
Returns the Scope's tags- Returns:
- the tags map
-
setTag
public void setTag(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
Sets a tag to Scope's tags- Parameters:
key
- the keyvalue
- the value
-
removeTag
public void removeTag(@NotNull @NotNull java.lang.String key)
Removes a tag from the Scope's tags- Parameters:
key
- the key
-
setExtra
public void setExtra(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
Sets an extra to the Scope's extra map- Parameters:
key
- the keyvalue
- the value
-
removeExtra
public void removeExtra(@NotNull @NotNull java.lang.String key)
Removes an extra from the Scope's extras- Parameters:
key
- the key
-
getContexts
@NotNull public @NotNull Contexts getContexts()
Returns the Scope's contexts- Returns:
- the contexts
-
setContexts
public void setContexts(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.Object value)
Sets the Scope's contexts- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
public void setContexts(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.Boolean value)
Sets the Scope's contexts- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
public void setContexts(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
Sets the Scope's contexts- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
public void setContexts(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.Number value)
Sets the Scope's contexts- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
public void setContexts(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.util.Collection<?> value)
Sets the Scope's contexts- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
public void setContexts(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.Object[] value)
Sets the Scope's contexts- Parameters:
key
- the context keyvalue
- the context value
-
setContexts
public void setContexts(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.Character value)
Sets the Scope's contexts- Parameters:
key
- the context keyvalue
- the context value
-
removeContexts
public void removeContexts(@NotNull @NotNull java.lang.String key)
Removes a value from the Scope's contexts- Parameters:
key
- the Key
-
addAttachment
public void addAttachment(@NotNull @NotNull Attachment attachment)
Adds an attachment to the Scope's list of attachments. The SDK adds the attachment to every event and transaction sent to Sentry.- Parameters:
attachment
- The attachment to add to the Scope's list of attachments.
-
clearAttachments
public void clearAttachments()
Clear all attachments.
-
addEventProcessor
public void addEventProcessor(@NotNull @NotNull EventProcessor eventProcessor)
Adds an event processor to the Scope's event processors list- Parameters:
eventProcessor
- the event processor
-
withTransaction
@Internal public void withTransaction(@NotNull @NotNull Scope.IWithTransaction callback)
Mutates the current transaction atomically- Parameters:
callback
- the IWithTransaction callback
-
-