User-Facing Sentry SDK Client.

This interface contains all methods to interface with the SDK once it has been installed. It allows to send events to Sentry, record breadcrumbs and set a context included in every event. Since the SDK mutates its environment, there will only be one instance during runtime.

Type Parameters

  • O extends ClientOptions = ClientOptions

Hierarchy

  • Client

Implemented by

Methods

  • 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. This method is not available on all clients.

    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: SeverityLevel | Severity

      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

    Returns void

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

    Parameters

    • hook: "createDsc"
    • dsc: DynamicSamplingContext

    Returns void

  • Creates an Event from all inputs to captureException and non-primitive inputs to captureMessage.

    Parameters

    Returns PromiseLike<Event>

  • Creates an Event from primitive inputs to captureMessage.

    Parameters

    Returns PromiseLike<Event>

  • 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

  • Returns the current options.

    Returns O

  • Returns undefined | SdkMetadata

    Inherit Doc

    (v8): Make this a required method.

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

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

    • dataCategory: DataCategory
    • Optional event: Event

      The dropped event.

    Returns void

  • Submits the event to Sentry

    Parameters

    Returns void

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

    Returns void

Generated using TypeDoc