@sentry/browser
Version:
Official Sentry SDK for browsers
56 lines • 2.2 kB
TypeScript
type BFCacheFrame = 'top' | 'child';
interface BFCacheMetricsIntegrationOptions {
/**
* Maximum number of not-restored reasons to emit per miss.
*
* By default every reason is reported. Set this to cap the number emitted per miss.
* Values below 1 are clamped to 1.
*/
maxReasons: number;
}
interface NotRestoredReason {
reason?: string;
}
interface NotRestoredReasons {
children?: NotRestoredReasons[] | null;
reasons?: (NotRestoredReason | string)[] | null;
}
interface CollectedReason {
reason: string;
frame: BFCacheFrame;
}
/**
* Captures bfcache hit/miss counters and Chromium notRestoredReasons when available.
*/
export declare const bfcacheMetricsIntegration: (options?: Partial<BFCacheMetricsIntegrationOptions> | undefined) => import("@sentry/core").Integration & {
name: string;
};
/**
* The segment name for a bfcache navigation.
*
* A registered route provider is preferred because it is parameterized, which matters more here than
* elsewhere: this ends up as a metric dimension, where a raw URL is unbounded cardinality.
*
* Without one we fall back to the scope. A hit restore is silent to tracing (no pageload span), but the
* frozen scope still holds the last transaction name a downstream SDK (Vue/React/etc.) set before the
* freeze, so we reuse that. On a miss the page reloads with a fresh scope, so this is the new pageload
* name. Falls back to the raw pathname when unset.
*
* Exported for tests only.
*/
export declare function _getSegmentName(): string | undefined;
/**
* Resolves the configured `maxReasons` cap. Reports every reason by default and clamps values below 1 to 1,
* since a cap under 1 would silently drop all reasons.
*
* Exported for tests only.
*/
export declare function _resolveMaxReasons(maxReasons: number | undefined): number;
/**
* Flattens the (possibly nested) bfcache `notRestoredReasons` tree into a capped list of reasons.
*
* Exported for tests only.
*/
export declare function _collectNotRestoredReasons(notRestoredReasons: NotRestoredReasons | null | undefined, maxReasons: number): CollectedReason[];
export {};
//# sourceMappingURL=bfcacheMetrics.d.ts.map