You need to enable JavaScript to run this app.
文档中心
应用性能监控全链路版

应用性能监控全链路版

复制全文
下载 pdf
SDK 接入
生命周期
复制全文
下载 pdf
生命周期
通过on挂载监听,通过off卸载监听。​
init​
监听实例被初始化。​
​
client('on', 'init', () => {​
...​
})​
​
start​
监听实例开启上报。​
​
client('on', 'start', () => {​
...​
})​
​
beforeConfig​
监听实例配置变更之前,可拿到新的配置。​
​
client('on', 'beforeConfig', (config: Partial<Config>) => {​
...​
})​
​
​
config​
监听实例配置变更后的瞬间。​
​
client('on', 'config', () => {​
...​
})​
​
provide​
监听实例被挂载属性的瞬间,可拿到属性名。​
​
client('on', 'provide', (name: string) => {​
...​
})​
​
report​
监听事件被监控插件发送的瞬间, 可用于为事件补充上下文, 返回Falsy类型则不上报。​
​
client('on', 'report', (ev: ReportEvent): ReportEvent | Falsy => {​
...​
})​
​
export type Falsy = false | null | undefined​
​
beforeBuild​
监听事件被包装上下文之前的瞬间, 能够拿到即将被包装的数据, 返回Falsy类型则不上报。​
​
client('on', 'beforeBuild', (ev: ReportEvent): ReportEvent | Falsy => {​
...​
})​
​
export type Falsy = false | null | undefined​
​
build​
监听事件被包装上下文之后的瞬间,能够拿到即将上报的数据, 返回Falsy类型则不上报。​
​
client('on', 'build', (ev: SendEvent): SendEvent | Falsy => {​
...​
})​
​
export type Falsy = false | null | undefined​
​
beforeSend​
监听事件被发送之前的瞬间, 返回Falsy类型则不上报。​
​
client('on', 'beforeSend', (ev: SendEvent): SendEvent | Falsy => {​
...​
})​
​
export type Falsy = false | null | undefined​
​
send​
注册事件发送之后的回调。​
​
client('on', 'send', (e: Callback<SendEvent>) => {​
...​
})​
​
interface Callback<T> {​
(arg: T): void​
}​
​
beforeDestroy​
注册实例销毁之前的回调。​
​
client('on', 'beforeDestroy', () => {​
...​
})​
​
SendEvent && ReportEvent 类型声明​
​
// 具体各类型上报格式见上报格式。​
export type SendEvent =​
| CustomReport​
| HttpReport​
| JsErrorReport​
| PageviewReport​
| PerformanceReport​
| PerformanceLongTaskReport​
| PerformanceTimingReport​
| ResourceErrorReport​
| ResourceReport​
| SriReport​
| BlankReport​
​
export type WebReport = Omit<SendEvent,'common'> ​
​
export type ReportEvent<T extends WebReport> = T & {​
// 具体common格式见上报格式​
extra?: Partial<Common>​
// 允许额外上报一些 context 覆盖组装上下文,主要在预收集与预加载场景​
overrides?: Partial<Common>​
}​
​
​
最近更新时间:2025.03.07 15:01:59
这个页面对您有帮助吗?
有用
有用
无用
无用