Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/sentry_deno/packages/types/src/index.ts>Scope

Unofficial port of the Sentry SDK for JavaScript to Deno.
Latest
interface Scope
import { type Scope } from "https://deno.land/x/sentry_deno@v0.2.2/packages/types/src/index.ts";

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

Methods

addEventProcessor(callback: EventProcessor): this

Add new event processor that will be called after applyToEvent.

setUser(user: User | null): this

Updates user context information for future events.

getUser(): User | undefined

Returns the User if there is one

setTags(tags: { [key: string]: Primitive; }): this

Set an object that will be merged sent as tags data with the event.

setTag(key: string, value: Primitive): this

Set key:value that will be sent as tags data with the event.

Can also be used to unset a tag by passing undefined.

setExtras(extras: Extras): this

Set an object that will be merged sent as extra data with the event.

setExtra(key: string, extra: Extra): this

Set key:value that will be sent as extra data with the event.

setFingerprint(fingerprint: string[]): this

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

setLevel(level: Severity | SeverityLevel): this

Sets the level on the scope for future events.

setTransactionName(name?: string): this

Sets the transaction name on the scope for future events.

setContext(name: string, context: Context | null): this

Sets context data with the given name.

setSpan(span?: Span): this

Sets the Span on the scope.

getSpan(): Span | undefined

Returns the Span if there is one

getTransaction(): Transaction | undefined

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

getSession(): Session | undefined

Returns the Session if there is one

setSession(session?: Session): this

Sets the Session on the scope

getRequestSession(): RequestSession | undefined

Returns the RequestSession if there is one

setRequestSession(requestSession?: RequestSession): this

Sets the RequestSession on the scope

update(captureContext?: CaptureContext): 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
clear(): this

Clears the current scope and resets its properties.

addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this

Sets the breadcrumbs in the scope

clearBreadcrumbs(): this

Clears all currently set Breadcrumbs.

addAttachment(attachment: Attachment): this

Adds an attachment to the scope

getAttachments(): Attachment[]

Returns an array of attachments on the scope

clearAttachments(): this

Clears attachments from the scope