Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/sentry_deno/packages/hub/src/scope.ts>Scope

Unofficial port of the Sentry SDK for JavaScript to Deno.
Latest
class Scope
implements ScopeInterface
import { Scope } from "https://deno.land/x/sentry_deno@v0.2.2/packages/hub/src/scope.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
_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
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

private
_applyFingerprint(event: Event): void

Applies fingerprint from the scope to the event if there's one, uses message if there's one instead or get rid of empty fingerprint

protected
_notifyEventProcessors(
processors: EventProcessor[],
event: Event | null,
hint: EventHint,
index?: number,
): PromiseLike<Event | null>

This will be called after applyToEvent is finished.

protected
_notifyScopeListeners(): void

This will be called on every set call.

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

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

applyToEvent(event: Event, hint?: EventHint): PromiseLike<Event | null>

Applies the current context and fingerprint to the event. Note that breadcrumbs will be added by the client. Also if the event has already breadcrumbs on it, we do not merge them.

clear(): this
getSession(): Session | undefined
getSpan(): Span | undefined
getUser(): User | undefined
setContext(key: string, context: Context | null): this
setExtra(key: string, extra: Extra): this
setExtras(extras: Extras): this
setFingerprint(fingerprint: string[]): 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
setSpan(span?: Span): this
setTag(key: string, value: Primitive): this
setTags(tags: { [key: string]: Primitive; }): this
setTransactionName(name?: string): this
setUser(user: User | null): this
update(captureContext?: CaptureContext): this

Static Methods

clone(scope?: Scope): Scope

Inherit values from the parent scope.