@blueking/open-telemetry 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +20 -19
  2. package/dist/bk-rum.global.js +2 -2
  3. package/dist/bk-rum.global.js.map +1 -1
  4. package/dist/core/plugin.d.ts +3 -0
  5. package/dist/index.js +461 -354
  6. package/dist/index.js.map +1 -1
  7. package/dist/plugins/web-vitals.d.ts +1 -1
  8. package/dist/schema/attributes.d.ts +1 -0
  9. package/dist/schema/span.d.ts +10 -0
  10. package/package.json +1 -1
  11. package/skills/bk-rum-otele/SKILL.md +1 -1
  12. package/skills/bk-rum-otele/evals/evals.json +1 -1
  13. package/skills/bk-rum-otele/references/actions.md +3 -3
  14. package/skills/bk-rum-otele/references/api.md +3 -3
  15. package/skills/bk-rum-otele/references/architecture.md +2 -2
  16. package/skills/bk-rum-otele/references/blank-screen.md +2 -2
  17. package/skills/bk-rum-otele/references/capabilities.md +17 -17
  18. package/skills/bk-rum-otele/references/configuration.md +1 -1
  19. package/skills/bk-rum-otele/references/data-model.md +3 -3
  20. package/skills/bk-rum-otele/references/errors-security.md +4 -4
  21. package/skills/bk-rum-otele/references/getting-started.md +3 -2
  22. package/skills/bk-rum-otele/references/network.md +5 -5
  23. package/skills/bk-rum-otele/references/performance.md +2 -2
  24. package/skills/bk-rum-otele/references/session-context.md +3 -3
  25. package/skills/bk-rum-otele/references/span-protocol.md +174 -265
  26. package/skills/bk-rum-otele/references/telemetry-reference.md +36 -33
  27. package/skills/bk-rum-otele/references/transport-sampling.md +2 -2
  28. package/skills/bk-rum-otele/references/troubleshooting.md +3 -3
  29. package/skills/bk-rum-otele/references/views-routing.md +4 -4
@@ -20,7 +20,7 @@
20
20
  原则:
21
21
 
22
22
  - 浏览器 SDK 只上报原始 RUM Span(OTLP/HTTP JSON Trace),不创建 Metric 或 Log Provider。
23
- - Web Vitals 由 SDK 以 `browser.web_vital` Span 上报(`vital.metric` = `cls` / `fcp` / `inp` / `lcp` / `ttfb`);分位数和跨会话聚合由接收端派生。
23
+ - Web Vitals 由 SDK 以 `span_type=vital` 的 Span 上报(`vital.metric` = `cls` / `fcp` / `inp` / `lcp` / `ttfb`);分位数和跨会话聚合由接收端派生。
24
24
  - 控制字段规模:只约定当前实现真正使用的字段;未上报字段不要当作采集端契约。
25
25
 
26
26
  ## 0x01 用户真实监控模型
@@ -42,15 +42,15 @@ Session
42
42
  | 字段 | 状态 | 类型 | 描述 | 备注 |
43
43
  | ---------------- | -------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------- |
44
44
  | `time` | ![Backend](https://img.shields.io/badge/-backend-orange) | str | 数据上报时间(毫秒时间戳字符串) | -- |
45
- | `app_name` | ![Backend](https://img.shields.io/badge/-backend-orange) | str | 应用名称 | -- |
45
+ | `app_name` | ![Backend](https://img.shields.io/badge/-backend-orange) | str | 应用 | -- |
46
46
  | `bk_biz_id` | ![Backend](https://img.shields.io/badge/-backend-orange) | str | 业务 ID | -- |
47
47
  | `trace_id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Trace ID | -- |
48
- | `trace_state` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Trace 状态 | -- |
49
- | `span_name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Span 名称 | -- |
48
+ | `trace_state` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Trace 扩展信息 | -- |
49
+ | `span_name` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 可读的低基数 Span 名称 | 由 SDK 根据 `span_type` 和领域字段生成。 |
50
50
  | `span_id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Span ID | -- |
51
51
  | `parent_span_id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 父 Span ID | -- |
52
52
  | `status` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | Status | Span 执行状态 | 包含 `code` 和 `message`。 |
53
- | `kind` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | [Span 类型](https://opentelemetry.io/zh/docs/concepts/signals/traces/#span-kind) | 枚举值:<br>- 未定义:0<br>- 内部调用:1<br>- 同步被调:2<br>- 同步主调:3<br>- 异步主调:4<br>- 异步被调:5 |
53
+ | `kind` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | [调用类型](https://opentelemetry.io/zh/docs/concepts/signals/traces/#span-kind) | 枚举值:<br>- 未定义:0<br>- 内部调用:1<br>- 同步被调:2<br>- 同步主调:3<br>- 异步主调:4<br>- 异步被调:5 |
54
54
  | `resource` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | object | 资源信息 | 服务、环境、SDK 等描述信息。 |
55
55
  | `events` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | Event[] | 事件列表 | 异常详情和 Long Task 脚本明细通过 Span Event 承载。 |
56
56
  | `links` | ![Development](https://img.shields.io/badge/-development-blue) | Link[] | [Span 链接](https://opentelemetry.io/docs/concepts/signals/traces/#span-links) | 链接的存在是为了 Span 同其他 Span 建立关联,从而表明存在因果关系。 |
@@ -59,21 +59,37 @@ Session
59
59
  | `end_time` | ![Backend](https://img.shields.io/badge/-backend-orange) | int | 结束时间(微秒) | 同上,对应 `endTimeUnixNano`。 |
60
60
  | `elapsed_time` | ![Backend](https://img.shields.io/badge/-backend-orange) | int | 耗时(微秒) | 后端由起止时间相减;浏览器 SDK 不单独上报该 Attribute。 |
61
61
 
62
+ **[1] `span_name`**:
63
+
64
+ | `attributes.span_type` | 生成规则 | 示例 |
65
+ | --- | --- | --- |
66
+ | `session` | `session.<attributes.session.phase>` | `session.start` |
67
+ | `view` | `attributes.view.name` | `订单详情` |
68
+ | `resource` | `<attributes.http.request.method> <attributes.url.template>` | `GET /api/orders/:id` |
69
+ | `action` | `attributes.action.name` | `click 提交订单` |
70
+ | `error` | 异常类型;白屏和 CSP 使用稳定分类 | `TypeError`、`blank_screen.empty_viewport`、`csp.script-src-elem` |
71
+ | `vital` | 大写的 `attributes.vital.metric` | `LCP` |
72
+ | `long_task` | `attributes.long_task.entry_type` | `long-animation-frame` |
73
+ | `websocket` | `websocket.<attributes.websocket.phase>` | `websocket.connect` |
74
+ | `custom` | `custom.<name>` | `custom.checkout_success` |
75
+
76
+ 名称不包含 ID、完整 URL、错误消息、时间戳或数值。业务传入的 View、Action 和 Custom 名称必须保持稳定。
77
+
62
78
  ### b. Resource
63
79
 
64
80
  | 字段 | 状态 | 类型 | 描述 | 备注 |
65
81
  | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ------ | ----------- | ---------------------------------------------- |
66
- | `resource.service.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 服务名 | -- |
82
+ | `resource.service.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 服务 | -- |
67
83
  | `resource.service.version` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 版本 | -- |
68
84
  | [`resource.deployment.environment.name`](https://opentelemetry.io/docs/specs/semconv/resource/deployment-environment/) | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 环境 | 如 `development`、`production`、`staging`、`test`。 |
69
- | `resource.session.sample_rate` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | Session 采样率 | 取值范围为 `0`~`1`。 |
85
+ | `resource.session.sample_rate` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 会话采样率 | 取值范围为 `0`~`1`。 |
70
86
  | `resource.telemetry.sdk.version` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | SDK 版本 | -- |
71
- | [`resource.telemetry.sdk.language`](https://opentelemetry.io/docs/specs/semconv/resource/#telemetry-sdk) | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 语言 | `webjs`。 |
87
+ | [`resource.telemetry.sdk.language`](https://opentelemetry.io/docs/specs/semconv/resource/#telemetry-sdk) | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | SDK 语言 | `webjs`。 |
72
88
  | `resource.telemetry.sdk.name` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | SDK 名称 | -- |
73
89
  | `resource.device.type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 设备类型 | 当前仅为 `desktop`、`mobile`。 |
74
- | `resource.user_agent.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 代理名称 | 通常指的是浏览器的名称,如 `Chrome`、`Edge`。 |
75
- | `resource.user_agent.version` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 代理版本 | 通常指的是浏览器的名称,如 `149`、`151`。 |
76
- | `resource.user_agent.os.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 操作系统名 | 如 `macOS`、`Windows`、`Android`。 |
90
+ | `resource.user_agent.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 浏览器 | 通常指的是浏览器的名称,如 `Chrome`、`Edge`。 |
91
+ | `resource.user_agent.version` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 浏览器版本 | 通常指的是浏览器的名称,如 `149`、`151`。 |
92
+ | `resource.user_agent.os.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 操作系统 | 如 `macOS`、`Windows`、`Android`。 |
77
93
 
78
94
  **[1] `resource.telemetry.sdk.name`**:当前浏览器 SDK 固定为 `blueking`。Aegis 等其他生产端可使用各自名称,不要把 npm 包名 `@blueking/open-telemetry` 当作该字段值。
79
95
 
@@ -88,7 +104,7 @@ Session
88
104
 
89
105
  | 字段 | 状态 | 类型 | 描述 | 备注 |
90
106
  | ----------------------------------------------------------------------- | ---------------------------------------------------------- | ------ | ------------- | -------------------- |
91
- | `events[].name` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 事件名 | |
107
+ | `events[].name` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 事件 | |
92
108
  | `events[].timestamp` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 事件发生时间 | SDK 传输为 OTLP Event UnixNano;后端可转为微秒。 |
93
109
  | `events[].attributes.exception.type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 异常类型 | 如 `TypeError`。 |
94
110
  | `events[].attributes.exception.message` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 异常消息 | 如 `Failed to fetch`。 |
@@ -96,14 +112,14 @@ Session
96
112
  | `events[].attributes.long_task.script.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 脚本耗时(ms) | |
97
113
  | `events[].attributes.long_task.script.execution_start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 脚本执行开始时间(ms) | |
98
114
  | `events[].attributes.long_task.script.forced_style_and_layout_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 强制样式与布局耗时(ms) | |
99
- | `events[].attributes.long_task.script.pause_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 暂停耗时(ms) | |
115
+ | `events[].attributes.long_task.script.pause_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 脚本暂停耗时(ms) | |
100
116
  | `events[].attributes.long_task.script.source_char_position` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 源码字符位置 | |
101
117
  | `events[].attributes.long_task.script.start_time` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 脚本开始时间(ms) | |
102
- | `events[].attributes.long_task.script.invoker` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 调用方 | |
103
- | `events[].attributes.long_task.script.invoker_type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 调用方类型 | |
104
- | `events[].attributes.long_task.script.source_function_name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 源函数名 | |
118
+ | `events[].attributes.long_task.script.invoker` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 脚本触发来源 | |
119
+ | `events[].attributes.long_task.script.invoker_type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 脚本触发类型 | |
120
+ | `events[].attributes.long_task.script.source_function_name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 脚本函数名 | |
105
121
  | `events[].attributes.long_task.script.source_url` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 已脱敏的脚本 URL | |
106
- | `events[].attributes.long_task.script.window_attribution` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Window 归因 | |
122
+ | `events[].attributes.long_task.script.window_attribution` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 脚本窗口关系 | |
107
123
 
108
124
  **[1] `events[].name`**:「异常」需将事件名固定为 `exception`。
109
125
 
@@ -126,8 +142,8 @@ Session
126
142
  | 字段 | 状态 | 类型 | 描述 | 备注 |
127
143
  | ---------------------------- | ---------------------------------------------------------- | ---- | ------- | ---------------------------------------------- |
128
144
  | `attributes.user.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 用户 ID | -- |
129
- | `attributes.span_type` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | Span 类型 | -- |
130
- | `attributes.outcome.type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 执行结果 | `success`、`warning`、`error`、`timeout`、`abort`。 |
145
+ | `attributes.span_type` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 事件类型 | -- |
146
+ | `attributes.outcome.type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 执行结果 | `success`、`warning`(警告)、`error`、`timeout`、`abort`。 |
131
147
 
132
148
 
133
149
  **[1] `attributes.span_type`**:
@@ -138,9 +154,9 @@ Session
138
154
  | `view` | 页面首次加载或路由视图生命周期。 |
139
155
  | `resource` | 静态资源、Fetch 或 XHR 请求。 |
140
156
  | `error` | 浏览器错误、白屏或 CSP 违规。 |
141
- | `vital` | Web Vitals 指标。 |
157
+ | `vital` | Web 性能指标。 |
142
158
  | `long_task` | Long Task 或长动画帧。 |
143
- | `action` | 用户交互或主动上报的 Action。 |
159
+ | `action` | 用户操作或主动上报的 Action。 |
144
160
  | `websocket` | WebSocket 生命周期事件。 |
145
161
  | `custom` | 主动上报的自定义事件。 |
146
162
 
@@ -151,7 +167,7 @@ Session
151
167
  | ------------------------------- | ----------------------------------------------------------- | ------- | ---------- | -------------------------------------------------------------------- |
152
168
  | `attributes.error.message` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 错误信息 | -- |
153
169
  | `attributes.error.handled` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | boolean | 错误是否被捕获 | -- |
154
- | `attributes.error.source` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 错误来源 | 枚举值:<br/>- window.error(固定值)<br/>- resource<br/>- unhandledrejection |
170
+ | `attributes.error.source` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 错误来源 | 枚举值:<br/>- window.error(脚本错误,固定值)<br/>- resource(资源加载错误)<br/>- unhandledrejection(未处理的 Promise 异常) |
155
171
  | `attributes.code.column` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 代码列号 | |
156
172
  | `attributes.code.filepath` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 代码文件路径 | |
157
173
  | `attributes.code.lineno` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 代码行号 | |
@@ -162,8 +178,8 @@ Session
162
178
  | ------------------------------------ | ---------------------------------------------------------- | --- | ------- | ---------------------------- |
163
179
  | `attributes.browser.screen.height` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 屏幕尺寸的高度 | Aegis 使用 `sr = 1728 * 1117`。 |
164
180
  | `attributes.browser.screen.width` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 屏幕尺寸的宽度 | -- |
165
- | `attributes.browser.viewport.height` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 视口尺寸的高度 | Aegis 使用 `vp = 576 * 918`。 |
166
- | `attributes.browser.viewport.width` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 视口尺寸的宽度 | -- |
181
+ | `attributes.browser.viewport.height` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 可视区域高度 | Aegis 使用 `vp = 576 * 918`。 |
182
+ | `attributes.browser.viewport.width` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 可视区域宽度 | -- |
167
183
 
168
184
  ### d. [device](https://opentelemetry.io/docs/specs/semconv/registry/attributes/device/)
169
185
 
@@ -175,10 +191,10 @@ Session
175
191
 
176
192
  | 字段 | 状态 | 类型 | 描述 | 备注 |
177
193
  | ------------------------------------ | -------------------------------------------------------------- | ---- | ------- | ----------------------------------------------------------- |
178
- | `attributes.network.connection.type` | ![Development](https://img.shields.io/badge/-development-blue) | enum | 连接类型 | 直接使用浏览器 `navigator.connection.type` 的原始值;字段不存在时不上报。 |
179
- | `attributes.network.effective_type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 有效网络质量 | -- |
180
- | `attributes.network.status` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 网络连接状态 | `connected`、`not_connected`。 |
181
- | `attributes.network.protocol.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 应用层网络协议 | 仅 WebSocket Span 上报,固定为 `websocket`;HTTP Resource Span 不上报。 |
194
+ | `attributes.network.connection.type` | ![Development](https://img.shields.io/badge/-development-blue) | enum | 网络连接类型 | 直接使用浏览器 `navigator.connection.type` 的原始值;字段不存在时不上报。 |
195
+ | `attributes.network.effective_type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 网络质量 | -- |
196
+ | `attributes.network.status` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 网络状态 | `connected`、`not_connected`。 |
197
+ | `attributes.network.protocol.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 应用层协议 | 仅 WebSocket Span 上报,固定为 `websocket`;HTTP Resource Span 不上报。 |
182
198
 
183
199
  **[1] `attributes.network.connection.type`**:表示设备当前使用的物理网络连接方式。SDK 直接上报
184
200
  [`navigator.connection.type`](https://wicg.github.io/netinfo/#connectiontype-enum);浏览器不支持该 API
@@ -203,19 +219,19 @@ Aegis 将「连接类型」「网络质量」整合成 `netType`(`wifi`、`wir
203
219
 
204
220
  | 值 | 描述 | 备注 |
205
221
  | --------- | ---- | -------------------------- |
206
- | `slow-2g` | 极慢网络 | 页面和图片加载非常慢,通常只能满足少量文本传输。 |
207
- | `2g` | 较慢网络 | 简单页面可以打开,图片、脚本和接口请求可能明显缓慢。 |
208
- | `3g` | 中等网络 | 普通网页基本可用,但大资源和复杂页面仍可能等待。 |
209
- | `4g` | 较快网络 | 延迟和带宽表现较好,适合大多数 Web 应用。 |
222
+ | `slow-2g` | 极慢 | 页面和图片加载非常慢,通常只能满足少量文本传输。 |
223
+ | `2g` | 较慢 | 简单页面可以打开,图片、脚本和接口请求可能明显缓慢。 |
224
+ | `3g` | 中等 | 普通网页基本可用,但大资源和复杂页面仍可能等待。 |
225
+ | `4g` | 较快 | 延迟和带宽表现较好,适合大多数 Web 应用。 |
210
226
 
211
227
  ### f. session
212
228
 
213
229
  | 字段 | 状态 | 类型 | 描述 | 备注 |
214
230
  | ------------------------------------- | ----------------------------------------------------------- | ------- | -------- | ----------------------------------------------- |
215
- | `attributes.session.has_replay` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | boolean | 是否回放 | -- |
231
+ | `attributes.session.has_replay` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | boolean | 有无回放 | -- |
216
232
  | `attributes.session.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 会话 ID | -- |
217
233
  | `attributes.session.type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 会话类型 | 当前固定为 `user`。 |
218
- | `attributes.session.phase` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 会话生命周期阶段 | -- |
234
+ | `attributes.session.phase` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 会话阶段 | -- |
219
235
 
220
236
  **[1] `attributes.session.phase`**:
221
237
 
@@ -229,36 +245,36 @@ Aegis 将「连接类型」「网络质量」整合成 `netType`(`wifi`、`wir
229
245
 
230
246
  | 字段 | 状态 | 类型 | 描述 | 备注 |
231
247
  | ------------------------------------- | -------------------------------------------------------------- | ------ | ----------------------- | --------------------------------------------- |
232
- | `attributes.view.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 视图 ID | |
233
- | `attributes.view.name` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 视图名称 | 如 `/apm/home`。 |
234
- | `attributes.view.loading_type` *[2]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 视图加载类型 | -- |
235
- | `attributes.view.url` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 视图 URL | 如 `https://example.com/cur`。 |
236
- | `attributes.view.previous` | ![Development](https://img.shields.io/badge/-development-blue) | str | 视图 URL(前一个) | 如 `https://example.com/pre`。 |
237
- | `attributes.view.previous_url_template` | ![Development](https://img.shields.io/badge/-development-blue) | str | 前序视图路径模板 | 与 `view.url_template` 使用同一规则;初始 View 为空字符串。 |
238
- | `attributes.view.referrer` | ![Development](https://img.shields.io/badge/-development-blue) | str | 初始来源页面 URL | 仅首次加载且值非空时上报,需进行 URL 脱敏。 |
239
- | `attributes.view.url_template` *[3]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 视图路径分组 | 如 `/apm/home`。 |
240
- | `attributes.view.loading_time` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 视图加载耗时(ms) | 加载时间计算完成后上报。 |
241
- | `attributes.view.loading_time_source` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 视图加载耗时来源 | `auto`、`manual`。 |
242
- | `attributes.view.first_byte` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 首字节时间(ms) | 仅初始导航存在。 |
248
+ | `attributes.view.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 页面 ID | |
249
+ | `attributes.view.name` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 页面名称 | 如 `/apm/home`。 |
250
+ | `attributes.view.loading_type` *[2]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 页面加载类型 | -- |
251
+ | `attributes.view.url` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 页面 URL | 如 `https://example.com/cur`。 |
252
+ | `attributes.view.previous` | ![Development](https://img.shields.io/badge/-development-blue) | str | 上一页面 URL | 如 `https://example.com/pre`。 |
253
+ | `attributes.view.previous_url_template` | ![Development](https://img.shields.io/badge/-development-blue) | str | 上一个页面 | 与 `view.url_template` 使用同一规则;初始 View 为空字符串。 |
254
+ | `attributes.view.referrer` | ![Development](https://img.shields.io/badge/-development-blue) | str | 初始来源 URL | 仅首次加载且值非空时上报,需进行 URL 脱敏。 |
255
+ | `attributes.view.url_template` *[3]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 页面 | 如 `/apm/home`。 |
256
+ | `attributes.view.loading_time` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 页面加载耗时(ms) | 加载时间计算完成后上报。 |
257
+ | `attributes.view.loading_time_source` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 页面加载计时方式 | `auto`、`manual`。 |
258
+ | `attributes.view.first_byte` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 页面首字节耗时(ms) | 仅初始导航存在。 |
243
259
  | `attributes.view.dom_interactive` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DOM 可交互时间(ms) | 仅初始导航存在。 |
244
260
  | `attributes.view.dom_content_loaded` | ![Stable\|43](https://img.shields.io/badge/-stable-lightgreen) | number | DOMContentLoaded 时间(ms) | 仅初始导航存在。 |
245
- | `attributes.view.dom_complete` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DOM Complete 时间(ms) | 仅初始导航存在。 |
246
- | `attributes.view.load_event` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | Load Event 时间(ms) | 仅初始导航存在。 |
247
- | `attributes.view.phase` *[4]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 视图生命周期阶段 | 枚举值:<br>- start<br>- update<br>- end |
248
- | `attributes.view.started_at` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 视图开始时间(ms) | 初始 View 取 `performance.timeOrigin`(epoch ms);后续 View 取创建时刻。 |
249
- | `attributes.view.version` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 视图事件版本号 | 同一 `attributes.view.id` 从 `1` 开始递增,用于排序和幂等合并。 |
250
- | `attributes.view.end_reason` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 结束原因 | -- |
261
+ | `attributes.view.dom_complete` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DOM 完成时间(ms) | 仅初始导航存在。 |
262
+ | `attributes.view.load_event` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | Load 事件时间(ms) | 仅初始导航存在。 |
263
+ | `attributes.view.phase` *[4]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 页面阶段 | 枚举值:<br>- start<br>- update<br>- end |
264
+ | `attributes.view.started_at` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 页面开始时间(ms) | 初始 View 取 `performance.timeOrigin`(epoch ms);后续 View 取创建时刻。 |
265
+ | `attributes.view.version` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 页面快照版本 | 同一 `attributes.view.id` 从 `1` 开始递增,用于排序和幂等合并。 |
266
+ | `attributes.view.end_reason` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 页面结束原因 | -- |
251
267
 
252
- **[1] `attributes.view.name`**:仅由 `startView({ name })` 或 `setViewName` 显式设置;未设置时,展示层可回退到 `view.url_template`。
268
+ **[1] `attributes.view.name`**:优先使用 `startView({ name })` 或 `setViewName()` 设置的名称;未显式设置时,默认取 `attributes.view.url_template`。
253
269
 
254
270
  **[2] `attributes.view.loading_type`**:
255
271
 
256
272
  | 值 | 描述 |
257
273
  | ----------------- | --------------- |
258
- | `initial_load` | 首次页面加载(初始导航) |
259
- | `route_change` | SPA 路由切换 |
274
+ | `initial_load` | 初始加载 |
275
+ | `route_change` | 路由切换 |
260
276
  | `session_renewal` | 会话续期后重建 |
261
- | `bf_cache` | 从浏览器 BFCache 恢复 |
277
+ | `bf_cache` | 前进后退缓存恢复 |
262
278
 
263
279
  **[3] `attributes.view.url_template`**:用于聚合的页面路径。默认把数字 ID、UUID 和长十六进制段替换为 `:id`,也可由 `tracking.view.getUrlTemplate` 自定义。
264
280
 
@@ -332,54 +348,92 @@ View B █████████████
332
348
  | `attributes.resource.type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 资源类型 | -- |
333
349
  | `attributes.resource.size` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 资源大小 | -- |
334
350
  | `attributes.resource.transfer_size` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 传输大小 | -- |
335
- | `attributes.resource.decoded_body_size` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 解码后正文大小 | -- |
336
- | `attributes.resource.encoded_body_size` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 编码后正文大小 | -- |
337
- | `attributes.resource.protocol` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 传输协议 | 浏览器提供下一跳协议时存在,如 `h2`、`h3`、`http/1.1`。 |
338
- | `attributes.resource.cache.hit` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | boolean | 是否缓存命中 | -- |
339
- | `attributes.resource.delivery_type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 交付类型 | 浏览器提供交付类型时存在,如 `cache`、`navigational-prefetch`、`cache-storage`、`other`。 |
340
- | `attributes.resource.render_blocking_status` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 渲染阻塞状态 | 浏览器提供渲染阻塞状态时存在,枚举值为 `blocking`、`non-blocking` |
351
+ | `attributes.resource.decoded_body_size` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 解压后大小 | -- |
352
+ | `attributes.resource.encoded_body_size` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 压缩后大小 | -- |
353
+ | `attributes.resource.protocol` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 资源协议 | 浏览器提供下一跳协议时存在,如 `h2`、`h3`、`http/1.1`。 |
354
+ | `attributes.resource.cache.hit` *[3]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | boolean | 缓存命中 | 命中时为 `true`,未命中或无法判断时不写入。 |
355
+ | `attributes.resource.delivery_type` *[4]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 资源获取方式 | 浏览器返回非空值时存在。 |
356
+ | `attributes.resource.render_blocking_status` *[5]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 渲染阻塞状态 | 浏览器支持该字段时存在。 |
341
357
  | `attributes.resource.redirect.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 重定向开始时间 | -- |
342
358
  | `attributes.resource.redirect.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 重定向耗时 | -- |
343
359
  | `attributes.resource.worker.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | Service Worker 开始时间 | -- |
344
360
  | `attributes.resource.worker.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | Service Worker 耗时 | -- |
345
- | `attributes.resource.dns.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DNS 查询开始时间 | -- |
346
- | `attributes.resource.dns.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DNS 查询耗时 | -- |
347
- | `attributes.resource.connect.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 传输连接开始时间 | -- |
348
- | `attributes.resource.connect.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 传输连接耗时 | -- |
361
+ | `attributes.resource.dns.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DNS 解析开始时间 | -- |
362
+ | `attributes.resource.dns.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DNS 解析耗时 | -- |
363
+ | `attributes.resource.connect.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 连接开始时间 | -- |
364
+ | `attributes.resource.connect.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 连接耗时(含 TLS) | -- |
349
365
  | `attributes.resource.ssl.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | TLS 握手开始时间 | -- |
350
366
  | `attributes.resource.ssl.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | TLS 握手耗时 | -- |
351
- | `attributes.resource.first_byte.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 首字节阶段开始时间 | -- |
352
- | `attributes.resource.first_byte.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 首字节耗时 | -- |
353
- | `attributes.resource.download.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 下载开始时间 | -- |
354
- | `attributes.resource.download.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 下载耗时 | -- |
367
+ | `attributes.resource.first_byte.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 首字节等待开始时间 | -- |
368
+ | `attributes.resource.first_byte.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 首字节等待耗时 | -- |
369
+ | `attributes.resource.download.start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 内容下载开始时间 | -- |
370
+ | `attributes.resource.download.duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 内容下载耗时 | -- |
355
371
 
356
372
  **[1] `attributes.resource.type`**:
357
373
 
358
374
  | 值 | 描述 |
359
375
  | ------------------ | -------------------------------------------- |
360
- | `fetch` | Fetch API 请求。 |
361
- | `xhr` | XMLHttpRequest 请求。 |
362
- | `script` | `<script>`、模块或 Worker 加载的脚本资源。 |
363
- | `link` | `<link>` 加载的资源,如样式表、预加载和预取资源。 |
364
- | `img` / `image` | HTML 或 SVG 图片元素加载的资源。 |
365
- | `css` | CSS `url()`、`@import` 等规则加载的资源,不表示 CSS 文件本身。 |
376
+ | `fetch` | Fetch 请求。 |
377
+ | `xhr` | XHR 请求。 |
378
+ | `script` | 脚本加载:`<script>`、模块或 Worker 加载的脚本资源。 |
379
+ | `link` | Link 标签加载:`<link>` 加载的资源,如样式表、预加载和预取资源。 |
380
+ | `img` / `image` | 图片:HTML 或 SVG 图片元素加载的资源。 |
381
+ | `css` | CSS 规则加载:CSS `url()`、`@import` 等规则加载的资源,不表示 CSS 文件本身。 |
366
382
  | `iframe` / `frame` | 内嵌页面加载的文档资源。 |
367
- | `other` | 浏览器未识别发起方式、`initiatorType` 为空或未单列的其他类型。 |
383
+ | `other` | 其他:浏览器未识别发起方式、`initiatorType` 为空或未单列的其他类型。 |
368
384
  | ... | .. |
369
385
 
370
386
  **[2] 单位**:`xx_size` 为 bytes,`duration` & `start` 为毫秒。
371
387
 
372
- **[3] 阶段图**:产品阶段划分见 [0x04 资源加载时序](#0x04-资源加载时序)。
388
+ **[3] `attributes.resource.cache.hit`**
389
+
390
+ 满足任一条件时,SDK 写入 `true`:
391
+
392
+ | 条件 | 结果 |
393
+ | --- | --- |
394
+ | `deliveryType=cache` | `true` |
395
+ | `transferSize=0 && decodedBodySize>0` | `true` |
396
+ | 其他 | 不写入,不写 `false` |
397
+
398
+ ETag(实体标签)是服务器提供的资源版本标识。浏览器按以下流程校验缓存:
399
+
400
+ ```text
401
+ 缓存 ETag → If-None-Match → 304 → 复用本地正文
402
+ ```
403
+
404
+ `deliveryType=cache` 与 `transferSize>0` 不冲突。[Resource Timing](https://www.w3.org/TR/resource-timing/) 把 `validated` 缓存的 `transferSize` 记为 `300`,不是正文大小。
405
+
406
+ **[4] `attributes.resource.delivery_type`**:
407
+
408
+ | 常见值 | 描述 |
409
+ | ----------------------- | ---------------------------------------------------------- |
410
+ | `cache` | 由浏览器 HTTP 缓存交付,包括本地缓存和网络校验缓存。 |
411
+ | `navigational-prefetch` | 由导航预取缓冲区交付。 |
412
+ | `cache-storage` | 由 Cache Storage 交付,包括 Service Worker Fetch Handler 和静态路由命中。 |
413
+
414
+ 规范来源:[Resource Timing](https://www.w3.org/TR/resource-timing/)、[Prefetch](https://wicg.github.io/nav-speculation/prefetch.html)、[Chromium Cache Storage Timing](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/experiments/service-worker-static-routing-api-timing-info.md)。
415
+
416
+ SDK 原样上报浏览器返回的非空值,空值不写入。
417
+
418
+ **[5] `attributes.resource.render_blocking_status`**:
419
+
420
+ | 值 | 描述 |
421
+ | -------------- | ----------- |
422
+ | `blocking` | 可能阻塞渲染。 |
423
+ | `non-blocking` | 不阻塞渲染。 |
424
+
425
+ 取值定义见 [Resource Timing](https://www.w3.org/TR/resource-timing/)。浏览器不支持该字段时,SDK 不写入。
373
426
 
374
427
  ### i. action
375
428
 
376
429
  | 字段 | 状态 | 类型 | 描述 |
377
430
  | ------------------------------------------ | ---------------------------------------------------------- | ----- | ------ |
378
- | `attributes.action.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | -- |
379
- | `attributes.action.type` *[2]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 动作类型 |
380
- | `attributes.action.target.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 目标元素名称 |
381
- | `attributes.action.target.tag` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 目标元素标签 |
382
- | `attributes.action.frustration.type` *[3]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str[] | 挫败类型 |
431
+ | `attributes.action.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 操作 ID |
432
+ | `attributes.action.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 可读的低基数动作名称,也是 `span_name` |
433
+ | `attributes.action.type` *[2]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 操作类型 |
434
+ | `attributes.action.target.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 操作元素 |
435
+ | `attributes.action.target.tag` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 操作元素标签 |
436
+ | `attributes.action.frustration.type` *[3]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str[] | 异常点击类型 |
383
437
 
384
438
 
385
439
  **[1] `attributes.action.loading_time`**:当前浏览器 SDK 不写该 Attribute。有页面活动时,用 Span 起止时间(后端 `elapsed_time`)表达持续时长。
@@ -389,7 +443,7 @@ View B █████████████
389
443
  | 常见值 | 描述 |
390
444
  | -------------------- | ---------------------------------- |
391
445
  | `click` | 鼠标或指针设备触发的点击,蓝鲸 Web 自动 Action 当前使用该值。 |
392
- | `custom` | 通过 `reportAction({ name })` 主动上报;Span 名为 `action.<name>`。 |
446
+ | `custom` | 通过 `reportAction({ name })` 主动上报;Span 名使用 `action.name`。 |
393
447
  | `tap` | 触屏设备上的单次轻触。 |
394
448
  | `scroll` | 页面或滚动容器的滚动操作。 |
395
449
  | `swipe` | 触屏设备上的滑动手势。 |
@@ -400,11 +454,11 @@ View B █████████████
400
454
 
401
455
  **[3] `attributes.action.frustration.type`**:
402
456
 
403
- | 值 | 描述 |
404
- | ------------- | ------------------------------------------------------------------------------------ |
405
- | `rage_click` | [a] `1 s` 内对同一 DOM 元素连续点击至少 `3` 次,且相邻点击距离不超过 `100 px`。<br />[b] 滚动或文本选择会中断或撤销判定。 |
406
- | `dead_click` | [a] 点击后未检测到请求、资源加载、长任务、DOM 变化、打开窗口或错误,也没有输入、滚动或文本选择。<br />[b] 链接、文本输入框等难以可靠判断的目标会排除。 |
407
- | `error_click` | Action 生命周期内检测到前端错误。 |
457
+ | 值 | 描述 | 备注 |
458
+ | ------------- | ---- | ------------------------------------------------------------------------------------ |
459
+ | `rage_click` | 愤怒点击 | [a] `1 s` 内对同一 DOM 元素连续点击至少 `3` 次,且相邻点击距离不超过 `100 px`。<br />[b] 滚动或文本选择会中断或撤销判定。 |
460
+ | `dead_click` | 无响应点击 | [a] 点击后未检测到请求、资源加载、长任务、DOM 变化、打开窗口或错误,也没有输入、滚动或文本选择。<br />[b] 链接、文本输入框等难以可靠判断的目标会排除。 |
461
+ | `error_click` | 报错点击 | Action 生命周期内检测到前端错误。 |
408
462
 
409
463
  该字段为数组,同一个 Action 可以同时命中多个值;未命中时不写入。消费端应按集合处理,不依赖数组顺序。这些信号是 SDK 的启发式判断,不等同于业务操作失败。
410
464
 
@@ -413,43 +467,43 @@ View B █████████████
413
467
  | 字段 | 状态 | 类型 | 描述 | |
414
468
  | -------------------------------------- | ---------------------------------------------------------- | --- | ------ | ---------------------------- |
415
469
  | `attributes.url.full` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 完整 URL | 如 `https://example.com/apm`。 |
416
- | `attributes.url.scheme` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 协议 | 如 `ws`、`wss`。 |
417
- | `attributes.url.template` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 请求路径 | 如 `/api/users/`。 |
418
- | `attributes.http.request.method` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 请求方法 | 如 `GET`、`POST`。 |
419
- | `attributes.http.response.status_code` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 返回码 | 如 `200`、`404`。 |
420
- | `attributes.server.address` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 地址 | 如 `example.com`。 |
421
- | `attributes.server.port` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 端口 | -- |
470
+ | `attributes.url.scheme` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | URL 协议 | 如 `ws`、`wss`。 |
471
+ | `attributes.url.template` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 资源路径 | 如 `/api/users/`。 |
472
+ | `attributes.http.request.method` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 请求方法 | Fetch/XHR 使用实际方法;其他 Resource 固定为 `GET`。 |
473
+ | `attributes.http.response.status_code` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | HTTP 状态码 | 如 `200`、`404`。 |
474
+ | `attributes.server.address` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 服务器地址 | 如 `example.com`。 |
475
+ | `attributes.server.port` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 服务器端口 | -- |
422
476
 
423
477
  ### k. vital
424
478
 
425
479
  | 字段 | 状态 | 类型 | 描述 | 备注 |
426
480
  | --------------------------------------------- | ---------------------------------------------------------- | ------ | -------------------- | ------------------------------------ |
427
- | `attributes.vital.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Vital 唯一标识 | |
428
- | `attributes.vital.metric` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 指标名 | |
429
- | `attributes.vital.value` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 指标测量值 | |
481
+ | `attributes.vital.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 指标 ID | |
482
+ | `attributes.vital.metric` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | enum | 指标 | |
483
+ | `attributes.vital.value` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 指标值 | |
430
484
  | `attributes.vital.inp.input_delay` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 输入延迟(ms) | 用户发起交互(如点击)到事件处理器开始执行的等待时间,反映主线程繁忙程度 |
431
- | `attributes.vital.inp.interaction_target` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 交互目标元素标识 | 如 `div`。 |
485
+ | `attributes.vital.inp.interaction_target` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 交互目标元素 | 如 `div`。 |
432
486
  | `attributes.vital.inp.interaction_type` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 交互类型 | -- |
433
- | `attributes.vital.inp.processing_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 处理耗时(ms) | -- |
487
+ | `attributes.vital.inp.processing_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 交互处理耗时(ms) | -- |
434
488
  | `attributes.vital.inp.presentation_delay` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 呈现延迟(ms) | -- |
435
- | `attributes.vital.lcp.target` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | DOM 选择器 | 如 `div`。 |
436
- | `attributes.vital.lcp.url` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 元素对应资源 URL(已脱敏) | -- |
437
- | `attributes.vital.lcp.resource_load_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 资源加载耗时(ms) | -- |
438
- | `attributes.vital.lcp.element_render_delay` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 元素渲染延迟(ms) | -- |
439
- | `attributes.vital.ttfb.waiting_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 请求就绪后的等待耗时(ms) | -- |
440
- | `attributes.vital.ttfb.dns_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DNS 解析耗时(ms) | -- |
441
- | `attributes.vital.ttfb.connection_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | TCP + TLS 连接建立耗时(ms) | -- |
442
- | `attributes.vital.ttfb.request_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 请求发送后等待首字节耗时(ms) | -- |
489
+ | `attributes.vital.lcp.target` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | LCP 元素选择器 | 如 `div`。 |
490
+ | `attributes.vital.lcp.url` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | LCP 资源 URL(已脱敏) | -- |
491
+ | `attributes.vital.lcp.resource_load_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | LCP 资源加载耗时(ms) | -- |
492
+ | `attributes.vital.lcp.element_render_delay` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | LCP 元素渲染延迟(ms) | -- |
493
+ | `attributes.vital.ttfb.waiting_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 请求准备耗时(ms) | -- |
494
+ | `attributes.vital.ttfb.dns_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | DNS 阶段耗时(ms) | -- |
495
+ | `attributes.vital.ttfb.connection_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 连接耗时(含 TLS)(ms) | -- |
496
+ | `attributes.vital.ttfb.request_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 请求阶段耗时(ms) | -- |
443
497
 
444
498
  **[1] `attributes.vital.metric`**:
445
499
 
446
500
  | 值 | 描述 | 备注 |
447
501
  | ---- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
448
- | cls | [累积布局偏移(Cumulative Layout Shift)](https://web.dev/articles/cls) | 在整个页面生命周期中,每次出现的意外布局变化所导致的最大布局变化得分的累积值,为了提供良好的用户体验,网站的 CLS 得分应控制在 0.1 或更低。 |
449
- | inp | [交互到下一次绘制(Interaction to Next Paint)](https://web.dev/articles/inp) | 记录用户与页面进行的所有交互的延迟情况,并给出一个综合评分(通常是 P98,忽略极端值),较低的 INP 值意味着页面能够快速响应所有或绝大多数用户交互,INP 值在用户离开页面时会被计算出来。 |
450
- | lcp | [最大内容绘制(Largest Contentful Paint, LCP)](https://web.dev/articles/lcp) | Core Web Vital 中的一个重要且稳定的指标,测量从页面开始加载,到视窗中可见的最大图像、文本块或视频的渲染时间,用于衡量页面加载的速度(用户感受:页面主要内容出来了)。 |
451
- | fcp | [首次内容绘制(First Contentful Paint)](https://web.dev/articles/fcp) | 从用户首次访问页面,到页面第一次显示出任何内容的耗时(用户感受:不是白屏了)。 |
452
- | ttfb | [首字节时间(Time to First Byte)](https://web.dev/articles/ttfb) | 从用户开始导航到页面到响应首字节开始传输之间所经历的时间。 |
502
+ | cls | [CLS(累积布局偏移)](https://web.dev/articles/cls) | 在整个页面生命周期中,每次出现的意外布局变化所导致的最大布局变化得分的累积值,为了提供良好的用户体验,网站的 CLS 得分应控制在 0.1 或更低。 |
503
+ | inp | [INP(交互到下一次绘制)](https://web.dev/articles/inp) | 记录用户与页面进行的所有交互的延迟情况,并给出一个综合评分(通常是 P98,忽略极端值),较低的 INP 值意味着页面能够快速响应所有或绝大多数用户交互,INP 值在用户离开页面时会被计算出来。 |
504
+ | lcp | [LCP(最大内容绘制)](https://web.dev/articles/lcp) | Core Web Vital 中的一个重要且稳定的指标,测量从页面开始加载,到视窗中可见的最大图像、文本块或视频的渲染时间,用于衡量页面加载的速度(用户感受:页面主要内容出来了)。 |
505
+ | fcp | [FCP(首次内容绘制)](https://web.dev/articles/fcp) | 从用户首次访问页面,到页面第一次显示出任何内容的耗时(用户感受:不是白屏了)。 |
506
+ | ttfb | [TTFB(首字节耗时)](https://web.dev/articles/ttfb) | 从用户开始导航到页面到响应首字节开始传输之间所经历的时间。 |
453
507
 
454
508
  **[2] `attributes.vital.value`**:CLS 单位为 `1`,FCP、INP、LCP、TTFB 单位为 `ms`。
455
509
 
@@ -461,8 +515,8 @@ View B █████████████
461
515
  | ------------- | ------------- |
462
516
  | `keyup` | 松开按键 |
463
517
  | `keydown` | 按下按键 |
464
- | `pointerdown` | 点击(鼠标、触屏、触控笔) |
465
- | `pointerup` | 松开 |
518
+ | `pointerdown` | 指针按下 |
519
+ | `pointerup` | 指针松开 |
466
520
 
467
521
  **[5] `attributes.vital.inp.processing_duration`**:事件处理回调(如 click handler)本身的执行时间,JS 逻辑过重时这个值会变大。
468
522
 
@@ -489,8 +543,8 @@ View B █████████████
489
543
  | 字段 | 状态 | 类型 | 描述 | 备注 |
490
544
  | ---------------------------------------------- | --------------------------------------------------------------- | ------- | ---------------- | ------------------ |
491
545
  | `attributes.blank_screen.reason` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 白屏判定原因 | |
492
- | `attributes.blank_screen.empty_ratio` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 有效样本中的空白比例 | 回退根节点检测时仍为实际比例,不是固定 `1`。 |
493
- | `attributes.blank_screen.empty_sample_count` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 空白采样数 | |
546
+ | `attributes.blank_screen.empty_ratio` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 空白点占比 | 回退根节点检测时仍为实际比例,不是固定 `1`。 |
547
+ | `attributes.blank_screen.empty_sample_count` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | int | 空白点数量 | |
494
548
 
495
549
  **[1] `attributes.blank_screen.reason`**:
496
550
 
@@ -504,10 +558,10 @@ View B █████████████
504
558
  | 字段 | 状态 | 类型 | 描述 |
505
559
  | ----------------------------------------------- | --------------------------------------------------------------- | ------ | -------------------- |
506
560
  | `attributes.long_task.id` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 长任务或长动画帧 ID |
507
- | `attributes.long_task.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | Performance Entry 名称 |
508
- | `attributes.long_task.entry_type` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 采集条目类型 |
561
+ | `attributes.long_task.name` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 长任务名称 |
562
+ | `attributes.long_task.entry_type` *[1]* | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | str | 长任务类型 |
509
563
  | `attributes.long_task.blocking_duration` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 主线程阻塞耗时(ms) |
510
- | `attributes.long_task.first_ui_event_timestamp` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 首个 UI 事件时间(ms) |
564
+ | `attributes.long_task.first_ui_event_timestamp` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 首个交互事件时间(ms) |
511
565
  | `attributes.long_task.render_start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 渲染阶段开始时间(ms) |
512
566
  | `attributes.long_task.style_and_layout_start` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | number | 样式与布局阶段开始时间(ms) |
513
567
 
@@ -520,149 +574,4 @@ View B █████████████
520
574
 
521
575
  ### n. custom
522
576
 
523
- `reportCustomEvent()` 产生 `custom.<name>` Span。`reportAction({ name })` 产生 `action.<name>`,且 `action.type=custom`;不要把手动 Action 的 Span 名写成固定的 `action.custom`。
524
-
525
- ## 0x04 资源加载时序
526
-
527
- 本文对照 W3C Resource Timing、Chrome Timing 和 web.dev,并给出 Resource Span 请求时序的产品划分。适用范围是单次 `resource` Span 的阶段图,不含 View 导航瀑布。
528
-
529
- 阶段名称靠近 Chrome Timing。每段时长用已上报的 `attributes.resource.*.duration` 计算,起点用对应的 `start`,单位为毫秒,相对该资源 `startTime`。
530
-
531
- 产品按 `attributes.view.id` 关联 View 生命周期快照后,可用 `attributes.view.previous_url_template` 展示资源所属页面的前序路由。该字段与 `attributes.view.url_template` 使用同一模板规则,初始 View 为空字符串;它不参与 Resource Timing 阶段计算,也不直接写入 `resource` Span。
532
-
533
- ### a. W3C Resource Timing
534
-
535
- 规范记录的是时间点,不是产品上的色块。浏览器按发生顺序打点,产品上的每一段是相邻两点相减。来源:[Resource Timing](https://www.w3.org/TR/resource-timing/)。
536
-
537
- | 顺序 | 时间点 | 含义 |
538
- | --- | --- | --- |
539
- | 1 | `startTime` | 这次取资源开始 |
540
- | 2 | `redirectStart` | 第一次重定向开始 |
541
- | 3 | `redirectEnd` | 最后一次重定向的响应收完 |
542
- | 4 | `workerStart` | Service Worker 开始处理这次请求;未拦截时为 `0` |
543
- | 5 | `fetchStart` | 重定向结束后,开始取最终资源 |
544
- | 6 | `domainLookupStart` | DNS 查询开始 |
545
- | 7 | `domainLookupEnd` | DNS 查询结束 |
546
- | 8 | `connectStart` | 开始建立到服务器的连接 |
547
- | 9 | `secureConnectionStart` | TLS 握手开始;非 HTTPS 时为 `0` |
548
- | 10 | `connectEnd` | 连接建立完成,TLS 包含在内 |
549
- | 11 | `requestStart` | 开始向服务器发请求 |
550
- | 12 | `firstInterimResponseStart` | 中间响应,例如 `103` |
551
- | 13 | `responseStart` | 收到响应首字节 |
552
- | 14 | `finalResponseHeadersStart` | 最终响应头开始,通常是 `200` |
553
- | 15 | `responseEnd` | 最后一字节到达,或连接先关闭 |
554
-
555
- 用上面的时间点可以算出这些耗时:
556
-
557
- | 顺序 | 耗时 | 计算 |
558
- | --- | --- | --- |
559
- | 1 | 重定向 | `redirectEnd − redirectStart` |
560
- | 2 | Service Worker | `fetchStart − workerStart` |
561
- | 3 | DNS | `domainLookupEnd − domainLookupStart` |
562
- | 4 | 建立连接(含 TLS) | `connectEnd − connectStart` |
563
- | 5 | TLS 握手 | `connectEnd − secureConnectionStart` |
564
- | 6 | 发出请求后等到首字节 | `responseStart − requestStart` |
565
- | 7 | 接收响应体 | `responseEnd − responseStart` |
566
-
567
- 规范没有排队时间点。跨源资源未通过 Timing-Allow-Origin 检查时,重定向到 `responseStart` 之间的点会变成 `0`,只保留 `startTime`、`fetchStart`、总时长和 `responseEnd`。
568
-
569
- `workerStart` 是重定向链最终请求上的 Service Worker 开始时间。`fetchStart` 是 post-redirect start。产品上的「后台脚本处理」发生在重定向之后。
570
-
571
- ### b. Chrome Timing
572
-
573
- Chrome 开发者工具中,点开一条请求的 Timing。一次请求不会出现全部标签。来源:[Chrome 网络面板说明](https://developer.chrome.com/docs/devtools/network/reference)。
574
-
575
- | 顺序 | Timing 标签 | 含义 |
576
- | --- | --- | --- |
577
- | 1 | Queueing | 连接开始前排队:存在更高优先级请求,或同一源连接数已满 |
578
- | 2 | Stalled | 连接开始后仍可能因 Queueing 同类原因停滞 |
579
- | 3 | DNS Lookup | 解析域名对应的 IP |
580
- | 4 | Initial connection | 建立连接,包含 TCP 握手和 TLS,不单列 TLS |
581
- | 5 | Proxy negotiation | 与代理协商,仅走代理时出现 |
582
- | 6 | Request sent | 正在发送 HTTP 请求 |
583
- | 7 | ServiceWorker Preparation | 正在启动 Service Worker |
584
- | 8 | Request to ServiceWorker | 请求交给 Service Worker |
585
- | 9 | Waiting (TTFB) | 请求已发出,等待响应首字节。包含一趟网络往返和服务器准备时间 |
586
- | 10 | Content Download | 读取响应体 |
587
-
588
- 常见可见:Queueing、DNS Lookup、Initial connection、Waiting (TTFB)、Content Download。连接已建立时,DNS Lookup 和 Initial connection 经常为 `0`。
589
-
590
- Chrome 不单独上报 Queueing / Stalled / Request sent 到 RUM 字段,产品阶段图无法画出这三行。
591
-
592
- ### c. Google web.dev
593
-
594
- web.dev 讲解同一组时间点,并单独定义页面导航的 Time to First Byte(TTFB,首字节时间)。来源:[Navigation and Resource Timing](https://web.dev/articles/navigation-and-resource-timing)、[TTFB](https://web.dev/articles/ttfb)。
595
-
596
- | 顺序 | 阶段 | 时间点 | 含义 |
597
- | --- | --- | --- | --- |
598
- | 1 | Redirects | `redirectStart` / `redirectEnd` | HTTP 重定向 |
599
- | 2 | DNS lookup | `domainLookupStart` / `domainLookupEnd` | DNS 解析 |
600
- | 3 | Connection | `connectStart` → `secureConnectionStart` → `connectEnd` | 建连,HTTPS 时包含 TLS,TLS 耗时 = `connectEnd − secureConnectionStart` |
601
- | 4 | Fetch | `fetchStart` | 开始取资源,会先查缓存 |
602
- | 5 | Service worker | `workerStart` | 未拦截时为 `0` |
603
- | 6 | Request | `requestStart` → `responseStart` | 发出请求到收到首字节 |
604
- | 7 | Response | `responseStart` → `responseEnd` | 接收响应体 |
605
-
606
- web.dev 的页面 TTFB 从导航开始算到 `responseStart`,包含:
607
-
608
- 1. 重定向
609
- 2. Service Worker 启动(如有)
610
- 3. DNS
611
- 4. 建连和 TLS
612
- 5. 发出请求直到首字节到达
613
-
614
- Chrome Timing 的 Waiting (TTFB) 只等于第 `5` 项。Resource Span 的「等待首字节」跟 Chrome 这一行走,对应 `resource.first_byte.duration`。
615
-
616
- ### d. 产品建议
617
-
618
- 始终展示查找服务器、建立连接、加密连接、等待首字节、下载内容。上报了重定向或 Service Worker 时,再增加对应行。
619
-
620
- 时长用 `resource.*.duration`。建立连接需要减去 TLS:W3C 的 `connectEnd − connectStart` 已包含加密,直接展示完整 `connect.duration` 会和下一行重复。无 `ssl` 时使用完整 `connect.duration`。
621
-
622
- #### 阶段与计算
623
-
624
- | 顺序 | 产品名 | 出现条件 | 时长 |
625
- | --- | --- | --- | --- |
626
- | 1 | 重定向 | 上报了 `redirect.start` 和 `redirect.duration` | `attributes.resource.redirect.duration` |
627
- | 2 | 后台脚本处理 | 上报了 `worker.start` 和 `worker.duration` | `attributes.resource.worker.duration` |
628
- | 3 | 查找服务器 | 始终占一行 | `attributes.resource.dns.duration` |
629
- | 4 | 建立连接 | 始终占一行 | 有 `ssl` 时:`connect.duration − ssl.duration`<br />无 `ssl` 时:`connect.duration` |
630
- | 5 | 加密连接 | 始终占一行 | `attributes.resource.ssl.duration` |
631
- | 6 | 等待首字节 | 始终占一行 | `attributes.resource.first_byte.duration` |
632
- | 7 | 下载内容 | 始终占一行 | `attributes.resource.download.duration` |
633
-
634
- 时间轴上,建立连接画到 `ssl.start`,加密连接从 `ssl.start` 画到 `connect` 结束。
635
-
636
- #### 说明与用户感受
637
-
638
- | 阶段 | 说明 | 用户感受 |
639
- | --- | --- | --- |
640
- | 重定向 | [a] 浏览器跟随 HTTP 重定向,直到拿到最终 URL,对应 `redirectEnd − redirectStart`<br />[b] 未发生重定向时不上报 | [a] 目标内容还没开始出现<br />[b] 文档请求会延长白屏,接口请求会延长 loading |
641
- | 后台脚本处理 | [a] Service Worker 拦截并处理该请求的时间,对应 `fetchStart − workerStart`<br />[b] 记录的是重定向之后、最终请求上的处理<br />[c] 未拦截时不上报 | [a] 界面没有单独提示<br />[b] 用户只会感到这次加载更慢,无法分辨是后台脚本在处理 |
642
- | 查找服务器 | [a] DNS 解析耗时,对应 `domainLookupEnd − domainLookupStart`<br />[b] 解析结果已缓存、或未发起新查询时,可能为 `0` 或不上报 | [a] 内容尚未出现<br />[b] 用户无法感知「正在解析域名」,体验上仍是点了之后没有反应 |
643
- | 建立连接 | [a] 传输连接中扣除 TLS 后的部分<br />[b] W3C 的 `connectEnd − connectStart` 包含加密,产品用 `connect.duration − ssl.duration`,避免与下一行重复 | [a] 内容尚未出现<br />[b] 用户无法感知「正在建连」,体验上仍是在等待 |
644
- | 加密连接 | [a] TLS 握手,对应 `connectEnd − secureConnectionStart`<br />[b] 非 HTTPS、或未发生新握手时不上报 | [a] 内容尚未出现<br />[b] 用户无法感知「正在握手」,体验上仍是在等待 |
645
- | 等待首字节 | [a] 从发出请求到收到响应首字节,对应 `responseStart − requestStart`<br />[b] 包含网络往返和服务端处理,浏览器时序无法拆分<br />[c] 对齐 Chrome Waiting (TTFB),范围小于 web.dev 的页面 TTFB | [a] 本次请求的内容仍不可见:页面持续白屏或停留在旧画面,接口持续 loading<br />[b] 过慢时会感觉页面没有反应 |
646
- | 下载内容 | [a] 从收到首字节到响应体接收完毕,对应 `responseEnd − responseStart`<br />[b] 耗时主要随体积和带宽变化 | [a] 内容开始出现并逐渐完整,图片、脚本会陆续可见<br />[b] 接口数据会从空状态填到页面上<br />[c] 体积大时,用户能感到「出来了但还在加载」 |
647
-
648
- 等待首字节拆不开服务端处理与网络往返。要判断服务端是否慢,需要结合 Trace 或 [Server Timing](https://www.w3.org/TR/server-timing/)。
649
-
650
- #### 缺数字段
651
-
652
- | 上报情况 | 页面展示 |
653
- | --- | --- |
654
- | `start` 与 `duration` 都在,且 `duration > 0` | 显示毫秒数,画出色块 |
655
- | `start` 与 `duration` 都在,且 `duration = 0` | 写 `0` 毫秒。该步骤没有额外耗时 |
656
- | 缺少 `start` 或 `duration` | 写「没有上报」,不画色块。可能该步骤未发生,也可能跨源不允许查看细分时间 |
657
-
658
- 查找服务器、建立连接、加密连接都没有上报时,写「没有上报」。跨源资源未暴露细分时间时表现相同,不能据此判断连接复用。
659
-
660
- ### e. 参考资料
661
-
662
- | 来源 | 文档 |
663
- | --- | --- |
664
- | W3C | [Resource Timing](https://www.w3.org/TR/resource-timing/) |
665
- | W3C | [Server Timing](https://www.w3.org/TR/server-timing/) |
666
- | Chrome | [网络面板 · Timing](https://developer.chrome.com/docs/devtools/network/reference) |
667
- | web.dev | [Navigation and Resource Timing](https://web.dev/articles/navigation-and-resource-timing) |
668
- | web.dev | [Time to First Byte](https://web.dev/articles/ttfb) |
577
+ `reportCustomEvent()` 产生 `custom.<name>` Span。`reportAction({ name })` 产生以 `action.name` 命名的 Span,且 `action.type=custom`。