<html>
<head>
<meta charset="UTF-8">
<title>performance test</title>
<!-- 放到所有资源之前 防止获取不到error信息 -->
<script src="../dist/performance-report.min.js"></script>
<script>
//开始上报数据
Performance({
domain:'http://some.com/api', //更改成你自己的上报地址域名
})
</script>
</head>
Performance({
domain:'http://some.com/api',
outtime:500,
isPage:true,
isResource:true,
isError:true,
filterUrl:['http://localhost:35729/livereload.js?snipver=1']
},(data)=>{
fetch('http://some.com/api',{type:'POST',body:JSON.stringify(result)}).then((data)=>{})
})
{
"page": "http://localhost:8080/test/",
"preUrl": "",
"appVersion": "5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
"errorList": [
{
"t": 1524017149094,
"n": "js",
"msg": "ReferenceError: wangwei is not defined
at http://localhost:8080/test/:64:15",
"data": {
"resourceUrl": "http://localhost:8080/test/",
"line": 64,
"col": 15
},
"method": "GET"
},
{
"t": 1524017149102,
"n": "resource",
"msg": "img is load error",
"data": {
"target": "img",
"type": "error",
"resourceUrl": "http://img1.imgtn.bd95510/"
},
"method": "GET"
},
{
"t": 1524017149151,
"n": "fetch",
"msg": "fetch请求错误",
"data": {
"resourceUrl": "http://mock-api.seosiwei.com/guest/order/api/order/getOrde",
"text": "TypeError: Failed to fetch",
"status": 0
},
"method": "POST"
},
{
"t": 1524017149154,
"n": "ajax",
"msg": "ajax请求路径有误",
"data": {
"resourceUrl": "http://mock-api.seosiwei.com/guest/home/api/shop/getHomeInitInf",
"text": "ajax请求路径有误",
"status": 0
},
"method": "GET"
}
],
"performance": {
"dnst": 0,
"tcpt": 2,
"wit": 304,
"domt": 445,
"lodt": 677,
"radt": 7,
"rdit": 0,
"uodt": 0,
"reqt": 294,
"andt": 223
},
"resourceList": [
{
"name": "http://localhost:8080/dist/performance-report.js",
"method": "GET",
"type": "script",
"duration": "81.70",
"decodedBodySize": 17589,
"nextHopProtocol": "http/1.1"
},
{
"name": "https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js",
"method": "GET",
"type": "script",
"duration": "0.00",
"decodedBodySize": 0,
"nextHopProtocol": "h2"
},
{
"name": "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=295864288,1887240069&fm=27&gp=0.jpg",
"method": "GET",
"type": "img",
"duration": "0.00",
"decodedBodySize": 0,
"nextHopProtocol": "http/1.1"
},
{
"name": "http://localhost:35729/livereload.js?snipver=1",
"method": "GET",
"type": "script",
"duration": "138.60",
"decodedBodySize": 0,
"nextHopProtocol": "http/1.1"
},
{
"name": "http://mock-api.seosiwei.com/guest/home/api/shop/getHomeInitInfo",
"method": "GET",
"type": "fetchrequest",
"duration": "55.80",
"decodedBodySize": 0,
"nextHopProtocol": "http/1.1"
},
{
"name": "http://mock-api.seosiwei.com/guest/order/api/order/getOrder",
"method": "POST",
"type": "xmlhttprequest",
"duration": "43.40",
"decodedBodySize": 0,
"nextHopProtocol": "http/1.1"
}
]
}