monitor-trace v1.1.0
Monitor SDK
前端监控 SDK
功能特性
- 监控 JavaScript 异常
- 监控 Promise 异常
- 监控 console.error 异常
- 监控 resource 异常
- 监控跨域异常
- 监控白屏异常
- 监控接口异常
- 监控页面路由跳转
- 监控页面性能
- 监控网站信息
- 监控用户行为
安装
已经发布,下面这行命令可以安装
npm install monitor-trace
环境测试
pnpm run build
node test/test.js
使用方法
import Monitor from 'monitor-trace';
const monitor = new Monitor({
// 配置项
});
项目架构
monitor-sdk/ ├── src/ │ ├── index.ts // 入口文件 │ ├── api/ // API相关 │ │ ├── commonInfo.ts // 通用信息 │ │ ├── index.ts // API入口 │ │ └── interface.ts // 接口定义 │ ├── core/ // 核心功能 │ │ ├── monitor.ts // 监控器主类 │ │ └── types.ts // 类型定义 │ ├── plugins/ // 插件模块 │ │ └── performance/ // 性能监控 │ │ ├── index.ts // 性能监控入口 │ │ ├── types.ts // 类型定义 │ │ └── utils/ // 工具函数 │ │ ├── duration.ts // 页面加载时长监控 │ │ ├── fcp&fp.ts // 首次内容绘制和首次绘制监控 │ │ ├── lcp.ts // 最大内容绘制监控 │ │ ├── navagation.ts // 页面导航性能监控 │ │ ├── performance.ts // 综合性能指标监控 │ │ ├── pvuv.ts // 页面访问量统计 │ │ ├── resource.ts // 资源加载性能监控 │ │ └── whitescreen.ts // 白屏检测 │ ├── report/ // 数据上报 │ │ ├── index.ts // 上报入口 │ │ └── types.ts // 类型定义 ├── test/ // 测试文件 ├── examples/ // 使用示例 └── docs/ // 文档