@sentry/core

  • Version 7.44.2
  • Published
  • 899 kB
  • 3 dependencies
  • MIT license

Install

npm i @sentry/core
yarn add @sentry/core
pnpm add @sentry/core

Overview

Base implementation for all Sentry JavaScript SDKs

Index

Variables

Functions

Classes

Interfaces

Enums

Type Aliases

Namespaces

Variables

variable DEFAULT_ENVIRONMENT

const DEFAULT_ENVIRONMENT: string;

    variable SDK_VERSION

    const SDK_VERSION: string;

      variable TRACING_DEFAULTS

      const TRACING_DEFAULTS: {
      idleTimeout: number;
      finalTimeout: number;
      heartbeatInterval: number;
      };

        Functions

        function addBreadcrumb

        addBreadcrumb: (breadcrumb: Breadcrumb) => ReturnType<Hub['addBreadcrumb']>;
        • Records a new breadcrumb which will be attached to future events.

          Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.

          Parameter breadcrumb

          The breadcrumb to record.

        function addGlobalEventProcessor

        addGlobalEventProcessor: (callback: EventProcessor) => void;
        • Add a EventProcessor to be kept globally.

          Parameter callback

          EventProcessor to add

        function addTracingExtensions

        addTracingExtensions: () => void;
        • Adds tracing extensions to the global hub.

        function captureEvent

        captureEvent: (
        event: Event,
        hint?: EventHint
        ) => ReturnType<Hub['captureEvent']>;
        • Captures a manually created event and sends it to Sentry.

          Parameter event

          The event to send to Sentry.

          Returns

          The generated eventId.

        function captureException

        captureException: (
        exception: any,
        captureContext?: CaptureContext
        ) => ReturnType<Hub['captureException']>;
        • Captures an exception event and sends it to Sentry.

          Parameter exception

          An exception-like object.

          Parameter captureContext

          Additional scope data to apply to exception event.

          Returns

          The generated eventId.

        function captureMessage

        captureMessage: (
        message: string,
        captureContext?: CaptureContext | Severity | SeverityLevel
        ) => ReturnType<Hub['captureMessage']>;
        • Captures a message event and sends it to Sentry.

          Parameter message

          The message to send to Sentry.

          Parameter Severity

          Define the level of the message.

          Returns

          The generated eventId.

        function closeSession

        closeSession: (session: Session, status?: Exclude<SessionStatus, 'ok'>) => void;
        • Closes a session by setting its status and updating the session object with it. Internally calls updateSession to update the passed session object.

          Note that this function mutates the passed session (@see updateSession for explanation).

          Parameter session

          the Session object to be closed

          Parameter status

          the SessionStatus with which the session was closed. If you don't pass a status, this function will keep the previously set status, unless it was 'ok' in which case it is changed to 'exited'.

        function configureScope

        configureScope: (
        callback: (scope: Scope) => void
        ) => ReturnType<Hub['configureScope']>;
        • Callback to set context information onto the scope.

          Parameter callback

          Callback function that receives Scope.

        function createTransport

        createTransport: (
        options: InternalBaseTransportOptions,
        makeRequest: TransportRequestExecutor,
        buffer?: PromiseBuffer<any>
        ) => Transport;
        • Creates an instance of a Sentry Transport

          Parameter options

          Parameter makeRequest

        function getActiveTransaction

        getActiveTransaction: <T extends Transaction>(maybeHub?: Hub) => T | undefined;
        • Grabs active transaction off scope, if any

        function getCurrentHub

        getCurrentHub: () => Hub;
        • Returns the default hub instance.

          If a hub is already registered in the global carrier but this module contains a more recent version, it replaces the registered version. Otherwise, the currently registered hub will be returned.

        function getEnvelopeEndpointWithUrlEncodedAuth

        getEnvelopeEndpointWithUrlEncodedAuth: (
        dsn: DsnComponents,
        tunnelOrOptions?: string | ClientOptions
        ) => string;
        • Returns the envelope endpoint URL with auth in the query string.

          Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.

        function getHubFromCarrier

        getHubFromCarrier: (carrier: Carrier) => Hub;
        • This will create a new Hub and add to the passed object on __SENTRY__.hub.

          Parameter carrier

          object

        function getIntegrationsToSetup

        getIntegrationsToSetup: (options: Options) => Integration[];
        • Gets integrations to install

        function getMainCarrier

        getMainCarrier: () => Carrier;
        • Returns the global shim registry.

          FIXME: This function is problematic, because despite always returning a valid Carrier, it has an optional __SENTRY__ property, which then in turn requires us to always perform an unnecessary check at the call-site. We always access the carrier through this function, so we can guarantee that __SENTRY__ is there.

        function getReportDialogEndpoint

        getReportDialogEndpoint: (
        dsnLike: DsnLike,
        dialogOptions: { [key: string]: any; user?: { name?: string; email?: string } }
        ) => string;
        • Returns the url to the report dialog endpoint.

        function hasTracingEnabled

        hasTracingEnabled: (
        maybeOptions?:
        | Pick<Options, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'>
        | undefined
        ) => boolean;
        • Determines if tracing is currently enabled.

          Tracing is enabled when at least one of tracesSampleRate and tracesSampler is defined in the SDK config.

        function initAndBind

        initAndBind: <F extends Client, O extends ClientOptions>(
        clientClass: ClientClass<F, O>,
        options: O
        ) => void;
        • Internal function to create a new SDK client instance. The client is installed and then bound to the current scope.

          Parameter clientClass

          The client class to instantiate.

          Parameter options

          Options to pass to the client.

        function makeMain

        makeMain: (hub: Hub) => Hub;
        • Replaces the current main hub with the passed one on the global object

          Returns

          The old replaced hub

        function makeOfflineTransport

        makeOfflineTransport: <TO>(
        createTransport: (options: TO) => Transport
        ) => (options: TO & OfflineTransportOptions) => Transport;
        • Wraps a transport and stores and retries events when they fail to send.

          Parameter createTransport

          The transport to wrap.

        function makeSession

        makeSession: (context?: Omit<SessionContext, 'started' | 'status'>) => Session;
        • Creates a new Session object by setting certain default parameters. If optional

          Parameter context

          is passed, the passed properties are applied to the session object.

          Parameter context

          (optional) additional properties to be applied to the returned session object

          Returns

          a new Session object

        function prepareEvent

        prepareEvent: (
        options: ClientOptions,
        event: Event,
        hint: EventHint,
        scope?: Scope
        ) => PromiseLike<Event | null>;
        • 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.

          Note: This also triggers callbacks for addGlobalEventProcessor, but not beforeSend.

          Parameter event

          The original event.

          Parameter hint

          May contain additional information about the original exception.

          Parameter scope

          A scope containing event metadata.

          Returns

          A new event with more information.

        function setContext

        setContext: (
        name: string,
        context: { [key: string]: any }
        ) => ReturnType<Hub['setContext']>;
        • Sets context data with the given name.

          Parameter name

          of the context

          Parameter context

          Any kind of data. This data will be normalized.

        function setExtra

        setExtra: (key: string, extra: Extra) => ReturnType<Hub['setExtra']>;
        • Set key:value that will be sent as extra data with the event.

          Parameter key

          String of extra

          Parameter extra

          Any kind of data. This data will be normalized.

        function setExtras

        setExtras: (extras: Extras) => ReturnType<Hub['setExtras']>;
        • Set an object that will be merged sent as extra data with the event.

          Parameter extras

          Extras object to merge into current context.

        function setHubOnCarrier

        setHubOnCarrier: (carrier: Carrier, hub: Hub) => boolean;
        • This will set passed Hub on the passed object's __SENTRY__.hub attribute

          Parameter carrier

          object

          Parameter hub

          Hub

          Returns

          A boolean indicating success or failure

        function setTag

        setTag: (key: string, value: Primitive) => ReturnType<Hub['setTag']>;
        • Set key:value that will be sent as tags data with the event.

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

          Parameter key

          String key of tag

          Parameter value

          Value of tag

        function setTags

        setTags: (tags: { [key: string]: Primitive }) => ReturnType<Hub['setTags']>;
        • Set an object that will be merged sent as tags data with the event.

          Parameter tags

          Tags context object to merge into current context.

        function setUser

        setUser: (user: User | null) => ReturnType<Hub['setUser']>;
        • Updates user context information for future events.

          Parameter user

          User context object to be set in the current context. Pass null to unset the user.

        function spanStatusfromHttpCode

        spanStatusfromHttpCode: (httpStatus: number) => SpanStatusType;
        • Converts a HTTP status code into a SpanStatusType.

          Parameter httpStatus

          The HTTP response status code.

          Returns

          The span status or unknown_error.

        function startIdleTransaction

        startIdleTransaction: (
        hub: Hub,
        transactionContext: TransactionContext,
        idleTimeout: number,
        finalTimeout: number,
        onScope?: boolean,
        customSamplingContext?: CustomSamplingContext,
        heartbeatInterval?: number
        ) => IdleTransaction;
        • Create new idle transaction.

        function startTransaction

        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 .finish() method, at which point the transaction with all its finished child spans will be sent to Sentry.

          NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call startTransaction directly on the hub.

          Parameter context

          Properties of the new Transaction.

          Parameter customSamplingContext

          Information given to the transaction sampling function (along with context-dependent default values). See Options.tracesSampler.

          Returns

          The transaction which was just started

        function updateSession

        updateSession: (session: Session, context?: SessionContext) => void;
        • Updates a session object with the properties passed in the context.

          Note that this function mutates the passed object and returns void. (Had to do this instead of returning a new and updated session because closing and sending a session makes an update to the session after it was passed to the sending logic.

          Parameter session

          the Session to update

          Parameter context

          the SessionContext holding the properties that should be updated in

          Parameter session

          See Also

          • BaseClient.captureSession )

        function withScope

        withScope: (callback: (scope: Scope) => void) => ReturnType<Hub['withScope']>;
        • Creates a new scope with and executes the given operation within. The scope is automatically removed once the operation finishes or throws.

          This is essentially a convenience function for:

          pushScope(); callback(); popScope();

          Parameter callback

          that will be enclosed into push/popScope.

        Classes

        class BaseClient

        abstract class BaseClient<O extends ClientOptions> implements Client<O> {}
        • Base implementation for all JavaScript SDK clients.

          Call the constructor with the corresponding options specific to the client subclass. To access these options later, use Client.getOptions.

          If a Dsn is specified in the options, it will be parsed and stored. Use Client.getDsn to retrieve the Dsn at any moment. In case the Dsn is invalid, the constructor will throw a SentryException. Note that without a valid Dsn, the SDK will not send any events to Sentry.

          Before sending an event, it is passed through BaseClient._prepareEvent to add SDK information and scope data (breadcrumbs and context). To add more custom information, override this method and extend the resulting prepared event.

          To issue automatically created events (e.g. via instrumentation), use Client.captureEvent. It will prepare the event and pass it through the callback lifecycle. To issue auto-breadcrumbs, use Client.addBreadcrumb.

          Example 1

          class NodeClient extends BaseClient { public constructor(options: NodeOptions) { super(options); }

          // ... }

        constructor

        protected constructor(options: ClientOptions);
        • Initializes this client instance.

          Parameter options

          Options for the client.

        method addIntegration

        addIntegration: (integration: Integration) => void;

        method captureEvent

        captureEvent: (
        event: Event,
        hint?: EventHint,
        scope?: Scope
        ) => string | undefined;

        method captureException

        captureException: (
        exception: any,
        hint?: EventHint,
        scope?: Scope
        ) => string | undefined;

        method captureMessage

        captureMessage: (
        message: string,
        level?: Severity | SeverityLevel,
        hint?: EventHint,
        scope?: Scope
        ) => string | undefined;

        method captureSession

        captureSession: (session: Session) => void;

        method close

        close: (timeout?: number) => PromiseLike<boolean>;

        method emit

        emit: {
        (
        hook: 'startTransaction' | 'finishTransaction',
        transaction: Transaction
        ): void;
        (hook: 'beforeEnvelope', envelope: Envelope): void;
        (hook: 'afterSendEvent', event: Event, sendResponse: any): void;
        (
        hook: 'beforeAddBreadcrumb',
        breadcrumb: Breadcrumb,
        hint?: BreadcrumbHint
        ): void;
        };

        method eventFromException

        abstract eventFromException: (
        _exception: any,
        _hint?: EventHint
        ) => PromiseLike<Event>;

        method eventFromMessage

        abstract eventFromMessage: (
        _message: string,
        _level?: Severity | SeverityLevel,
        _hint?: EventHint
        ) => PromiseLike<Event>;

        method flush

        flush: (timeout?: number) => PromiseLike<boolean>;

        method getDsn

        getDsn: () => DsnComponents | undefined;

        method getIntegration

        getIntegration: <T extends Integration>(
        integration: IntegrationClass<T>
        ) => T | null;

        method getIntegrationById

        getIntegrationById: (integrationId: string) => Integration | undefined;
        • Gets an installed integration by its id.

          Returns

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

        method getOptions

        getOptions: () => O;

        method getSdkMetadata

        getSdkMetadata: () => SdkMetadata | undefined;
        • See Also

          • SdkMetadata in @sentry/types

            The metadata of the SDK

        method getTransport

        getTransport: () => Transport | undefined;

        method on

        on: {
        (
        hook: 'startTransaction' | 'finishTransaction',
        callback: (transaction: Transaction) => void
        ): void;
        (hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): void;
        (
        hook: 'afterSendEvent',
        callback: (event: Event, sendResponse: any) => void
        ): void;
        (
        hook: 'beforeAddBreadcrumb',
        callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void
        ): void;
        };

        method recordDroppedEvent

        recordDroppedEvent: (
        reason: EventDropReason,
        category: DataCategory,
        _event?: Event
        ) => void;

        method sendEvent

        sendEvent: (event: Event, hint?: EventHint) => void;

        method sendSession

        sendSession: (session: Session | SessionAggregates) => void;

        method setupIntegrations

        setupIntegrations: () => void;
        • Sets up the integrations

        class FunctionToString

        class FunctionToString implements Integration {}
        • Patch toString calls to return proper name for wrapped functions

        property id

        static id: string;

        property name

        name: string;

        method setupOnce

        setupOnce: () => void;

        class Hub

        class Hub implements HubInterface {}

        constructor

        constructor(client?: Client, scope?: Scope, _version?: number);
        • Creates a new instance of the hub, will push one Layer into the internal stack on creation.

          Parameter client

          bound to the hub.

          Parameter scope

          bound to the hub.

          Parameter version

          number, higher number means higher priority.

        method addBreadcrumb

        addBreadcrumb: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void;

        method bindClient

        bindClient: (client?: Client) => void;

        method captureEvent

        captureEvent: (event: Event, hint?: EventHint) => string;

        method captureException

        captureException: (exception: unknown, hint?: EventHint) => string;

        method captureMessage

        captureMessage: (
        message: string,
        level?: Severity | SeverityLevel,
        hint?: EventHint
        ) => string;

        method captureSession

        captureSession: (endSession?: boolean) => void;

        method configureScope

        configureScope: (callback: (scope: Scope) => void) => void;

        method endSession

        endSession: () => void;

        method getClient

        getClient: <C extends Client>() => C | undefined;

        method getIntegration

        getIntegration: <T extends Integration>(
        integration: IntegrationClass<T>
        ) => T | null;

        method getScope

        getScope: () => Scope | undefined;
        • Returns the scope of the top stack.

        method getStack

        getStack: () => Layer[];
        • Returns the scope stack for domains or the process.

        method getStackTop

        getStackTop: () => Layer;
        • Returns the topmost scope layer in the order domain > local > process.

        method isOlderThan

        isOlderThan: (version: number) => boolean;

        method lastEventId

        lastEventId: () => string | undefined;

        method popScope

        popScope: () => boolean;

        method pushScope

        pushScope: () => Scope;

        method run

        run: (callback: (hub: Hub) => void) => void;

        method setContext

        setContext: (name: string, context: { [key: string]: any }) => void;

        method setExtra

        setExtra: (key: string, extra: Extra) => void;

        method setExtras

        setExtras: (extras: Extras) => void;

        method setTag

        setTag: (key: string, value: Primitive) => void;

        method setTags

        setTags: (tags: { [key: string]: Primitive }) => void;

        method setUser

        setUser: (user: User | null) => void;

        method shouldSendDefaultPii

        shouldSendDefaultPii: () => boolean;
        • Returns if default PII should be sent to Sentry and propagated in ourgoing requests when Tracing is used.

        method startSession

        startSession: (context?: SessionContext) => Session;

        method startTransaction

        startTransaction: (
        context: TransactionContext,
        customSamplingContext?: CustomSamplingContext
        ) => Transaction;

        method traceHeaders

        traceHeaders: () => { [key: string]: string };

        method withScope

        withScope: (callback: (scope: Scope) => void) => void;

        class IdleTransaction

        class IdleTransaction extends Transaction {}
        • An IdleTransaction is a transaction that automatically finishes. It does this by tracking child spans as activities. You can have multiple IdleTransactions active, but if the onScope option is specified, the idle transaction will put itself on the scope on creation.

        constructor

        constructor(
        transactionContext: TransactionContext,
        _idleHub: Hub,
        _idleTimeout?: number,
        _finalTimeout?: number,
        _heartbeatInterval?: number,
        _onScope?: boolean
        );

          property activities

          activities: Record<string, boolean>;

            method cancelIdleTimeout

            cancelIdleTimeout: (
            endTimestamp?: Parameters<IdleTransaction['finish']>[0],
            { restartOnChildSpanChange }?: { restartOnChildSpanChange?: boolean }
            ) => void;
            • Cancels the existing idle timeout, if there is one.

              Parameter restartOnChildSpanChange

              Default is true. If set to false the transaction will end with the last child span.

            method finish

            finish: (endTimestamp?: number) => string | undefined;

            method initSpanRecorder

            initSpanRecorder: (maxlen?: number) => void;

            method registerBeforeFinishCallback

            registerBeforeFinishCallback: (callback: BeforeFinishCallback) => void;
            • Register a callback function that gets excecuted before the transaction finishes. Useful for cleanup or if you want to add any additional spans based on current context.

              This is exposed because users have no other way of running something before an idle transaction finishes.

            class InboundFilters

            class InboundFilters implements Integration {}
            • Inbound filters configurable by the user

            constructor

            constructor(_options?: Partial<InboundFiltersOptions>);

              property id

              static id: string;

              property name

              name: string;

              method setupOnce

              setupOnce: (
              addGlobalEventProcessor: (processor: EventProcessor) => void,
              getCurrentHub: () => Hub
              ) => void;

              class Scope

              class Scope implements ScopeInterface {}
              • Holds additional event information. Scope.applyToEvent will be called by the client before an event will be sent.

              constructor

              constructor();

                method addAttachment

                addAttachment: (attachment: Attachment) => this;

                method addBreadcrumb

                addBreadcrumb: (breadcrumb: Breadcrumb, maxBreadcrumbs?: number) => this;

                method addEventProcessor

                addEventProcessor: (callback: EventProcessor) => this;

                method addScopeListener

                addScopeListener: (callback: (scope: Scope) => void) => void;
                • Add internal on change listener. Used for sub SDKs that need to store the scope.

                method applyToEvent

                applyToEvent: (event: Event, hint?: EventHint) => PromiseLike<Event | null>;
                • Applies data from the scope to the event and runs all event processors on it.

                  Parameter event

                  Event

                  Parameter hint

                  Object containing additional information about the original exception, for use by the event processors.

                method clear

                clear: () => this;

                method clearAttachments

                clearAttachments: () => this;

                method clearBreadcrumbs

                clearBreadcrumbs: () => this;

                method clone

                static clone: (scope?: Scope) => Scope;
                • Inherit values from the parent scope.

                  Parameter scope

                  to clone.

                method getAttachments

                getAttachments: () => Attachment[];

                method getLastBreadcrumb

                getLastBreadcrumb: () => Breadcrumb | undefined;

                method getRequestSession

                getRequestSession: () => RequestSession | undefined;

                method getSession

                getSession: () => Session | undefined;

                method getSpan

                getSpan: () => Span | undefined;

                method getTransaction

                getTransaction: () => Transaction | undefined;

                method getUser

                getUser: () => User | undefined;

                method setContext

                setContext: (key: string, context: Context | null) => this;

                method setExtra

                setExtra: (key: string, extra: Extra) => this;

                method setExtras

                setExtras: (extras: Extras) => this;

                method setFingerprint

                setFingerprint: (fingerprint: string[]) => this;

                method setLevel

                setLevel: (level: Severity | SeverityLevel) => this;

                method setRequestSession

                setRequestSession: (requestSession?: RequestSession) => this;

                method setSDKProcessingMetadata

                setSDKProcessingMetadata: (newData: { [key: string]: unknown }) => this;
                • Add data which will be accessible during event processing but won't get sent to Sentry

                method setSession

                setSession: (session?: Session) => this;

                method setSpan

                setSpan: (span?: Span) => this;

                method setTag

                setTag: (key: string, value: Primitive) => this;

                method setTags

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

                method setTransactionName

                setTransactionName: (name?: string) => this;

                method setUser

                setUser: (user: User | null) => this;

                method update

                update: (captureContext?: CaptureContext) => this;

                class SessionFlusher

                class SessionFlusher implements SessionFlusherLike {}

                constructor

                constructor(client: Client, attrs: ReleaseHealthAttributes);

                  property flushTimeout

                  readonly flushTimeout: number;

                    method close

                    close: () => void;
                    • JSDoc

                    method flush

                    flush: () => void;
                    • Checks if pendingAggregates has entries, and if it does flushes them by calling sendSession

                    method getSessionAggregates

                    getSessionAggregates: () => SessionAggregates;
                    • Massages the entries in pendingAggregates and returns aggregated sessions

                    method incrementSessionStatusCount

                    incrementSessionStatusCount: () => void;
                    • Wrapper function for _incrementSessionStatusCount that checks if the instance of SessionFlusher is enabled then fetches the session status of the request from Scope.getRequestSession().status on the scope and passes them to _incrementSessionStatusCount along with the start date

                    class Span

                    class Span implements SpanInterface {}
                    • Span contains all data about a span

                    property data

                    data: { [key: string]: any };

                    property description

                    description?: string;

                    property endTimestamp

                    endTimestamp?: number;
                    • Timestamp in seconds when the span ended.

                    property instrumenter

                    instrumenter: Instrumenter;
                    • The instrumenter that created this span.

                    property op

                    op?: string;

                    property parentSpanId

                    parentSpanId?: string;

                    property sampled

                    sampled?: boolean;

                    property spanId

                    spanId: string;

                    property spanRecorder

                    spanRecorder?: SpanRecorder;
                    • List of spans that were finalized

                    property startTimestamp

                    startTimestamp: number;
                    • Timestamp in seconds when the span was created.

                    property status

                    status?: string;
                    • Internal keeper of the status

                    property tags

                    tags: { [key: string]: Primitive };

                    property traceId

                    traceId: string;

                    property transaction

                    transaction?: Transaction;

                    method finish

                    finish: (endTimestamp?: number) => void;

                    method getTraceContext

                    getTraceContext: () => TraceContext;

                    method isSuccess

                    isSuccess: () => boolean;

                    method setData

                    setData: (key: string, value: any) => this;

                    method setHttpStatus

                    setHttpStatus: (httpStatus: number) => this;

                    method setStatus

                    setStatus: (value: SpanStatusType) => this;

                    method setTag

                    setTag: (key: string, value: Primitive) => this;

                    method startChild

                    startChild: (
                    spanContext?: Pick<
                    SpanContext,
                    Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>
                    >
                    ) => Span;

                    method toContext

                    toContext: () => SpanContext;

                    method toJSON

                    toJSON: () => {
                    data?: { [key: string]: any };
                    description?: string;
                    op?: string;
                    parent_span_id?: string;
                    span_id: string;
                    start_timestamp: number;
                    status?: string;
                    tags?: { [key: string]: Primitive };
                    timestamp?: number;
                    trace_id: string;
                    };

                    method toTraceparent

                    toTraceparent: () => string;

                    method updateWithContext

                    updateWithContext: (spanContext: SpanContext) => this;

                    class Transaction

                    class Transaction extends SpanClass implements TransactionInterface {}
                    • JSDoc

                    property metadata

                    metadata: TransactionMetadata;

                      property name

                      name: string;
                      • Getter for name property

                      method finish

                      finish: (endTimestamp?: number) => string | undefined;

                      method getDynamicSamplingContext

                      getDynamicSamplingContext: () => DynamicSamplingContext;
                      • Modifiers

                        • @experimental

                      method initSpanRecorder

                      initSpanRecorder: (maxlen?: number) => void;
                      • Attaches SpanRecorder to the span itself

                        Parameter maxlen

                        maximum number of spans that can be recorded

                      method setContext

                      setContext: (key: string, context: Context | null) => void;

                      method setMeasurement

                      setMeasurement: (name: string, value: number, unit?: MeasurementUnit) => void;

                      method setMetadata

                      setMetadata: (newMetadata: TransactionMetadata) => void;

                      method setName

                      setName: (name: string, source?: TransactionMetadata) => void;
                      • JSDoc

                      method toContext

                      toContext: () => TransactionContext;

                      method updateWithContext

                      updateWithContext: (transactionContext: TransactionContext) => this;

                      Interfaces

                      interface Carrier

                      interface Carrier {}
                      • An object that contains a hub and maintains a scope stack.

                      interface Layer

                      interface Layer {}
                      • A layer in the process stack.

                      property client

                      client?: Client;

                        property scope

                        scope?: Scope;

                          interface OfflineStore

                          interface OfflineStore {}

                            method insert

                            insert: (env: Envelope) => Promise<void>;

                              method pop

                              pop: () => Promise<Envelope | undefined>;

                                interface OfflineTransportOptions

                                interface OfflineTransportOptions extends InternalBaseTransportOptions {}

                                  property createStore

                                  createStore?: CreateOfflineStore;
                                  • A function that creates the offline store instance.

                                  property flushAtStartup

                                  flushAtStartup?: boolean;
                                  • Flush the offline store shortly after startup.

                                    Defaults: false

                                  property shouldStore

                                  shouldStore?: (
                                  envelope: Envelope,
                                  error: Error,
                                  retryDelay: number
                                  ) => boolean | Promise<boolean>;
                                  • Called before an event is stored.

                                    Return false to drop the envelope rather than store it.

                                    Parameter envelope

                                    The envelope that failed to send.

                                    Parameter error

                                    The error that occurred.

                                    Parameter retryDelay

                                    The current retry delay in milliseconds.

                                  Enums

                                  enum SpanStatus

                                  enum SpanStatus {
                                  Ok = 'ok',
                                  DeadlineExceeded = 'deadline_exceeded',
                                  Unauthenticated = 'unauthenticated',
                                  PermissionDenied = 'permission_denied',
                                  NotFound = 'not_found',
                                  ResourceExhausted = 'resource_exhausted',
                                  InvalidArgument = 'invalid_argument',
                                  Unimplemented = 'unimplemented',
                                  Unavailable = 'unavailable',
                                  InternalError = 'internal_error',
                                  UnknownError = 'unknown_error',
                                  Cancelled = 'cancelled',
                                  AlreadyExists = 'already_exists',
                                  FailedPrecondition = 'failed_precondition',
                                  Aborted = 'aborted',
                                  OutOfRange = 'out_of_range',
                                  DataLoss = 'data_loss',
                                  }
                                  • The status of an Span.

                                    Deprecated

                                    Use string literals - if you require type casting, cast to SpanStatusType type

                                  member Aborted

                                  Aborted = 'aborted'
                                  • The operation was aborted, typically due to a concurrency issue.

                                  member AlreadyExists

                                  AlreadyExists = 'already_exists'
                                  • Already exists (409)

                                  member Cancelled

                                  Cancelled = 'cancelled'
                                  • The operation was cancelled (typically by the user).

                                  member DataLoss

                                  DataLoss = 'data_loss'
                                  • Unrecoverable data loss or corruption

                                  member DeadlineExceeded

                                  DeadlineExceeded = 'deadline_exceeded'
                                  • Deadline expired before operation could complete.

                                  member FailedPrecondition

                                  FailedPrecondition = 'failed_precondition'
                                  • Operation was rejected because the system is not in a state required for the operation's

                                  member InternalError

                                  InternalError = 'internal_error'
                                  • Other/generic 5xx.

                                  member InvalidArgument

                                  InvalidArgument = 'invalid_argument'
                                  • Client specified an invalid argument. 4xx.

                                  member NotFound

                                  NotFound = 'not_found'
                                  • 404 Not Found. Some requested entity (file or directory) was not found.

                                  member Ok

                                  Ok = 'ok'
                                  • The operation completed successfully.

                                  member OutOfRange

                                  OutOfRange = 'out_of_range'
                                  • Operation was attempted past the valid range.

                                  member PermissionDenied

                                  PermissionDenied = 'permission_denied'
                                  • 403 Forbidden

                                  member ResourceExhausted

                                  ResourceExhausted = 'resource_exhausted'
                                  • 429 Too Many Requests

                                  member Unauthenticated

                                  Unauthenticated = 'unauthenticated'
                                  • 401 Unauthorized (actually does mean unauthenticated according to RFC 7235)

                                  member Unavailable

                                  Unavailable = 'unavailable'
                                  • 503 Service Unavailable

                                  member Unimplemented

                                  Unimplemented = 'unimplemented'
                                  • 501 Not Implemented

                                  member UnknownError

                                  UnknownError = 'unknown_error'
                                  • Unknown. Any non-standard HTTP status code.

                                  Type Aliases

                                  type ClientClass

                                  type ClientClass<F extends Client, O extends ClientOptions> = new (options: O) => F;
                                  • A class object that can instantiate Client objects.

                                  type SpanStatusType

                                  type SpanStatusType =
                                  /** The operation completed successfully. */
                                  | 'ok'
                                  /** Deadline expired before operation could complete. */
                                  | 'deadline_exceeded'
                                  /** 401 Unauthorized (actually does mean unauthenticated according to RFC 7235) */
                                  | 'unauthenticated'
                                  /** 403 Forbidden */
                                  | 'permission_denied'
                                  /** 404 Not Found. Some requested entity (file or directory) was not found. */
                                  | 'not_found'
                                  /** 429 Too Many Requests */
                                  | 'resource_exhausted'
                                  /** Client specified an invalid argument. 4xx. */
                                  | 'invalid_argument'
                                  /** 501 Not Implemented */
                                  | 'unimplemented'
                                  /** 503 Service Unavailable */
                                  | 'unavailable'
                                  /** Other/generic 5xx. */
                                  | 'internal_error'
                                  /** Unknown. Any non-standard HTTP status code. */
                                  | 'unknown_error'
                                  /** The operation was cancelled (typically by the user). */
                                  | 'cancelled'
                                  /** Already exists (409) */
                                  | 'already_exists'
                                  /** Operation was rejected because the system is not in a state required for the operation's */
                                  | 'failed_precondition'
                                  /** The operation was aborted, typically due to a concurrency issue. */
                                  | 'aborted'
                                  /** Operation was attempted past the valid range. */
                                  | 'out_of_range'
                                  /** Unrecoverable data loss or corruption */
                                  | 'data_loss';

                                    Namespaces

                                    namespace Integrations

                                    module 'types/integrations/index.d.ts' {}

                                      class FunctionToString

                                      class FunctionToString implements Integration {}
                                      • Patch toString calls to return proper name for wrapped functions

                                      property id

                                      static id: string;

                                      property name

                                      name: string;

                                      method setupOnce

                                      setupOnce: () => void;

                                      class InboundFilters

                                      class InboundFilters implements Integration {}
                                      • Inbound filters configurable by the user

                                      constructor

                                      constructor(_options?: Partial<InboundFiltersOptions>);

                                        property id

                                        static id: string;

                                        property name

                                        name: string;

                                        method setupOnce

                                        setupOnce: (
                                        addGlobalEventProcessor: (processor: EventProcessor) => void,
                                        getCurrentHub: () => Hub
                                        ) => void;

                                        Package Files (25)

                                        Dependencies (3)

                                        Dev Dependencies (0)

                                        No dev dependencies.

                                        Peer Dependencies (0)

                                        No peer dependencies.

                                        Badge

                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@sentry/core.

                                        • Markdown
                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@sentry/core)
                                        • HTML
                                          <a href="https://www.jsdocs.io/package/@sentry/core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>