The Sentry Node SDK Client.

  • NodeClientOptions for documentation on configuration options.
  • SentryClient for usage documentation.

Hierarchy

  • ServerRuntimeClient<NodeClientOptions>
    • NodeClient

Constructors

  • Creates a new Node SDK instance.

    Parameters

    • options: NodeClientOptions

      Configuration options for this SDK.

    Returns NodeClient

Properties

_dsn?: DsnComponents

The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled.

_eventProcessors: EventProcessor[]
_integrations: IntegrationIndex

Array of set up integrations.

_integrationsInitialized: boolean

Indicates whether this client's integrations have been set up.

_numProcessing: number

Number of calls being processed

_options: NodeClientOptions

Options passed to the SDK.

_sessionFlusher: undefined | SessionFlusher
_transport?: Transport
metricsAggregator?: MetricsAggregator

A reference to a metrics aggregator

Note this is alpha API. It may experience breaking changes in the future.

Methods

  • Processes the event and logs an error in case of rejection

    Parameters

    Returns PromiseLike<undefined | string>

  • Method responsible for capturing/ending a request session by calling incrementSessionStatusCount to increment appropriate session aggregates bucket

    Returns void

  • Clears outcomes on this client and returns them.

    Returns Outcome[]

  • Determine if the client is finished processing. Returns a promise because it will wait timeout ms before saying "no" (resolving to false) in order to give the client a chance to potentially finish first.

    Parameters

    • Optionaltimeout: number

      The time, in ms, after which to resolve to false if the client is still busy. Passing 0 (or not passing anything) will make the promise wait as long as it takes for processing to finish before resolving to true.

    Returns PromiseLike<boolean>

    A promise which will resolve to true if processing is already done or finishes before the timeout, and false otherwise

  • Determines whether this SDK is enabled and a transport is present.

    Returns boolean

  • Parameters

    Returns PromiseLike<null | Event>

  • Occupies the client with processing and event

    Type Parameters

    • T

    Parameters

    • promise: PromiseLike<T>

    Returns void

  • Processes an event (either error or message) and sends it to Sentry.

    This also adds breadcrumbs and context information to the event. However, platform specific meta data (such as the User's IP address) must be added by the SDK implementor.

    Parameters

    • event: Event

      The event to send to Sentry.

    • hint: EventHint

      May contain additional information about the original exception.

    • Optionalscope: Scope

      A scope containing event metadata.

    Returns PromiseLike<Event>

    A SyncPromise that resolves with the event or rejects in case event was/will not be send.

  • Parameters

    • envelope: Envelope

    Returns void | PromiseLike<void | TransportMakeRequestResponse>

  • Setup integrations for this client.

    Returns void

  • Updates existing session based on the provided event

    Parameters

    Returns void

  • Parameters

    • eventProcessor: EventProcessor

    Returns void

  • Parameters

    • integration: Integration

    Returns void

  • Parameters

    • metricBucketItems: MetricBucketItem[]

    Returns void

  • Create a cron monitor check in and send it to Sentry.

    Parameters

    • checkIn: CheckIn

      An object that describes a check in.

    • OptionalmonitorConfig: MonitorConfig
    • Optionalscope: Scope

    Returns string

  • Parameters

    Returns undefined | string

  • Parameters

    Returns undefined | string

  • Parameters

    Returns undefined | string

  • Parameters

    Returns void

  • Parameters

    • Optionaltimeout: number

    Returns PromiseLike<boolean>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • hook: "beforeEnvelope"
    • envelope: Envelope

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • hook: "afterSendEvent"
    • event: Event
    • sendResponse: void | TransportMakeRequestResponse

    Returns void

  • Parameters

    Returns void

  • Parameters

    • hook: "createDsc"
    • dsc: DynamicSamplingContext

    Returns void

  • Parameters

    • hook: "otelSpanEnd"
    • otelSpan: unknown
    • mutableOptions: { drop: boolean }

    Returns void

  • Parameters

    • hook: "beforeSendFeedback"
    • feedback: FeedbackEvent
    • Optionaloptions: { includeReplay: boolean }

    Returns void

  • Parameters

    • hook: "startPageLoadSpan"
    • options: StartSpanOptions

    Returns void

  • Parameters

    • hook: "startNavigationSpan"
    • options: StartSpanOptions

    Returns void

  • Parameters

    Returns PromiseLike<Event>

  • Parameters

    Returns PromiseLike<Event>

  • Parameters

    • Optionaltimeout: number

    Returns PromiseLike<boolean>

  • Returns undefined | DsnComponents

  • Get all installed event processors.

    Returns EventProcessor[]

  • Returns the client's instance of the given integration class, it any.

    Type Parameters

    • T extends Integration

    Parameters

    • integration: IntegrationClass<T>

    Returns null | T

    Use getIntegrationByName() instead.

  • Gets an installed integration by its id.

    Parameters

    • integrationId: string

    Returns undefined | Integration

    The installed integration or undefined if no integration with that id was installed.

    Use getIntegrationByName() instead.

  • Gets an installed integration by its name.

    Type Parameters

    • T extends Integration = Integration

    Parameters

    • integrationName: string

    Returns undefined | T

    The installed integration or undefined if no integration with that name was installed.

  • Returns NodeClientOptions

  • Returns undefined | SdkMetadata

    The metadata of the SDK

    SdkMetadata in @sentry/types

  • Returns undefined | Transport

  • Returns void

  • Method that initialises an instance of SessionFlusher on Client

    Returns void

  • Parameters

    • hook: "startTransaction"
    • callback: (transaction: Transaction) => void

    Returns void

  • Parameters

    • hook: "finishTransaction"
    • callback: (transaction: Transaction) => void

    Returns void

  • Parameters

    • hook: "beforeEnvelope"
    • callback: (envelope: Envelope) => void

    Returns void

  • Parameters

    • hook: "beforeSendEvent"
    • callback: (event: Event, hint?: EventHint) => void

    Returns void

  • Parameters

    • hook: "preprocessEvent"
    • callback: (event: Event, hint?: EventHint) => void

    Returns void

  • Parameters

    • hook: "afterSendEvent"
    • callback: (event: Event, sendResponse: void | TransportMakeRequestResponse) => void

    Returns void

  • Parameters

    Returns void

  • Parameters

    • hook: "createDsc"
    • callback: (dsc: DynamicSamplingContext) => void

    Returns void

  • Parameters

    • hook: "otelSpanEnd"
    • callback: (otelSpan: unknown, mutableOptions: { drop: boolean }) => void

    Returns void

  • Parameters

    • hook: "beforeSendFeedback"
    • callback: (feedback: FeedbackEvent, options?: { includeReplay: boolean }) => void

    Returns void

  • Parameters

    • hook: "startPageLoadSpan"
    • callback: (options: StartSpanOptions) => void

    Returns void

  • Parameters

    • hook: "startNavigationSpan"
    • callback: (options: StartSpanOptions) => void

    Returns void

  • Parameters

    • reason: EventDropReason
    • category: DataCategory
    • OptionaleventOrCount: number | Event

    Returns void

  • Parameters

    Returns void

  • Parameters

    • session: Session | SessionAggregates

    Returns void

  • This is an internal function to setup all integrations that should run on the client.

    Parameters

    • OptionalforceInitialize: boolean

    Returns void

    Use client.init() instead.