Takaro - v0.6.0
    Preparing search index...

    Holds additional event information.

    Index

    Constructors

    • Returns Scope

    Properties

    _attachments: Attachment[]

    Attachments

    _attributes: RawAttributes<Record<string, unknown>>

    Attributes

    _breadcrumbs: Breadcrumb[]

    Array of breadcrumbs.

    _client?: Client<ClientOptions<BaseTransportOptions>>

    The client on this scope

    _contexts: Contexts

    Contexts

    _conversationId?: string

    Conversation ID

    _eventProcessors: EventProcessor[]

    Callback list that will be called during event processing.

    _extra: Extras

    Extra

    _fingerprint?: string[]

    Fingerprint

    _lastEventId?: string

    Contains the last event id of a captured event.

    _level?: SeverityLevel

    Severity

    _notifyingListeners: boolean

    Flag if notifying is happening.

    _propagationContext: PropagationContext

    Propagation Context for distributed tracing

    _scopeListeners: ((scope: Scope) => void)[]

    Callback for client to receive scope changes.

    _sdkProcessingMetadata: SdkProcessingMetadata

    A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get sent to Sentry

    _session?: Session

    Session

    _tags: { [key: string]: Primitive }

    Tags

    _transactionName?: string

    Transaction Name

    IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects. It's purpose is to assign a transaction to the scope that's added to non-transaction events.

    _user: User

    User

    Methods

    • This will be called on every set call.

      Returns void

    • Add an attachment to the scope.

      Parameters

      • attachment: Attachment

      Returns this

    • Adds a breadcrumb to the scope. By default, the last 100 breadcrumbs are kept.

      Parameters

      • breadcrumb: Breadcrumb
      • OptionalmaxBreadcrumbs: number

      Returns this

    • Add an event processor that will be called before an event is sent.

      Parameters

      • callback: EventProcessor

      Returns this

    • Parameters

      • callback: (scope: Scope) => void

      Returns void

    • Capture a Sentry event for this scope.

      Parameters

      Returns string

      The id of the captured event.

    • Capture an exception for this scope.

      Parameters

      Returns string

      The id of the captured Sentry event.

    • Capture a message for this scope.

      Parameters

      Returns string

      The id of the captured message.

    • Clears the current scope and resets its properties. Note: The client will not be cleared.

      Returns this

    • Clear all attachments from the scope.

      Returns this

    • Clear all breadcrumbs from the scope.

      Returns this

    • Clone all data from this scope into a new scope.

      Returns Scope

    • Get the client assigned to this scope.

      Type Parameters

      • C extends Client<ClientOptions<BaseTransportOptions>>

      Returns C | undefined

    • Get the last breadcrumb of the scope.

      Returns Breadcrumb | undefined

    • Get propagation context from the scope, used for distributed tracing

      Returns PropagationContext

    • Get the data of this scope, which should be applied to an event during processing.

      Returns ScopeData

    • Get the session from the scope.

      Returns Session | undefined

    • Get the user from this scope.

      Returns User | undefined

    • Get the ID of the last captured error event. This is generally only available on the isolation scope.

      Returns string | undefined

    • Removes the attribute with the given key from the scope.

      Parameters

      • key: string

        The attribute key.

      Returns this

      scope.removeAttribute('is_admin');
      
    • Sets an attribute onto the scope.

      These attributes are currently applied to logs and metrics. In the future, they will also be applied to spans.

      Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for more complex attribute types. We'll add this support in the future but already specify the wider type to avoid a breaking change in the future.

      Type Parameters

      • T extends unknown

      Parameters

      • key: string

        The attribute key.

      • value: RawAttribute<T>

        the attribute value. You can either pass in a raw value, or an attribute object with a value and an optional unit (if applicable to your attribute).

      Returns this

      scope.setAttribute('is_admin', true);
      scope.setAttribute('render_duration', { value: 'render_duration', unit: 'ms' });
    • Sets attributes onto the scope.

      These attributes are currently applied to logs and metrics. In the future, they will also be applied to spans.

      Important: For now, only strings, numbers and boolean attributes are supported, despite types allowing for more complex attribute types. We'll add this support in the future but already specify the wider type to avoid a breaking change in the future.

      Type Parameters

      • T extends Record<string, unknown>

      Parameters

      • newAttributes: RawAttributes<T>

        The attributes to set on the scope. You can either pass in key-value pairs, or an object with a value and an optional unit (if applicable to your attribute).

      Returns this

      scope.setAttributes({
      is_admin: true,
      payment_selection: 'credit_card',
      render_duration: { value: 'render_duration', unit: 'ms' },
      });
    • Update the client assigned to this scope. Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client, as well as manually created scopes.

      Parameters

      • client: Client<ClientOptions<BaseTransportOptions>> | undefined

      Returns void

    • Sets context data with the given name. Data passed as context will be normalized. You can also pass null to unset the context. Note that context data will not be merged - calling setContext will overwrite an existing context with the same key.

      Parameters

      • key: string
      • context: Context | null

      Returns this

    • Set the conversation ID for this scope. Set to null to unset the conversation ID.

      Parameters

      • conversationId: string | null | undefined

      Returns this

    • Set a single key:value extra entry that will be sent as extra data with the event.

      Parameters

      • key: string
      • extra: unknown

      Returns this

    • Set an object that will be merged into existing extra on the scope, and will be sent as extra data with the event.

      Parameters

      • extras: Extras

      Returns this

    • Sets the fingerprint on the scope to send with the events.

      Parameters

      • fingerprint: string[]

        Fingerprint to group events in Sentry.

      Returns this

    • Set the ID of the last captured error event. This is generally only captured on the isolation scope.

      Parameters

      • lastEventId: string | undefined

      Returns void

    • Sets the level on the scope for future events.

      Parameters

      Returns this

    • Add propagation context to the scope, used for distributed tracing

      Parameters

      • context: PropagationContext

      Returns this

    • Add data which will be accessible during event processing but won't get sent to Sentry.

      Parameters

      • newData: SdkProcessingMetadata

      Returns this

    • Set the session for the scope.

      Parameters

      Returns this

    • Set a single tag that will be sent as tags data with the event.

      Parameters

      • key: string
      • value: Primitive

      Returns this

    • Set an object that will be merged into existing tags on the scope, and will be sent as tags data with the event.

      Parameters

      • tags: { [key: string]: Primitive }

      Returns this

    • Sets the transaction name on the scope so that the name of e.g. taken server route or the page location is attached to future events.

      IMPORTANT: Calling this function does NOT change the name of the currently active root span. If you want to change the name of the active root span, use Sentry.updateSpanName(rootSpan, 'new name') instead.

      By default, the SDK updates the scope's transaction name automatically on sensible occasions, such as a page navigation or when handling a new request on the server.

      Parameters

      • Optionalname: string

      Returns this

    • Set the user for this scope. Set to null to unset the user.

      Parameters

      Returns this

    • Updates the scope with provided data. Can work in three variations:

      • plain object containing updatable attributes
      • Scope instance that'll extract the attributes from
      • callback function that'll receive the current scope as an argument and allow for modifications

      Parameters

      Returns this