本文介绍了ARMS前端监控基于SLS存储的日志字段含义,用于复杂情况下的查询需求。
指标类型字段t
| t的值 | 说明 | 
|---|---|
| api | API类型。 | 
| pv | PV类型,主要计算PV、UV等指标。 | 
| perf | 页面性能情况。 | 
| health | 页面健康度。 | 
| speed | 自定义测速上报,测速关键字,取值范围为s0~s10。 | 
| behavior | 当异常出现后上报用户行为。 | 
| error | JS错误。 | 
| resourceError | 资源错误。 | 
| sum | 主动上报统计总和。 | 
| avg | 主动上报统计平均值。 | 
| custom | 自定义上报接口,所有字段不能超过20个字符,上报时会自动在字段前加上 x-的前缀。 | 
公共字段
| 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| begin | number | 1626320736212 | 客户端日志发生时间的时间戳。 | 
| ct | string | 4g | 网络类型。 | 
| date | number | 1626320736212 | 一般等于begin,如果没有begin,以服务端时间为准。 | 
| detector_browser | string | safari | 浏览器类型。 | 
| detector_browser_version | string | 14.1.1 | 浏览器版本。 | 
| detector_device | string | mac | 设备类型。 | 
| detector_engine | string | webkit | 浏览器引擎。 | 
| detector_engine_version | string | 605.1.15 | 浏览器引擎版本。 | 
| detector_os | string | macos | 操作系统。 | 
| detector_os_version | string | 10.15.7 | 操作系统版本。 | 
| detector_type | string | pc | 设备类型。 | 
| environment | string | prod | 环境。 | 
| http_referer | string | https://example.com/ | 页面Referer。 | 
| http_user_agent | string | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15 | 浏览器UserAgent。 | 
| ip_city | string | 北京市 | 城市名称。 | 
| ip_city_id | string | 110100 | 城市ID。 | 
| ip_country | string | 中国 | 国家名称。 | 
| ip_country_id | string | CN | 国家ID。 | 
| ip_isp | string | 联通 | 运营商。 | 
| ip_region | string | 北京市 | 省级行政区。 | 
| ip_region_id | string | 110000 | 省级行政区ID。 | 
| page | string | testing | 页面。 | 
| pv_id | string | bkkRsrej4OFdv2d4yeb37Xb2R2Xp | PV ID。 | 
| release | string | 2.0.123 | 客户端版本。 | 
| remote_addr | string | 111.198.XX.XX | 客户端IP地址。 | 
| sample_api | number | 4 | API采样率。 | 
| sample_health | number | 3 | Health采样率。 | 
| sample_pv | number | 3 | PV采样率。 | 
| sample_resourceError | number | 100 | ResourceError采样率。 | 
| sampling | number | 100 | 全局采样率。 | 
| sid | string | kCk83rFv40Caz06y3pv****** | Session ID。 | 
| sr | string | 1280x800 | 屏幕分辨率。 | 
| src | string | https://example.com | 被监控目标地址。 | 
| t | string | resourceError | 不同类型的日志。 | 
| times | number | 100 | 发生相似事件的次数。 | 
| uid | string | 94kUgryg4thaLg61ep5****** | 用户ID。 | 
| vp | string | 1280x677 | 页面大小。 | 
| xpath | string | html.is-safari.is-desktop.is-mac > head. > script. | Node路径。 | 
| z | string | kr4dde7g | 防止缓存。 | 
说明 实际存储表中还存在以下划线(_)开头的字段(如:_line、_v、_target),这些字段是一些辅助字段,产生于数据流处理过程,用于辅助计算,与实际业务无关,无需关注。
                     
                  API(t: api)
上报数据示例:
                        
                  
               t: api
times: 1
page: tracing/list/cn-hangzhou
tag:
release:
environment: prod
begin: 1638178731302
api: /api/trace.json
success: 1
time: 63
code: 200
msg: success
traceId: 7eb784eb16381787313011******
pv_id: 7ekzzwImkbyhU5bIeiX0v9******
domain: arms.console.aliyun.com
flag: 1
sr: 1680x1050
vp: 1628x946
ct: 4g
uid: xxx
sid: F9kb7w53kFzg1vcb34vndj17qgOd
pid: xxx@xxx
_v: 2.0.0
sampling: 1
dl: https://arms.console.aliyun.com/#/tracing/list/cn-hangzhou
z: kwkgc3er
post_res:| 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| page | string | tracing/list/cn-hangzhou | API请求所处页面地址。 | 
| api | string | /api/trace.json | API地址。 | 
| success | number | 1 | 请求是否成功。 
 | 
| time | number | 63 | API耗时,单位为ms。 | 
| code | string | 200 | 请求返回状态码。 | 
| msg | string | success | 返回的消息体。 | 
| traceId | string | 7eb784eb16381787313011****** | 跟随该API上报的Trace ID。 | 
| pv_id | string | 7ekzzwImkbyhU5bIeiX0v9****** | 当前请求所属PV ID。 | 
PV(t: pv)
上报数据示例:
                        
                  
               t: pv
times: 1
page: tracing/callChains/cn-hangzhou
tag:
release:
environment: prod
begin: 1638179112949
uid: xxx
dt: 应用实时监控服务ARMS
dr:
dpr: 1.00
de: utf-8
ul: zh
sr: 1680x1050
vp: 1628x946
ct: 4g
sid: F9kb7w53kFzg1vcb34vnd******
pid: xxx@xxx
_v: 2.0.0
pv_id: Rhksdwe1kFLhhXjwqp159******
sampling: 1
dl: https://arms.console.aliyun.com/#/tracing/callChains/cn-hangzhou
z: kwkgc3f9| 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| pv_id | string | Rhksdwe1kFLhhXjwqp159****** | PV ID。 | 
| dt | string | 应用实时监控服务ARMS | 页面标题。 | 
| dr | string | https://example.com | 文档Referrer。 | 
| dpr | number | 1.00 | 屏幕像素比。 | 
| de | string | utf-8 | 文档编码类型。 | 
| ul | string | zh | 文档语言。 | 
| dl | string | https://arms.console.aliyun.com/#/tracing/callChains/cn-hangzhou | 页面链接。 | 
Health(t: health)
上报数据示例:
                  t: health
times: 1
page: tracing/callChains/cn-hangzhou
tag:
release:
environment: prod
begin: 1638178731334
errcount: 0
apisucc: 42
apifail: 0
healthy: 1
stay: 1647744
sr: 1680x1050
vp: 1628x946
ct: 4g
uid: xxx
sid: F9kb7w53kFzg1vcb34vndj******
pid: xxx@xxxx
_v: 2.0.0
pv_id: Iakvsw01ktagjzcpz773g******
sampling: 1
z: kwkgc3ep| 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| errcount | number | 0 | 错误数。 | 
| apisucc | number | 42 | API调用成功数。 | 
| apifail | number | 0 | API调用失败数。 | 
| healthy | number | 1 | 是否健康。 
 | 
| stay | number | 1647744 | 页面停留时间。 为了防止页面停留时间过短,此处存在stay ≥ 2000的限制,逻辑与PV上报保持一致。因此,如果不停地切换页面,Health日志中的API数据会比实际的数据少。 | 
Perf(t: perf)
上报数据示例:
                  t: perf
times: 1
page: arms.console.aliyun.com
tag:
release:
environment: prod
begin: 1638183632694
dns: 12
tcp: 17
ssl: 14
ttfb: 426
trans: 3
dom: 1760
res: 1466
firstbyte: 455
fpt: 479
tti: 2239
ready: 2243
load: 3709
ct: 4g
bandwidth: 10
navtype: Reload
fmp: 4374
autoSend: true
sr: 2560x1440
vp: 1293x1336
uid: xxx
sid: F9kb7w53kFzg1vcb34vndj******
pid: xxx@xxx
_v: 2.0.0
pv_id: CskRtw6hkFnk5j8FvjR0i******
sampling: 1
z: kwkk8jit说明 业务字段t1-t10、ctti和cfpt只在perf情况下出现,用于手动上报自定义性能数据。
                     
                  | 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| dns | number | 12 | DNS连接耗时。 | 
| tcp | number | 17 | TCP连接耗时。 | 
| ssl | number | 14 | SSL连接耗时。 | 
| ttfb | number | 426 | 网络请求耗时。等待接收响应的第一个字节所花费的时间。 | 
| trans | number | 3 | 数据传输耗时。 | 
| dom | number | 1760 | DOM解析耗时。 | 
| res | number | 1466 | 资源加载耗时。 | 
| firstbyte | number | 455 | First Byte时间。 | 
| fpt | number | 479 | 首次渲染时间。 | 
| tti | number | 2239 | 首次可操作时间。 | 
| ready | number | 2243 | HTML加载完成时间,即DOM Ready时间。 | 
| load | number | 3709 | 从开始加载到完全加载时间。 | 
| navtype | string | Reload | 页面加载方式。 
 | 
| fmp | number | 4374 | 首次有效绘制时间。 | 
Behavior(t: behavior)
上报数据示例:
               t: behavior
times: 1
page: arms.console.aliyun.com%2Fapm
tag:
release:
environment: prod
begin: 1638184741074
sr: 2560x1440
vp: 1293x1336
ct: 4g
uid: xxx
sid: X3kz5wR9ka8kIws06yIwse******
pid: xxx%40xxx
_v: 1.8.30
pv_id: shkRqwIpkLak92ttv8ne6******
sampling: 1
z: kwkkt89j 
requestBody:
{
    "behavior": [
        {
            "type": "ui.click",
            "data": {
                "message": "div%23.next-menu-item-inner%20%3E%20span%23.next-menu-item-text%20%3E%20a%23."
            },
            "timestamp": 1638184607432,
            "page": "/apm"
        },
        {
            "type": "navigation",
            "data": {
                "from": "https://arms.console.aliyun.com/apm?pid=xxx%40xxx®ionId=cn-hangzhou#/aokcdqn3ly@4a331e0c0dcbd46/home",
                "to": "https://arms.console.aliyun.com/apm?pid=xxx%40xxx®ionId=cn-hangzhou#/aokcdqn3ly@4a331e0c0dcbd46/timedTask"
            },
            "timestamp": 1638184607433,
            "page": "/apm"
        },
        {
            "type": "ui.click",
            "data": {
                "message": "ul%23.next-tabs-nav%20%3E%20li%23.next-tabs-tab%20%3E%20div%23.next-tabs-tab-inner"
            },
            "timestamp": 1638184617802,
            "page": "/apm"
        },
        {
            "type": "navigation",
            "data": {
                "from": "https://arms.console.aliyun.com/apm?pid=xxx%40xxx®ionId=cn-hangzhou#/aokcdqn3ly@4a331e0c0dcbd46/timedTask",
                "to": "https://arms.console.aliyun.com/apm?pid=xxx%40xxx®ionId=cn-hangzhou#/aokcdqn3ly@4a331e0c0dcbd46/timedTask/{%22tabs%22:%22iss%22}"
            },
            "timestamp": 1638184617804,
            "page": "/apm"
        },
        {
            "type": "ui.click",
            "data": {
                "message": "ul%23.next-tabs-nav%20%3E%20li%23.next-tabs-tab%20%3E%20div%23.next-tabs-tab-inner%20%3E%20span%23."
            },
            "timestamp": 1638184619991,
            "page": "/apm"
        }
    ]
}Error(t: error)
上报数据示例:
                        
                  
               t: error
times: 1
page: 8880/demo/index.html
tag:
release:
environment: prod
begin: 1638185189365
cate: ReferenceError
msg: unknownmethod333 is not defined
stack: ReferenceError: unknownmethod333 is not defined
    at http://local.taobao.com:8880/demo/fetch-demo.js:278:9
file: http://local.taobao.com:8880/demo/fetch-demo.js
line: 278
col: 9
sr: 2560x1440
vp: 1293x1336
ct: 4g
uid: xxx
sid: wek9kwC2e28us2xnm99F5******
pid: xxx@xxx
_v: 1.8.31
pv_id: RgkFyw9zk67l995pnwI5x5******
sampling: 1
dl: http://local.taobao.com:8880/demo/index.html
z: kwkl5wxv
post_res:
requestBody
{
    "err": {
        "msg_raw": "unknownmethod333%20is%20not%20defined",
        "stack_raw": "ReferenceError%3A%20unknownmethod333%20is%20not%20defined%0A%20%20%20%20at%20http%3A%2F%2Flocal.taobao.com%3A8880%2Fdemo%2Ffetch-demo.js%3A278%3A9"
    }
}| 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| cate | string | ReferenceError | 错误名称,默认为CustomError。 | 
| msg | string | unknownmethod333 is not defined | 错误消息,最大支持1000个字符。 | 
| stack | string | ReferenceError: unknownmethod333 is not defined at http://local.taobao.com:8880/demo/fetch-demo.js:278:9 | 错误堆栈信息,最大支持1000个字符。 | 
| file | string | http://local.taobao.com:8880/demo/fetch-demo.js | 报错JS所属文件。 | 
| line | number | 278 | 报错发生行。 | 
| col | number | 9 | 报错发生列。 | 
| err | string | { "msg_raw": "unknownmethod333%20is%20not%20defined", "stack_raw": "ReferenceError%3A%20unknownmethod333%20is%20not%20defined%0A%20%20%20%20at%20http%3A%2F%2Flocal.taobao.com%3A8880%2Fdemo%2Ffetch-demo.js%3A278%3A9" } | 错误详情。 | 
ResourceError(t: resourceError)
上报数据示例:
                        
                  
               t: resourceError
times: 1
page: 8880/demo/index.html
tag:
release:
environment: prod
begin: 1638185188224
src: http://example/unknown/picture.jpg
node_name: img
xpath: html. > body. > img.
res_type: img
res_name: /unknown/picture.jpg
domain: example
sr: 2560x1440
vp: 1293x1336
ct: 4g
uid: 5kk0Ou0mpadgbp421iXhr******
sid: wek9kwC2e28us2xnm99F5******
pid: xxx@xxx
_v: 1.8.31
pv_id: RgkFyw9zk67l995pnwI5x******
sampling: 1
z: kwkl5wxm| 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| src | string | http://example/unknown/picture.jpg | 资源地址。 | 
| node_name | string | img | 发生错误的HTML类型。 | 
| xpath | string | html. > body. > img. | 发生错误位置。 | 
| res_type | string | img | 错误资源类型。 | 
| res_name | string | /unknown/picture.jpg | 错误资源名称。 | 
| domain | string | example | 错误资源域名。 | 
Sum(t: sum)& Avg(t: avg)& Percent(t: percent)
上报数据示例:
                        
                  
               t: sum
times: 1
page: tracing/callChains/cn-hangzhou
tag:
release:
environment: prod
begin: 1638178731104
key: 应用列表
val: 1
group: ARMS2_NavItemClick
sr: 1680x1050
vp: 1628x946
ct: 4g
uid: xxx
sid: F9kb7w53kFzg1vcb34vndj******
pid: xxx@xxx
_v: 2.0.0
pv_id: Iakvsw01ktagjzcpz773g8******
sampling: 1
z: kwkgc3eo| 字段 | 类型 | 示例 | 说明 | 
|---|---|---|---|
| key | string | 应用列表 | 事件名,如果需要分组,可使用两个半角冒号(::)分隔。 可上报的Object: 
 | 
| val | number | 1 | Sum、Avg或Percent的值。 | 
| group | string | ARMS2_NavItemClick | Sum、Avg或Percent分组。 | 
Custom(t: custom)
自定义上报接口,所有字段不能超过20个字符,上报时会自动在字段前加上x-的前缀。
                  
上报数据示例:
               t: custom
times: 1
page: local.taobao.com:8880/demo/index.html
tag:
release:
environment: prod
begin: 1638185189340
x-msg: testcreateInstance222 is ok
sr: 2560x1440
vp: 1293x1336
ct: 4g
uid: xxx
sid: wek9kwC2e28us2xnm99F5w******
pid: xxx@xxx
_v: 1.8.31
pv_id: 99ktyw7akk0lIO565xXCw******
sampling: 1
z: kwkl5wxr