Package io.sentry
Class Scope
- java.lang.Object
-
- io.sentry.Scope
-
public final class Scope extends java.lang.ObjectScope data to be sent with the event
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceScope.IWithTransactionthe 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 voidaddAttachment(@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 It also executes the BeforeBreadcrumb callback if setvoidaddEventProcessor(@NotNull EventProcessor eventProcessor)Adds an event processor to the Scope's event processors listvoidclear()Resets the Scope to its default statevoidclearAttachments()Clear all attachments.voidclearBreadcrumbs()Clear all the breadcrumbsvoidclearTransaction()Clears the transaction.@NotNull ContextsgetContexts()Returns the Scope's contexts@Nullable SentryLevelgetLevel()Returns the Scope's SentryLevel@Nullable RequestgetRequest()Returns the Scope's request@Nullable ISpangetSpan()Returns current active Span or Transaction.@NotNull java.util.Map<java.lang.String,java.lang.String>getTags()Returns the Scope's tags@Nullable ITransactiongetTransaction()Returns active transaction or null if there is no active transaction.@Nullable java.lang.StringgetTransactionName()Returns the Scope's transaction name.@Nullable UsergetUser()Returns the Scope's uservoidremoveContexts(@NotNull java.lang.String key)Removes a value from the Scope's contextsvoidremoveExtra(@NotNull java.lang.String key)Removes an extra from the Scope's extrasvoidremoveTag(@NotNull java.lang.String key)Removes a tag from the Scope's tagsvoidsetContexts(@NotNull java.lang.String key, @NotNull java.lang.Boolean value)Sets the Scope's contextsvoidsetContexts(@NotNull java.lang.String key, @NotNull java.lang.Character value)Sets the Scope's contextsvoidsetContexts(@NotNull java.lang.String key, @NotNull java.lang.Number value)Sets the Scope's contextsvoidsetContexts(@NotNull java.lang.String key, @NotNull java.lang.Object value)Sets the Scope's contextsvoidsetContexts(@NotNull java.lang.String key, @NotNull java.lang.Object[] value)Sets the Scope's contextsvoidsetContexts(@NotNull java.lang.String key, @NotNull java.lang.String value)Sets the Scope's contextsvoidsetContexts(@NotNull java.lang.String key, @NotNull java.util.Collection<?> value)Sets the Scope's contextsvoidsetExtra(@NotNull java.lang.String key, @NotNull java.lang.String value)Sets an extra to the Scope's extra mapvoidsetFingerprint(@NotNull java.util.List<java.lang.String> fingerprint)Sets the Scope's fingerprint listvoidsetLevel(@Nullable SentryLevel level)Sets the Scope's SentryLevel Level from scope exceptionally take precedence over the eventvoidsetRequest(@Nullable Request request)Sets the Scope's requestvoidsetTag(@NotNull java.lang.String key, @NotNull java.lang.String value)Sets a tag to Scope's tagsvoidsetTransaction(@NotNull java.lang.String transaction)Sets the Scope's transaction.voidsetTransaction(@Nullable ITransaction transaction)Sets the current active transactionvoidsetUser(@Nullable User user)Sets the Scope's uservoidwithTransaction(@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 Hint 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
-
-