whitch-frontend-monitor
Version:
前端监控系统 - 一个轻量级的前端监控SDK
79 lines (78 loc) • 1.58 kB
TypeScript
/**
* Trae - 前端监控系统SDK
*/
export declare class TraeMonitor {
private static instance;
config: MonitorConfig;
private reporter;
protected constructor(config: MonitorConfig);
/**
* 获取单例实例
*/
static getInstance(config: MonitorConfig): TraeMonitor;
/**
* 初始化监控系统
*/
private init;
/**
* 初始化错误监控
*/
private initErrorMonitor;
/**
* 初始化性能监控
*/
private initPerformanceMonitor;
/**
* 初始化用户行为监控
*/
private initBehaviorMonitor;
/**
* 初始化网络请求监控
*/
private initNetworkMonitor;
/**
* 获取错误监控数据
*/
getErrors(): any[];
/**
* 获取性能监控数据
*/
getPerformanceData(): any[];
/**
* 获取用户行为数据
*/
getBehaviors(): any[];
/**
* 获取网络请求监控数据
*/
getNetworkData(): any[];
/**
* 上报数据
*/
private report;
/**
* 手动上报自定义数据
* @param type 数据类型
* @param data 上报的数据
*/
reportCustomData(type: string, data: any): void;
/**
* 销毁监控实例
*/
destroy(): void;
}
/**
* 监控系统配置接口
*/
interface MonitorConfig {
appId: string;
userId?: string;
reportUrl: string;
autoTracker?: boolean;
delay?: number;
ignoreUrls?: string[];
sampleRate?: number;
maxRetry?: number;
compression?: boolean;
}
export {};