yxw-monitor-web
v1.0.0
Published
web端前端监控sdk
Downloads
35
Readme
web端前端监控sdk
安装包
npm i yxw-monitor-web --save
关键版本
v1.0.0+ 发布新版本
使用
// 注册utils/record.js
import Record from 'yxw-monitor-web';
const record = new Record({
env: 'dev',
app_id: 'xxxx',
version: 'v1.0.0',
domain: '',
request_url: {
info: '',
send: '',
},
});
export default record.customRecord;
// app.js
import './utils/record.ts'
// 使用自定义埋点
import record from './utils/record.ts';
record({
url: 'https://qibo-api-dev.miaoshou.com/doctor/info/detail',
message: `耗时:1s`,
});
API
- 实例化监控
| 参数名 | 作用 | 类型 | 默认值 | 是否必传 | | ----------- | ------------------------ | ---------------------------------------------- | ------ | -------- | | domain | 域名 | '' | - | 是 | | request_url | 请求地址 | { info: "详情接口路径",send: "上报接口路径" } | - | 是 | | env | 环境变量 | 'prod'|'pre'|'test'|'qa'|'dev' | - | 是 | | app_id | 应用id【到监控平台注册】 | string | - | 是 | | version | 版本号 | string | false | 否 |
- 自定义埋点参数
| 参数名 | 作用 | 类型 | 默认值 | 是否必传 | | --------- | -------- | ------- | ------ | -------- | | parameter | 参数 | string | - | 否 | | message | 报错信息 | boolean | - | 是 |