@sentry/react-native
Version:
Official Sentry SDK for react-native
79 lines • 3.98 kB
TypeScript
import type { Integration } from '@sentry/core';
export declare const INTEGRATION_NAME = "TurboModuleContext";
/** Op for the synthetic child span that carries the aggregate breakdown. */
export declare const TURBO_MODULES_AGGREGATE_OP = "turbo_modules.aggregate";
/** Origin string set on the aggregate span so it shows up as auto-instrumented. */
export declare const TURBO_MODULES_AGGREGATE_ORIGIN = "auto.tracing.turbo_modules";
/** Default flush cadence for the periodic timer, in milliseconds. */
export declare const DEFAULT_AGGREGATE_FLUSH_INTERVAL_MS = 30000;
export interface TurboModuleContextOptions {
/**
* Additional TurboModules to track. Each entry's methods will be wrapped so
* that any native crash happening inside a method call gets `contexts.turbo_module`
* + `turbo_module.name` / `turbo_module.method` attached to the crash report,
* and so the calls are recorded into the aggregator (subject to
* `ignoreTurboModules`).
*
* The built-in `RNSentry` TurboModule is always tracked.
*/
modules?: Array<{
name: string;
module: object | null | undefined;
skipMethods?: ReadonlyArray<string>;
}>;
/**
* Per-(module, method, kind) call-count / latency aggregation. When enabled,
* each wrapped TurboModule invocation contributes to a small fixed set of
* counters that flush:
* - on every transaction finish, as a synthetic `turbo_modules.aggregate`
* child span (per-call data in span attributes) plus headline
* measurements on the root span;
* - on a periodic timer (see `aggregateFlushIntervalMs`) so
* long-running sessions without transactions still emit a signal.
*
* Default: `true`.
*
* See https://github.com/getsentry/sentry-react-native/issues/6164.
*/
enableAggregateStats?: boolean;
/**
* Interval in milliseconds for the periodic aggregate flush. Only used when
* `enableAggregateStats` is enabled. The periodic flush emits a custom
* Sentry event so the data survives sessions that never produce a transaction.
*
* Default: 30000 (30s). Set to `0` to disable the periodic timer (data is
* still flushed on transaction finish).
*/
aggregateFlushIntervalMs?: number;
/**
* TurboModules whose calls should NOT be counted in the aggregate.
*
* Default: `['RNSentry']`. The SDK's own transport call
* (`RNSentry.captureEnvelope`) fires from every `captureEvent`, so leaving
* `RNSentry` in the aggregate would (a) pollute app-level TurboModule
* signals with SDK internal noise and (b) allow the periodic flush's own
* `captureEvent` to record back into the aggregator and perpetually re-arm
* the flush timer in idle sessions. Pass `[]` to opt back in.
*
* Note: this does NOT disable wrapping — crashes during those calls still
* get attributed via `contexts.turbo_module`. It only opts the module out
* of the per-(module, method, kind) counters.
*/
ignoreTurboModules?: ReadonlyArray<string>;
}
/**
* Attaches the currently-executing TurboModule method to the Sentry scope so
* that native crashes can be attributed to the high-level RN module + method
* (e.g. `RNSentry.captureEnvelope`) on top of the native stack trace.
*
* Additionally aggregates per-(module, method, kind) call-count / latency
* counters and flushes them on transaction finish (as a synthetic
* `turbo_modules.aggregate` child span with headline measurements on the root
* span) and on a periodic timer (as a custom Sentry event) — see
* https://github.com/getsentry/sentry-react-native/issues/6164.
*
* See https://github.com/getsentry/sentry-react-native/issues/6163 for the
* crash-attribution side of this integration.
*/
export declare const turboModuleContextIntegration: (options?: TurboModuleContextOptions) => Integration;
//# sourceMappingURL=turboModuleContext.d.ts.map