import { Client, Integration } from '@sentry/core'; /** * Performance API 集成配置 */ export interface PerformanceIntegrationOptions { /** 是否启用导航性能监控 */ enableNavigation?: boolean; /** 是否启用渲染性能监控 */ enableRender?: boolean; /** 是否启用资源加载性能监控 */ enableResource?: boolean; /** 是否启用用户自定义性能监控 */ enableUserTiming?: boolean; /** 性能数据采样率 (0-1) */ sampleRate?: number; /** 性能条目缓冲区大小 */ bufferSize?: number; /** 性能条目统计汇总间隔 (毫秒) */ reportInterval?: number; /** 性能阈值配置 */ thresholds?: { /** 导航耗时阈值(毫秒,默认 3000) */ navigation?: number; /** 渲染耗时阈值(毫秒,默认 1000) */ render?: number; /** 资源加载耗时阈值(毫秒,默认 2000) */ resource?: number; /** setData 渲染耗时阈值(毫秒,默认 50,参考微信官方建议) */ setData?: number; }; /** 是否启用内存信息采集 */ enableMemory?: boolean; } /** Performance API 集成 */ export declare class PerformanceIntegration implements Integration { /** * @inheritDoc */ static id: string; /** * @inheritDoc */ name: string; private _options; private _performanceManager; private _observers; private _entryBuffer; private _reportTimer; private _isSetup; private _relativeTimeOrigin; private _setupEpochMilliseconds; private _client; constructor(options?: PerformanceIntegrationOptions); /** * @inheritDoc */ setupOnce(): void; setup(client: Client): void; private _setup; /** * 初始化性能管理器 */ private _initializePerformanceManager; /** * 设置性能观察者 */ private _setupPerformanceObservers; /** * 处理性能条目 */ private _handlePerformanceEntries; /** * 小程序 PerformanceEntry.startTime 通常是相对运行时起点的毫秒数,不是 Unix epoch。 * 第一批条目用“最晚结束点 ≈ 当前时间”建立稳定锚点;已是 epoch 毫秒的宿主值则原样使用。 * 锚点不得晚于 SDK setup 时刻,否则延迟送达的陈旧首批数据会被错误平移到当前甚至未来。 */ private _initializeRelativeTimeOrigin; private _isPlausiblePerformanceEntry; private _entryTimes; /** * 处理单个性能条目 */ private _processPerformanceEntry; /** * 处理导航性能条目 */ private _processNavigationEntry; /** * 处理渲染性能条目 */ private _processRenderEntry; /** * 处理资源加载性能条目 */ private _processResourceEntry; /** * 处理用户自定义性能条目 */ private _processUserTimingEntry; /** * 添加到缓冲区 */ private _addToBuffer; /** 开始定时汇总性能条目 */ private _startAutoReporting; /** 汇总缓冲的性能条目,并写入当前 Sentry scope */ private _reportBufferedEntries; /** * 计算性能统计数据 */ private _calculatePerformanceStats; /** * 检查性能阈值 */ private _checkPerformanceThresholds; /** * 采集内存信息 */ private _collectMemoryInfo; /** * 添加性能上下文信息 */ private _addPerformanceContext; /** * 清理资源 */ cleanup(): void; private _isActiveClient; } /** * Performance API 集成工厂函数 */ export declare const performanceIntegration: (options?: PerformanceIntegrationOptions) => PerformanceIntegration; //# sourceMappingURL=performance.d.ts.map