The Sentry Node SDK Client.

See

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

Hierarchy

Constructors

Properties

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

_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.

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

    • Optional timeout: 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 valid Dsn is present.

    Returns boolean

  • Adds common information to events.

    The information includes release and environment from options, breadcrumbs and context (extra, tags and user) from the scope.

    Information that is already present in the event is never overwritten. For nested objects, such as the context, keys are merged.

    Parameters

    • event: Event

      The original event.

    • hint: EventHint

      May contain additional information about the original exception.

    • Optional scope: Scope

      A scope containing event metadata.

    Returns PromiseLike<null | Event>

    A new event with more information.

  • 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.

    • Optional scope: 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>

    Inherit Doc

  • Updates existing session based on the provided event

    Parameters

    • session: Session
    • event: Event

    Returns void

  • Add an integration to the client. This can be used to e.g. lazy load integrations. In most cases, this should not be necessary, and you're better off just passing the integrations via integrations: [] at initialization time. However, if you find the need to conditionally load & add an integration, you can use addIntegration to do so.

    TODO (v8): Make this a required method.

    Parameters

    Returns void

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

    Parameters

    • checkIn: CheckIn

      An object that describes a check in.

    • Optional monitorConfig: MonitorConfig

    Returns string

    A string representing the id of the check in.

  • Captures a manually created event and sends it to Sentry.

    Parameters

    • event: Event

      The event to send to Sentry.

    • Optional hint: EventHint

      May contain additional information about the original exception.

    • Optional scope: Scope

      An optional scope containing event metadata.

    Returns undefined | string

    The event id

  • Captures an exception event and sends it to Sentry.

    Parameters

    • exception: any

      An exception-like object.

    • Optional hint: EventHint

      May contain additional information about the original exception.

    • Optional scope: Scope

      An optional scope containing event metadata.

    Returns undefined | string

    The event id

  • Captures a message event and sends it to Sentry.

    Parameters

    • message: string

      The message to send to Sentry.

    • Optional level: Severity | SeverityLevel

      Define the level of the message.

    • Optional hint: EventHint

      May contain additional information about the original exception.

    • Optional scope: Scope

      An optional scope containing event metadata.

    Returns undefined | string

    The event id

  • Captures a session

    Parameters

    • session: Session

      Session to be delivered

    Returns void

  • Flush the event queue and set the client to enabled = false. See flush.

    Parameters

    • Optional timeout: number

      Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause the client to wait until all events are sent before disabling itself.

    Returns PromiseLike<boolean>

    A promise which resolves to true if the flush completes successfully before the timeout, or false if it doesn't.

  • Fire a hook event for transaction start and finish. Expects to be given a transaction as the second argument.

    Parameters

    • hook: "startTransaction" | "finishTransaction"
    • transaction: Transaction

    Returns void

  • Fire a hook for when a breadcrumb is added. Expects the breadcrumb as second argument.

    Parameters

    • hook: "beforeEnvelope"
    • envelope: Envelope

    Returns void

  • Fire a hook for when a DSC (Dynamic Sampling Context) is created. Expects the DSC as second argument.

    Parameters

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

    Returns void

  • Parameters

    Returns void

    Inherit Doc

  • Parameters

    • hook: "createDsc"
    • dsc: DynamicSamplingContext

    Returns void

    Inherit Doc

  • Wait for all events to be sent or the timeout to expire, whichever comes first.

    Parameters

    • Optional timeout: number

      Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will cause the client to wait until all events are sent before resolving the promise.

    Returns PromiseLike<boolean>

    A promise that will resolve with true if all events are sent before the timeout, or false if there are still events in the queue when the timeout is reached.

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

    Type Parameters

    Parameters

    Returns null | T

  • 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.

  • Returns the current options.

    Returns NodeClientOptions

  • Returns undefined | SdkMetadata

    The metadata of the SDK

    See

    SdkMetadata in @sentry/types

  • Returns the transport that is used by the client. Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.

    Returns undefined | Transport

    The transport.

  • Method that initialises an instance of SessionFlusher on Client

    Returns void

  • Register a callback for transaction start and finish.

    Parameters

    • hook: "startTransaction" | "finishTransaction"
    • callback: ((transaction) => void)
        • (transaction): void
        • Parameters

          Returns void

    Returns void

  • Register a callback for transaction start and finish.

    Parameters

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

          • envelope: Envelope

          Returns void

    Returns void

  • Register a callback for when an event has been sent.

    Parameters

    • hook: "afterSendEvent"
    • callback: ((event, sendResponse) => void)
        • (event, sendResponse): void
        • Parameters

          • event: Event
          • sendResponse: void | TransportMakeRequestResponse

          Returns void

    Returns void

  • Register a callback before a breadcrumb is added.

    Parameters

    • hook: "beforeAddBreadcrumb"
    • callback: ((breadcrumb, hint?) => void)

    Returns void

  • Register a callback whena DSC (Dynamic Sampling Context) is created.

    Parameters

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

          • dsc: DynamicSamplingContext

          Returns void

    Returns void

  • Record on the client that an event got dropped (ie, an event that will not be sent to sentry).

    Parameters

    • reason: EventDropReason

      The reason why the event got dropped.

    • category: DataCategory
    • Optional _event: Event

      The dropped event.

    Returns void

  • Submits the event to Sentry

    Parameters

    Returns void

  • Submits the session to Sentry

    Parameters

    Returns void

  • Sets up the integrations

    Returns void

Generated using TypeDoc