Takaro - v0.6.0
    Preparing search index...

    Interface NodeOptions

    Configuration options for the Sentry Node SDK

    @sentry/core Options for more information.

    interface NodeOptions {
        _experiments?: {
            beforeSendMetric?: (metric: Metric) => Metric | null;
            enableLogs?: boolean;
            enableMetrics?: boolean;
            [key: string]: any;
        };
        _metadata?: SdkMetadata;
        allowUrls?: (string | RegExp)[];
        attachStacktrace?: boolean;
        beforeBreadcrumb?: (
            breadcrumb: Breadcrumb,
            hint?: BreadcrumbHint,
        ) => Breadcrumb | null;
        beforeSend?: (
            event: ErrorEvent,
            hint: EventHint,
        ) => ErrorEvent | PromiseLike<ErrorEvent | null> | null;
        beforeSendLog?: (log: Log) => Log | null;
        beforeSendMetric?: (metric: Metric) => Metric | null;
        beforeSendSpan?: (span: SpanJSON) => SpanJSON;
        beforeSendTransaction?: (
            event: TransactionEvent,
            hint: EventHint,
        ) => TransactionEvent | PromiseLike<TransactionEvent | null> | null;
        clientReportFlushInterval?: number;
        debug?: boolean;
        defaultIntegrations?: false | Integration[];
        denyUrls?: (string | RegExp)[];
        disableInstrumentationWarnings?: boolean;
        dist?: string;
        dsn?: string;
        enabled?: boolean;
        enableLogs?: boolean;
        enableMetrics?: boolean;
        enhanceFetchErrorMessages?: false | "always" | "report-only";
        environment?: string;
        ignoreErrors?: (string | RegExp)[];
        ignoreSpans?: (string | RegExp | IgnoreSpanFilter)[];
        ignoreTransactions?: (string | RegExp)[];
        includeLocalVariables?: boolean;
        includeServerName?: boolean;
        initialScope?: CaptureContext;
        integrations?:
            | Integration[]
            | ((integrations: Integration[]) => Integration[]);
        maxBreadcrumbs?: number;
        maxSpanWaitDuration?: number;
        maxValueLength?: number;
        normalizeDepth?: number;
        normalizeMaxBreadth?: number;
        openTelemetryInstrumentations?: Instrumentation<InstrumentationConfig>[];
        openTelemetrySpanProcessors?: SpanProcessor[];
        orgId?: number | `${number}`;
        parentSpanIsAlwaysRootSpan?: boolean;
        profileLifecycle?: "manual" | "trace";
        profileSessionSampleRate?: number;
        profilesSampler?: (samplingContext: SamplingContext) => number | boolean;
        profilesSampleRate?: number;
        propagateTraceparent?: boolean;
        registerEsmLoaderHooks?: boolean;
        release?: string;
        sampleRate?: number;
        sendClientReports?: boolean;
        sendDefaultPii?: boolean;
        serverName?: string;
        shutdownTimeout?: number;
        skipOpenTelemetrySetup?: boolean;
        spotlight?: string | boolean;
        stackParser?: StackParser | StackLineParser[];
        strictTraceContinuation?: boolean;
        tracePropagationTargets?: TracePropagationTargets;
        tracesSampler?: (
            samplingContext: TracesSamplerSamplingContext,
        ) => number | boolean;
        tracesSampleRate?: number;
        transport?: (transportOptions: NodeTransportOptions) => Transport;
        transportOptions?: Partial<NodeTransportOptions>;
        tunnel?: string;
        onFatalError?(this: void, error: Error): void;
    }

    Hierarchy

    • CoreOptions<NodeTransportOptions>
    • BaseNodeOptions
      • NodeOptions
    Index

    Properties

    _experiments?: {
        beforeSendMetric?: (metric: Metric) => Metric | null;
        enableLogs?: boolean;
        enableMetrics?: boolean;
        [key: string]: any;
    }

    Options which are in beta, or otherwise not guaranteed to be stable.

    Type Declaration

    • [key: string]: any
    • Optional ExperimentalbeforeSendMetric?: (metric: Metric) => Metric | null

      An event-processing callback for metrics, guaranteed to be invoked after all other metric processors. This allows a metric to be modified or dropped before it's sent.

      Note that you must return a valid metric from this callback. If you do not wish to modify the metric, simply return it at the end. Returning null will cause the metric to be dropped.

      undefined
      @experimental

      Use the top levelbeforeSendMetric option instead.

    • OptionalenableLogs?: boolean

      Determines if logs support should be enabled.

      false
      

      Use the top level enableLogs option instead.

    • Optional ExperimentalenableMetrics?: boolean

      If metrics support should be enabled.

      false
      @experimental

      Use the top levelenableMetrics option instead.

    _metadata?: SdkMetadata

    Set of metadata about the SDK that can be internally used to enhance envelopes and events, and provide additional data about every request.

    This option is not part of the public API and is subject to change at any time.

    allowUrls?: (string | RegExp)[]

    A pattern for error URLs which should exclusively be sent to Sentry. This is the opposite of CoreOptions.denyUrls. By default, all errors will be sent.

    Behavior of the allowUrls option is controlled by the Sentry.eventFiltersIntegration integration. If the event filters integration is not installed, the allowUrls option will not have any effect.

    []
    
    attachStacktrace?: boolean

    When enabled, stack traces are automatically attached to all events captured with Sentry.captureMessage.

    Grouping in Sentry is different for events with stack traces and without. As a result, you will get new groups as you enable or disable this flag for certain events.

    false
    
    beforeBreadcrumb?: (
        breadcrumb: Breadcrumb,
        hint?: BreadcrumbHint,
    ) => Breadcrumb | null

    A callback invoked when adding a breadcrumb, allowing to optionally modify it before adding it to future events.

    Note that you must return a valid breadcrumb from this callback. If you do not wish to modify the breadcrumb, simply return it at the end. Returning null will cause the breadcrumb to be dropped.

    Type Declaration

    beforeSend?: (
        event: ErrorEvent,
        hint: EventHint,
    ) => ErrorEvent | PromiseLike<ErrorEvent | null> | null

    An event-processing callback for error and message events, guaranteed to be invoked after all other event processors, which allows an event to be modified or dropped.

    Note that you must return a valid event from this callback. If you do not wish to modify the event, simply return it at the end. Returning null will cause the event to be dropped.

    Type Declaration

    beforeSendLog?: (log: Log) => Log | null

    An event-processing callback for logs, guaranteed to be invoked after all other log processors. This allows a log to be modified or dropped before it's sent.

    Note that you must return a valid log from this callback. If you do not wish to modify the log, simply return it at the end. Returning null will cause the log to be dropped.

    Type Declaration

      • (log: Log): Log | null
      • Parameters

        • log: Log

          The log generated by the SDK.

        Returns Log | null

        A new log that will be sent | null.

    undefined
    
    beforeSendMetric?: (metric: Metric) => Metric | null

    An event-processing callback for metrics, guaranteed to be invoked after all other metric processors. This allows a metric to be modified or dropped before it's sent.

    Note that you must return a valid metric from this callback. If you do not wish to modify the metric, simply return it at the end. Returning null will cause the metric to be dropped.

    Type Declaration

      • (metric: Metric): Metric | null
      • Parameters

        • metric: Metric

          The metric generated by the SDK.

        Returns Metric | null

        A new metric that will be sent | null.

    undefined
    
    beforeSendSpan?: (span: SpanJSON) => SpanJSON

    This function can be defined to modify a child span before it's sent.

    Type Declaration

      • (span: SpanJSON): SpanJSON
      • Parameters

        • span: SpanJSON

          The span generated by the SDK.

        Returns SpanJSON

        The modified span payload that will be sent.

    beforeSendTransaction?: (
        event: TransactionEvent,
        hint: EventHint,
    ) => TransactionEvent | PromiseLike<TransactionEvent | null> | null

    An event-processing callback for transaction events, guaranteed to be invoked after all other event processors. This allows an event to be modified or dropped before it's sent.

    Note that you must return a valid event from this callback. If you do not wish to modify the event, simply return it at the end. Returning null will cause the event to be dropped.

    Type Declaration

      • (
            event: TransactionEvent,
            hint: EventHint,
        ): TransactionEvent | PromiseLike<TransactionEvent | null> | null
      • Parameters

        • event: TransactionEvent

          The error or message event generated by the SDK.

        • hint: EventHint

          Event metadata useful for processing.

        Returns TransactionEvent | PromiseLike<TransactionEvent | null> | null

        A new event that will be sent | null.

    clientReportFlushInterval?: number

    Configures in which interval client reports will be flushed. Defaults to 60_000 (milliseconds).

    debug?: boolean

    Enable debug functionality in the SDK itself. If debug is set to true the SDK will attempt to print out useful debugging information about what the SDK is doing.

    false
    
    defaultIntegrations?: false | Integration[]

    If this is set to false, default integrations will not be added, otherwise this will internally be set to the recommended default integrations.

    denyUrls?: (string | RegExp)[]

    A pattern for error URLs which should not be sent to Sentry. To allow certain errors instead, use CoreOptions.allowUrls. By default, all errors will be sent.

    Behavior of the denyUrls option is controlled by the Sentry.eventFiltersIntegration integration. If the event filters integration is not installed, the denyUrls option will not have any effect.

    []
    
    disableInstrumentationWarnings?: boolean

    By default, the SDK will try to identify problems with your instrumentation setup and warn you about it. If you want to disable these warnings, set this to true.

    dist?: string

    Sets the distribution of the application. Distributions are used to disambiguate build or deployment variants of the same release of an application.

    undefined
    
    dsn?: string

    The DSN tells the SDK where to send the events. If this is not set, the SDK will not send any events to Sentry.

    undefined
    
    enabled?: boolean

    Specifies whether this SDK should send events to Sentry. Setting this to enabled: false doesn't prevent all overhead from Sentry instrumentation. To disable Sentry completely, depending on environment, call `Sentry.init conditionally.

    true
    
    enableLogs?: boolean

    If logs support should be enabled.

    false
    
    enableMetrics?: boolean

    If metrics support should be enabled.

    true
    
    enhanceFetchErrorMessages?: false | "always" | "report-only"

    Controls whether and how to enhance fetch error messages by appending the request hostname. Generic fetch errors like "Failed to fetch" will be enhanced to include the hostname (e.g., "Failed to fetch (example.com)").

    • 'always' (default): Modifies the actual error message directly. This may break third-party packages that rely on exact message matching (e.g., is-network-error, p-retry).
    • 'report-only': Only enhances the message when sending to Sentry. The original error message remains unchanged, preserving compatibility with third-party packages.
    • false: Disables hostname enhancement completely.
    'always'
    
    environment?: string

    The current environment of your application (e.g. "production").

    Environments are case-sensitive. The environment name can't contain newlines, spaces or forward slashes, can't be the string "None", or exceed 64 characters. You can't delete environments, but you can hide them.

    "production"
    
    ignoreErrors?: (string | RegExp)[]

    A pattern for error messages which should not be sent to Sentry. By default, all errors will be sent.

    Behavior of the ignoreErrors option is controlled by the Sentry.eventFiltersIntegration integration. If the event filters integration is not installed, the ignoreErrors option will not have any effect.

    []
    
    ignoreSpans?: (string | RegExp | IgnoreSpanFilter)[]

    A list of span names or patterns to ignore.

    If you specify a pattern IgnoreSpanFilter, at least one of the properties (op or name) must be set.

    []
    
    ignoreTransactions?: (string | RegExp)[]

    A pattern for transaction names which should not be sent to Sentry. By default, all transactions will be sent.

    Behavior of the ignoreTransactions option is controlled by the Sentry.eventFiltersIntegration integration. If the event filters integration is not installed, the ignoreTransactions option will not have any effect.

    []
    
    includeLocalVariables?: boolean

    Include local variables with stack traces.

    Requires the LocalVariables integration.

    includeServerName?: boolean

    If set to false, the SDK will not automatically detect the serverName.

    This is useful if you are using the SDK in a CLI app or Electron where the hostname might be considered PII.

    true
    
    initialScope?: CaptureContext

    Initial data to populate scope.

    undefined
    
    integrations?: Integration[] | ((integrations: Integration[]) => Integration[])

    List of integrations that should be installed after SDK was initialized. Accepts either a list of integrations or a function that receives default integrations and returns a new, updated list.

    maxBreadcrumbs?: number

    The maximum number of breadcrumbs sent with events. Sentry has a maximum payload size of 1MB and any events exceeding that payload size will be dropped.

    100
    
    maxSpanWaitDuration?: number

    The max. duration in seconds that the SDK will wait for parent spans to be finished before discarding a span. The SDK will automatically clean up spans that have no finished parent after this duration. This is necessary to prevent memory leaks in case of parent spans that are never finished or otherwise dropped/missing. However, if you have very long-running spans in your application, a shorter duration might cause spans to be discarded too early. In this case, you can increase this duration to a value that fits your expected data.

    Defaults to 300 seconds (5 minutes).

    maxValueLength?: number

    Maximum number of chars a single value can have before it will be truncated.

    normalizeDepth?: number

    Maximum number of levels that normalization algorithm will traverse in objects and arrays. Used when normalizing an event before sending, on all of the listed attributes:

    • breadcrumbs.data
    • user
    • contexts
    • extra
    3
    
    normalizeMaxBreadth?: number

    Maximum number of properties or elements that the normalization algorithm will output in any single array or object included in the normalized event. Used when normalizing an event before sending, on all of the listed attributes:

    • breadcrumbs.data
    • user
    • contexts
    • extra
    1000
    
    openTelemetryInstrumentations?: Instrumentation<InstrumentationConfig>[]

    Provide an array of OpenTelemetry Instrumentations that should be registered.

    Use this option if you want to register OpenTelemetry instrumentation that the Sentry SDK does not yet have support for.

    openTelemetrySpanProcessors?: SpanProcessor[]

    Provide an array of additional OpenTelemetry SpanProcessors that should be registered.

    orgId?: number | `${number}`

    The organization ID for your Sentry project.

    The SDK will try to extract the organization ID from the DSN. If it cannot be found, or if you need to override it, you can provide the ID with this option. The organization ID is used for trace propagation and for features like strictTraceContinuation.

    parentSpanIsAlwaysRootSpan?: boolean

    If this is enabled, any spans started will always have their parent be the active root span, if there is any active span.

    This is necessary because in some environments (e.g. browser), we cannot guarantee an accurate active span. Because we cannot properly isolate execution environments, you may get wrong results when using e.g. nested startSpan() calls.

    To solve this, in these environments we'll by default enable this option.

    profileLifecycle?: "manual" | "trace"

    Set the lifecycle mode of the profiler.

    • manual: The profiler will be manually started and stopped via startProfiler/stopProfiler. If a session is sampled, is dependent on the profileSessionSampleRate.
    • trace: The profiler will be automatically started when a root span exists and stopped when there are no more sampled root spans. Whether a session is sampled, is dependent on the profileSessionSampleRate and the existing sampling configuration for tracing (tracesSampleRate/tracesSampler).
    'manual'
    
    profileSessionSampleRate?: number

    Sets profiling session sample rate for the entire profiling session (evaluated once per SDK initialization).

    0
    
    profilesSampler?: (samplingContext: SamplingContext) => number | boolean

    Function to compute profiling sample rate dynamically and filter unwanted profiles.

    Profiling is enabled if either this or profilesSampleRate is defined. If both are defined, profilesSampleRate is ignored.

    Will automatically be passed a context object of default and optional custom data.

    Type Declaration

      • (samplingContext: SamplingContext): number | boolean
      • Parameters

        • samplingContext: SamplingContext

        Returns number | boolean

        A sample rate between 0 and 1 (0 drops the profile, 1 guarantees it will be sent). Returning true is equivalent to returning 1 and returning false is equivalent to returning 0.

    profilesSampleRate?: number

    Sets profiling sample rate when @sentry/profiling-node is installed

    propagateTraceparent?: boolean

    If set to true, the SDK propagates the W3C traceparent header to any outgoing requests, in addition to the sentry-trace and baggage headers. Use the CoreOptions.tracePropagationTargets option to control to which outgoing requests the header will be attached.

    Important: If you set this option to true, make sure that you configured your servers' CORS settings to allow the traceparent header. Otherwise, requests might get blocked.

    registerEsmLoaderHooks?: boolean

    Whether to register ESM loader hooks to automatically instrument libraries. This is necessary to auto instrument libraries that are loaded via ESM imports, but it can cause issues with certain libraries. If you run into problems running your app with this enabled, please raise an issue in https://github.com/getsentry/sentry-javascript.

    Defaults to true.

    release?: string

    Sets the release. Release names are strings, but some formats are detected by Sentry and might be rendered differently. Learn more about how to send release data so Sentry can tell you about regressions between releases and identify the potential source in the releases documentation

    undefined
    
    sampleRate?: number

    A global sample rate to apply to all error events.

    0.0 = 0% chance of a given event being sent (send no events) 1.0 = 100% chance of a given event being sent (send all events)

    1.0
    
    sendClientReports?: boolean

    Send SDK Client Reports, which are used to emit outcomes about events that the SDK dropped or failed to capture.

    true
    
    sendDefaultPii?: boolean

    Controls if potentially sensitive data should be sent to Sentry by default. Note that this only applies to data that the SDK is sending by default but not data that was explicitly set (e.g. by calling Sentry.setUser()).

    false

    NOTE: This option currently controls only a few data points in a selected set of SDKs. The goal for this option is to eventually control all sensitive data the SDK sets by default. However, this would be a breaking change so until the next major update this option only controls data points which were added in versions above 7.9.0.

    serverName?: string

    Sets an optional server name (device name).

    This is useful for identifying which server or instance is sending events.

    shutdownTimeout?: number

    Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause problems for sending events from command line applications. Setting it too high can cause the application to block for users with network connectivity problems.

    skipOpenTelemetrySetup?: boolean

    If this is set to true, the SDK will not set up OpenTelemetry automatically. In this case, you have to ensure to set it up correctly yourself, including:

    • The SentrySpanProcessor
    • The SentryPropagator
    • The SentryContextManager
    • The SentrySampler
    spotlight?: string | boolean

    If you use Spotlight by Sentry during development, use this option to forward captured Sentry events to Spotlight.

    Either set it to true, or provide a specific Spotlight Sidecar URL.

    More details: https://spotlightjs.com/

    IMPORTANT: Only set this option to true while developing, not in production!

    stackParser?: StackParser | StackLineParser[]

    A stack parser implementation or an array of stack line parsers By default, a stack parser is supplied for all supported browsers

    strictTraceContinuation?: boolean

    If set to true, the SDK will only continue a trace if the organization ID of the incoming trace found in the baggage header matches the organization ID of the current Sentry client.

    The client's organization ID is extracted from the DSN or can be set with the orgId option.

    If the organization IDs do not match, the SDK will start a new trace instead of continuing the incoming one. This is useful to prevent traces of unknown third-party services from being continued in your application.

    false
    
    tracePropagationTargets?: TracePropagationTargets

    List of strings and/or Regular Expressions used to determine which outgoing requests will have sentry-trace and baggage headers attached.

    Default: If this option is not provided, tracing headers will be attached to all outgoing requests. If you are using a browser SDK, by default, tracing headers will only be attached to outgoing requests to the same origin.

    Disclaimer: Carelessly setting this option in browser environments may result into CORS errors! Only attach tracing headers to requests to the same origin, or to requests to services you can control CORS headers of. Cross-origin requests, meaning requests to a different domain, for example a request to https://api.example.com/ while you're on https://example.com/, take special care. If you are attaching headers to cross-origin requests, make sure the backend handling the request returns a "Access-Control-Allow-Headers: sentry-trace, baggage" header to ensure your requests aren't blocked.

    If you provide a tracePropagationTargets array, the entries you provide will be matched against the entire URL of the outgoing request. If you are using a browser SDK, the entries will also be matched against the pathname of the outgoing requests. This is so you can have matchers for relative requests, for example, /^/api/ if you want to trace requests to your /api routes on the same domain.

    If any of the two match any of the provided values, tracing headers will be attached to the outgoing request. Both, the string values, and the RegExes you provide in the array will match if they partially match the URL or pathname.

    Examples:

    • tracePropagationTargets: [/^/api/] and request to https://same-origin.com/api/posts:
      • Tracing headers will be attached because the request is sent to the same origin and the regex matches the pathname "/api/posts".
    • tracePropagationTargets: [/^/api/] and request to https://different-origin.com/api/posts:
      • Tracing headers will not be attached because the pathname will only be compared when the request target lives on the same origin.
    • tracePropagationTargets: [/^/api/, 'https://external-api.com'] and request to https://external-api.com/v1/data:
      • Tracing headers will be attached because the request URL matches the string 'https://external-api.com'.
    tracesSampler?: (
        samplingContext: TracesSamplerSamplingContext,
    ) => number | boolean

    Function to compute tracing sample rate dynamically and filter unwanted traces.

    Tracing is enabled if either this or tracesSampleRate is defined. If both are defined, tracesSampleRate is ignored. Set this and tracesSampleRate to undefined to disable tracing.

    Will automatically be passed a context object of default and optional custom data.

    Type Declaration

      • (samplingContext: TracesSamplerSamplingContext): number | boolean
      • Parameters

        • samplingContext: TracesSamplerSamplingContext

        Returns number | boolean

        A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent). Returning true is equivalent to returning 1 and returning false is equivalent to returning 0.

    tracesSampleRate?: number

    Sample rate to determine trace sampling.

    0.0 = 0% chance of a given trace being sent (send no traces) 1.0 = 100% chance of a given trace being sent (send all traces).

    Tracing is enabled if either this or tracesSampler is defined. If both are defined, tracesSampleRate is ignored. Set this and tracesSampler to undefined to disable tracing.

    undefined
    
    transport?: (transportOptions: NodeTransportOptions) => Transport

    A function that takes transport options and returns the Transport object which is used to send events to Sentry. The function is invoked internally during SDK initialization. By default, the SDK initializes its default transports.

    transportOptions?: Partial<NodeTransportOptions>

    Options for the default transport that the SDK uses.

    tunnel?: string

    A URL to an envelope tunnel endpoint. An envelope tunnel is an HTTP endpoint that accepts Sentry envelopes for forwarding. This can be used to force data through a custom server independent of the type of data.

    undefined
    

    Methods

    • Callback that is executed when a fatal global error occurs.

      Parameters

      • this: void
      • error: Error

      Returns void