Skip to main content
Module

x/sentry/index.d.ts>Scope

The Official Sentry Deno SDK
Go to Latest
class Scope
implements Scope$1
import { Scope } from "https://deno.land/x/sentry@7.109.0/index.d.ts";

Holds additional event information. Scope.applyToEvent will be called by the client before an event will be sent.

Constructors

new
Scope()

Properties

protected
_attachments: Attachment[]

Attachments

protected
_breadcrumbs: Breadcrumb[]

Array of breadcrumbs.

protected
optional
_client: Client

The client on this scope

protected
_contexts: Contexts

Contexts

protected
_eventProcessors: EventProcessor[]

Callback list that will be called after applyToEvent.

protected
_extra: Extras

Extra

protected
optional
_fingerprint: string[]

Fingerprint

protected
optional
_level: Severity | SeverityLevel

Severity

protected
_notifyingListeners: boolean

Flag if notifying is happening.

protected
_propagationContext: PropagationContext

Propagation Context for distributed tracing

protected
optional
_requestSession: RequestSession

Request Mode Session Status

protected
_scopeListeners: Array<(scope: Scope) => void>

Callback for client to receive scope changes.

protected
_sdkProcessingMetadata: { [key: string]: unknown; }

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

protected
optional
_session: Session

Session

protected
optional
_span: Span

Span

protected
_tags: { [key: string]: Primitive; }

Tags

protected
optional
_transactionName: string

Transaction Name

protected
_user: User

User

Methods

protected
_notifyScopeListeners(): void

This will be called on every set call.

addAttachment(attachment: Attachment): this
addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this
addEventProcessor(callback: EventProcessor): this
addScopeListener(callback: (scope: Scope) => void): void

Add internal on change listener. Used for sub SDKs that need to store the scope.

deprecated
applyToEvent(
event: Event,
hint?: EventHint,
additionalEventProcessors?: EventProcessor[],
): PromiseLike<Event | null>

Applies data from the scope to the event and runs all event processors on it.

captureEvent(event: Event, hint?: EventHint): string

Captures a manually created event for this scope and sends it to Sentry.

captureException(exception: unknown, hint?: EventHint): string

Capture an exception for this scope.

captureMessage(
message: string,
level?: SeverityLevel,
hint?: EventHint,
): string

Capture a message for this scope.

clear(): this
clone(): Scope

Clone this scope instance.

deprecated
getAttachments(): Attachment[]
getClient(): Client | undefined

Get the client assigned to this scope.

It is generally recommended to use the global function Sentry.getClient() instead, unless you know what you are doing.

getLastBreadcrumb(): Breadcrumb | undefined
getPropagationContext(): PropagationContext
getRequestSession(): RequestSession | undefined
getScopeData(): ScopeData
getSession(): Session | undefined
deprecated
getSpan(): Span | undefined

Returns the Span if there is one.

deprecated
getTransaction(): Transaction | undefined

Returns the Transaction attached to the scope (if there is one).

getUser(): User | undefined
setClient(client: Client | undefined): void

Update the client on the scope.

setContext(key: string, context: Context | null): this
setExtra(key: string, extra: Extra): this
setExtras(extras: Extras): this
setFingerprint(fingerprint: string[]): this
setLevel(level: Severity | SeverityLevel): this
setPropagationContext(context: PropagationContext): this
setRequestSession(requestSession?: RequestSession): this
setSDKProcessingMetadata(newData: { [key: string]: unknown; }): this

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

setSession(session?: Session): this
deprecated
setSpan(span?: Span): this

Sets the Span on the scope.

setTag(key: string, value: Primitive): this
setTags(tags: { [key: string]: Primitive; }): this
setTransactionName(name?: string): this

Sets the transaction name on the scope for future events.

setUser(user: User | null): this
update(captureContext?: CaptureContext): this

Static Methods

deprecated
clone(scope?: Scope): Scope

Inherit values from the parent scope.