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

x/sentry/index.mjs>Hub

The Official Sentry Deno SDK
Latest
class Hub
implements Hub$1
Deprecated
Deprecated

The Hub class will be removed in version 8 of the SDK in favour of Scope and Client objects.

If you previously used the Hub class directly, replace it with Scope and Client objects. More information:

Some of our APIs are typed with the Hub class instead of the interface (e.g. getCurrentHub). Most of them are deprecated themselves and will also be removed in version 8. More information:

import { Hub } from "https://deno.land/x/sentry@7.120.0/index.mjs";

Constructors

new
Hub(
client?: Client,
scope?: Scope,
isolationScope?: Scope,
_version?: number,
)

Creates a new instance of the hub, will push one Layer into the internal stack on creation.

Properties

private
_callExtensionMethod

Calls global extension method and binding current instance to the function call

private
_isolationScope
private
optional
_lastEventId

Contains the last event id of a captured event.

private
_sendSessionUpdate

Sends the current Session on the scope

private
readonly
_stack

Is a Layer[] containing the client and scope

private
readonly
_version

Methods

deprecated
addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void
deprecated
bindClient(client?: Client): void

This binds the given client to the current scope.

deprecated
captureEvent(event: Event, hint?: EventHint): string
deprecated
captureException(exception: unknown, hint?: EventHint): string
deprecated
captureMessage(
message: string,
hint?: EventHint,
): string
deprecated
captureSession(endSession?: boolean): void
deprecated
configureScope(callback: (scope: Scope) => void): void
deprecated
endSession(): void
deprecated
getClient<C extends Client>(): C | undefined
deprecated
getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null
deprecated
getScope(): Scope

Returns the scope of the top stack.

deprecated
getStack(): Layer[]

Returns the scope stack for domains or the process.

deprecated
getStackTop(): Layer

Returns the topmost scope layer in the order domain > local > process.

deprecated
isOlderThan(version: number): boolean

Checks if this hub's version is older than the given version.

deprecated
lastEventId(): string | undefined
deprecated
popScope(): boolean
deprecated
pushScope(): Scope
run(callback: (hub: Hub) => void): void
deprecated
setContext(name: string, context: { [key: string]: any; } | null): void
deprecated
setExtra(key: string, extra: Extra): void
deprecated
setExtras(extras: Extras): void
deprecated
setTag(key: string, value: Primitive): void
deprecated
setTags(tags: { [key: string]: Primitive; }): void
deprecated
setUser(user: User | null): void
deprecated
shouldSendDefaultPii(): boolean

Returns if default PII should be sent to Sentry and propagated in ourgoing requests when Tracing is used.

deprecated
startSession(context?: SessionContext): Session
deprecated
startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): Transaction

Starts a new Transaction and returns it. This is the entry point to manual tracing instrumentation.

A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a new child span within the transaction or any span, call the respective .startChild() method.

Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.

The transaction must be finished with a call to its .end() method, at which point the transaction with all its finished child spans will be sent to Sentry.

deprecated
traceHeaders(): { [key: string]: string; }
deprecated
withScope<T>(callback: (scope: Scope) => T): T