Package io.sentry

Interface IScope

All Known Implementing Classes:
NoOpScope, Scope

public interface IScope
  • Method Details

    • getLevel

      @Nullable @Nullable SentryLevel getLevel()
    • setLevel

      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 @Nullable String getTransactionName()
      Returns the Scope's transaction name.
      Returns:
      the transaction
    • setTransaction

      void setTransaction(@NotNull @NotNull String transaction)
      Sets the Scope's transaction.
      Parameters:
      transaction - the transaction
    • getSpan

      @Nullable @Nullable ISpan getSpan()
      Returns current active Span or Transaction.
      Returns:
      current active Span or Transaction or null if transaction has not been set.
    • setTransaction

      void setTransaction(@Nullable @Nullable ITransaction transaction)
      Sets the current active transaction
      Parameters:
      transaction - the transaction
    • getUser

      @Nullable @Nullable User getUser()
      Returns the Scope's user
      Returns:
      the user
    • setUser

      void setUser(@Nullable @Nullable User user)
      Sets the Scope's user
      Parameters:
      user - the user
    • getScreen

      @Internal @Nullable @Nullable String getScreen()
      Returns the Scope's current screen, previously set by setScreen(String)
      Returns:
      the name of the screen
    • setScreen

      @Internal void setScreen(@Nullable @Nullable String screen)
      Sets the Scope's current screen
      Parameters:
      screen - the name of the screen
    • getRequest

      @Nullable @Nullable Request getRequest()
      Returns the Scope's request
      Returns:
      the request
    • setRequest

      void setRequest(@Nullable @Nullable Request request)
      Sets the Scope's request
      Parameters:
      request - the request
    • getFingerprint

      @Internal @NotNull @NotNull List<String> getFingerprint()
      Returns the Scope's fingerprint list
      Returns:
      the fingerprint list
    • setFingerprint

      void setFingerprint(@NotNull @NotNull List<String> fingerprint)
      Sets the Scope's fingerprint list
      Parameters:
      fingerprint - the fingerprint list
    • getBreadcrumbs

      @Internal @NotNull @NotNull Queue<Breadcrumb> getBreadcrumbs()
      Returns the Scope's breadcrumbs queue
      Returns:
      the breadcrumbs queue
    • addBreadcrumb

      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 breadcrumb
      hint - the hint
    • addBreadcrumb

      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

      void clearBreadcrumbs()
      Clear all the breadcrumbs
    • clearTransaction

      void clearTransaction()
      Clears the transaction.
    • getTransaction

      @Nullable @Nullable ITransaction getTransaction()
      Returns active transaction or null if there is no active transaction.
      Returns:
      the transaction
    • clear

      void clear()
      Resets the Scope to its default state
    • getTags

      @Internal @NotNull @NotNull Map<String,String> getTags()
      Returns the Scope's tags
      Returns:
      the tags map
    • setTag

      void setTag(@NotNull @NotNull String key, @NotNull @NotNull String value)
      Sets a tag to Scope's tags
      Parameters:
      key - the key
      value - the value
    • removeTag

      void removeTag(@NotNull @NotNull String key)
      Removes a tag from the Scope's tags
      Parameters:
      key - the key
    • getExtras

      @Internal @NotNull @NotNull Map<String,Object> getExtras()
      Returns the Scope's extra map
      Returns:
      the extra map
    • setExtra

      void setExtra(@NotNull @NotNull String key, @NotNull @NotNull String value)
      Sets an extra to the Scope's extra map
      Parameters:
      key - the key
      value - the value
    • removeExtra

      void removeExtra(@NotNull @NotNull String key)
      Removes an extra from the Scope's extras
      Parameters:
      key - the key
    • getContexts

      @NotNull @NotNull Contexts getContexts()
      Returns the Scope's contexts
      Returns:
      the contexts
    • setContexts

      void setContexts(@NotNull @NotNull String key, @NotNull @NotNull Object value)
      Sets the Scope's contexts
      Parameters:
      key - the context key
      value - the context value
    • setContexts

      void setContexts(@NotNull @NotNull String key, @NotNull @NotNull Boolean value)
      Sets the Scope's contexts
      Parameters:
      key - the context key
      value - the context value
    • setContexts

      void setContexts(@NotNull @NotNull String key, @NotNull @NotNull String value)
      Sets the Scope's contexts
      Parameters:
      key - the context key
      value - the context value
    • setContexts

      void setContexts(@NotNull @NotNull String key, @NotNull @NotNull Number value)
      Sets the Scope's contexts
      Parameters:
      key - the context key
      value - the context value
    • setContexts

      void setContexts(@NotNull @NotNull String key, @NotNull @NotNull Collection<?> value)
      Sets the Scope's contexts
      Parameters:
      key - the context key
      value - the context value
    • setContexts

      void setContexts(@NotNull @NotNull String key, @NotNull @NotNull Object[] value)
      Sets the Scope's contexts
      Parameters:
      key - the context key
      value - the context value
    • setContexts

      void setContexts(@NotNull @NotNull String key, @NotNull @NotNull Character value)
      Sets the Scope's contexts
      Parameters:
      key - the context key
      value - the context value
    • removeContexts

      void removeContexts(@NotNull @NotNull String key)
      Removes a value from the Scope's contexts
      Parameters:
      key - the Key
    • getAttachments

      @NotNull @NotNull List<Attachment> getAttachments()
      Returns the Scopes's attachments
      Returns:
      the attachments
    • addAttachment

      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

      void clearAttachments()
      Clear all attachments.
    • getEventProcessors

      @NotNull @NotNull List<EventProcessor> getEventProcessors()
      Returns the Scope's event processors
      Returns:
      the event processors list
    • addEventProcessor

      void addEventProcessor(@NotNull @NotNull EventProcessor eventProcessor)
      Adds an event processor to the Scope's event processors list
      Parameters:
      eventProcessor - the event processor
    • withSession

      @Nullable @Nullable Session withSession(@NotNull io.sentry.Scope.IWithSession sessionCallback)
      Callback to do atomic operations on session
      Parameters:
      sessionCallback - the IWithSession callback
      Returns:
      a clone of the Session after executing the callback and mutating the session
    • startSession

      @Nullable io.sentry.Scope.SessionPair startSession()
      Returns a previous session (now closed) bound to this scope together with the newly created one
      Returns:
      the SessionPair with the previous closed session if exists and the current session
    • endSession

      @Nullable @Nullable Session endSession()
      Ends a session, unbinds it from the scope and returns it.
      Returns:
      the previous session
    • withTransaction

      @Internal void withTransaction(@NotNull Scope.IWithTransaction callback)
      Mutates the current transaction atomically
      Parameters:
      callback - the IWithTransaction callback
    • getOptions

      @NotNull @NotNull SentryOptions getOptions()
    • getSession

      @Internal @Nullable @Nullable Session getSession()
    • setPropagationContext

      @Internal void setPropagationContext(@NotNull @NotNull PropagationContext propagationContext)
    • getPropagationContext

      @Internal @NotNull @NotNull PropagationContext getPropagationContext()
    • withPropagationContext

      @Internal @NotNull @NotNull PropagationContext withPropagationContext(@NotNull Scope.IWithPropagationContext callback)
    • clone

      @NotNull @NotNull IScope clone()
      Clones the Scope
      Returns:
      the cloned Scope