@blueking/open-telemetry 0.0.22 → 0.0.24
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.
- package/README.md +256 -70
- package/dist/bk-rum.global.js +2 -2
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/core/config.d.ts +4 -2
- package/dist/core/processor.d.ts +2 -2
- package/dist/core/runtime-context.d.ts +4 -0
- package/dist/core/sampling.d.ts +0 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +395 -477
- package/dist/index.js.map +1 -1
- package/dist/plugins/blank-screen.d.ts +1 -1
- package/dist/plugins/common.d.ts +3 -4
- package/dist/plugins/web-vitals.d.ts +0 -5
- package/dist/schema/attributes.d.ts +6 -8
- package/dist/schema/span.d.ts +24 -15
- package/package.json +1 -1
- package/skills/bk-rum-otele/SKILL.md +26 -23
- package/skills/bk-rum-otele/references/actions.md +166 -0
- package/skills/bk-rum-otele/references/api.md +248 -215
- package/skills/bk-rum-otele/references/architecture.md +139 -37
- package/skills/bk-rum-otele/references/blank-screen.md +190 -0
- package/skills/bk-rum-otele/references/capabilities.md +175 -83
- package/skills/bk-rum-otele/references/configuration.md +226 -151
- package/skills/bk-rum-otele/references/data-model.md +156 -24
- package/skills/bk-rum-otele/references/errors-security.md +168 -0
- package/skills/bk-rum-otele/references/extensions.md +236 -0
- package/skills/bk-rum-otele/references/framework-integration.md +318 -75
- package/skills/bk-rum-otele/references/getting-started.md +186 -70
- package/skills/bk-rum-otele/references/network.md +258 -0
- package/skills/bk-rum-otele/references/performance.md +197 -0
- package/skills/bk-rum-otele/references/privacy.md +236 -67
- package/skills/bk-rum-otele/references/production.md +264 -0
- package/skills/bk-rum-otele/references/session-context.md +185 -0
- package/skills/bk-rum-otele/references/telemetry-reference.md +479 -51
- package/skills/bk-rum-otele/references/transport-sampling.md +318 -32
- package/skills/bk-rum-otele/references/troubleshooting.md +341 -151
- package/skills/bk-rum-otele/references/views-routing.md +211 -0
- package/skills/bk-rum-otele/references/concepts.md +0 -60
- package/skills/bk-rum-otele/references/custom-plugin.md +0 -170
- package/skills/bk-rum-otele/references/plugins-basic.md +0 -135
- package/skills/bk-rum-otele/references/plugins-error-security.md +0 -83
- package/skills/bk-rum-otele/references/plugins-experience.md +0 -124
- package/skills/bk-rum-otele/references/plugins-network.md +0 -32
- package/skills/bk-rum-otele/references/plugins.md +0 -62
|
@@ -2,97 +2,189 @@
|
|
|
2
2
|
|
|
3
3
|
# 能力矩阵
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
5
|
+
本页用于快速判断:是否默认启用、监听什么浏览器来源、产出什么 Span、在哪些情况下退化。精确算法和字段继续进入对应专题页。
|
|
6
|
+
|
|
7
|
+
## 总体边界
|
|
8
|
+
|
|
9
|
+
SDK 只产生原始 RUM Span:
|
|
10
|
+
|
|
11
|
+
- 一个 `WebTracerProvider`;
|
|
12
|
+
- 一个 OTLP/HTTP JSON 出口 `<endpoint>/v1/rum`;
|
|
13
|
+
- 不创建 Metric/Log Provider;
|
|
14
|
+
- 不在浏览器聚合计数、分位数、直方图或错误指纹;
|
|
15
|
+
- 服务端从原始 Session/View/Action/Resource/Error/Vital Span 派生统计。
|
|
16
|
+
|
|
17
|
+
普通 Span 必须命中 Session 采样,并关联有效 `session.id` 与 `view.id` 才能导出;Session 生命周期 Span 可以没有 View。
|
|
18
|
+
|
|
19
|
+
## 全部能力
|
|
20
|
+
|
|
21
|
+
| 能力 | 配置/API | 默认 | 浏览器来源 | 主要 Span | 详情 |
|
|
22
|
+
| --- | --- | --- | --- | --- | --- |
|
|
23
|
+
| Session | `session` | 基础能力 | localStorage、活动、visibility、storage | `browser.session` | [Session 上下文](./session-context.md) |
|
|
24
|
+
| View / Router | `tracking.view` | auto | Navigation Timing、History、hash、BFCache | `browser.view` | [View 与路由](./views-routing.md) |
|
|
25
|
+
| View Loading Time | `tracking.view.loadingTime` | 开 | 请求/资源/DOM/`window.open` 活动 | `browser.view` update | [View 与路由](./views-routing.md) |
|
|
26
|
+
| Fetch/XHR | `tracking.request` | 开 | fetch、XMLHttpRequest、Resource Timing | `browser.resource` CLIENT | [网络](./network.md) |
|
|
27
|
+
| Trace Header | `allowedTracingUrls` | 无白名单 | W3C Trace Context | 被观测请求的 `traceparent` | [网络](./network.md) |
|
|
28
|
+
| 静态资源 | `tracking.resource` | 开 | Resource PerformanceObserver | `browser.resource` CLIENT | [网络](./network.md) |
|
|
29
|
+
| JS Error | `tracking.error` | 开 | window error | `browser.error` | [错误与安全](./errors-security.md) |
|
|
30
|
+
| Promise rejection | `tracking.error` | 开 | unhandledrejection | `browser.unhandledrejection` | [错误与安全](./errors-security.md) |
|
|
31
|
+
| 资源加载错误 | `tracking.error` | 开 | capture error | `browser.resource_error` | [错误与安全](./errors-security.md) |
|
|
32
|
+
| Web Vitals | `tracking.webVitals` | 开 | web-vitals、PerformanceObserver | `browser.web_vital` | [性能体验](./performance.md) |
|
|
33
|
+
| 自动 Action | `tracking.action` | 开 | click、Activity 总线 | `action.click` | [用户操作](./actions.md) |
|
|
34
|
+
| 手动 Action | `reportAction()` | 可调用 | 业务调用 | `action.custom` | [用户操作](./actions.md) |
|
|
35
|
+
| Custom event | `reportCustomEvent()` | 可调用 | 业务调用 | `custom.<name>` | [API](./api.md) |
|
|
36
|
+
| Blank Screen | `tracking.blankScreen` | 开 | DOM 九点采样、页面活动 | `browser.blank_screen` | [白屏](./blank-screen.md) |
|
|
37
|
+
| Device | `tracking.device` | 开 | UA/UA-CH、Screen、Network Information | Resource/运行时属性 | [Session 上下文](./session-context.md) |
|
|
38
|
+
| Long Task | `tracking.longTask` | 关 | LoAF 或 Long Tasks | `browser.long_task` | [性能体验](./performance.md) |
|
|
39
|
+
| CSP | `tracking.cspViolation` | 关 | securitypolicyviolation | `csp.violation` | [错误与安全](./errors-security.md) |
|
|
40
|
+
| WebSocket | `tracking.websocket` | 关 | WebSocket constructor/events | `browser.websocket` CLIENT | [网络](./network.md) |
|
|
41
|
+
| RUM Plugin | `extensions.plugins` / `use()` | 无 | 插件决定 | `context.startSpan()` | [扩展](./extensions.md) |
|
|
42
|
+
| OTel Instrumentation | `extensions.instrumentations` / `useInstrumentation()` | 无 | instrumentation 决定 | instrumentation Span | [扩展](./extensions.md) |
|
|
43
|
+
|
|
44
|
+
“默认开”仍要求 `enabled: true`、Consent 为 granted、SDK 已 start、Session 被采样。浏览器缺少所需 API 时对应插件通常静默降级。
|
|
45
|
+
|
|
46
|
+
## 默认开关配置展开
|
|
47
|
+
|
|
48
|
+
以下配置与只传 application/transport 的能力开关等价:
|
|
49
49
|
|
|
50
50
|
```ts
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
tracking: {
|
|
52
|
+
request: true,
|
|
53
|
+
resource: true,
|
|
54
|
+
error: true,
|
|
55
|
+
webVitals: true,
|
|
56
|
+
action: true,
|
|
57
|
+
blankScreen: true,
|
|
58
|
+
device: true,
|
|
59
|
+
longTask: false,
|
|
60
|
+
websocket: false,
|
|
61
|
+
cspViolation: false,
|
|
62
|
+
view: {
|
|
63
|
+
tracking: 'auto',
|
|
64
|
+
loadingTime: true,
|
|
65
65
|
},
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Session
|
|
69
|
+
Session、Activity、Page View 关联基础不提供整体关闭开关。`tracking.view` 可以改 manual,但仍需要 View 才能导出普通 Span。
|
|
70
70
|
|
|
71
|
-
##
|
|
71
|
+
## Session 与公共上下文
|
|
72
72
|
|
|
73
|
-
|
|
|
73
|
+
| 项目 | 当前行为 |
|
|
74
74
|
| --- | --- |
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
75
|
+
| 无活动超时 | 固定 15 分钟 |
|
|
76
|
+
| 最大生命周期 | 固定 4 小时 |
|
|
77
|
+
| 跨 Tab | localStorage + storage event |
|
|
78
|
+
| 存储失败 | 回退进程内存 |
|
|
79
|
+
| 采样 | `application.name + session.id` 稳定 hash |
|
|
80
|
+
| 用户 | 业务传 `user.id`,原样透传 |
|
|
81
|
+
| 设备 ID | 默认每次 Device 插件初始化生成;可选持久化 |
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
Session Span 包括 start/rotate/end;View、Action、Resource 等通过 ID 属性关联,不要求它们共享同一个 Trace。
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
## View 与页面体验
|
|
86
|
+
|
|
87
|
+
View 类型:
|
|
88
|
+
|
|
89
|
+
- `initial_load`:首屏;
|
|
90
|
+
- `route_change`:SPA/手动 route;
|
|
91
|
+
- `bf_cache`:BFCache 恢复;
|
|
92
|
+
- `session_renewal`:Session 轮换后重建 View。
|
|
93
|
+
|
|
94
|
+
每个 View 产生 start/update/end 生命周期 Span,`view.version` 递增。Loading Time 等待页面活动安静后更新;隐藏页面会取消当前自动计算,业务可用 `setViewLoadingTime()` 手动确认。
|
|
95
|
+
|
|
96
|
+
自动 mode 不因 query-only 改变创建 View。默认 path group 只是 pathname,不会自动模板化动态 ID。
|
|
97
|
+
|
|
98
|
+
## 网络与资源
|
|
99
|
+
|
|
100
|
+
Fetch/XHR 插件统一负责:
|
|
101
|
+
|
|
102
|
+
- 建 `browser.resource` CLIENT Span;
|
|
103
|
+
- 请求结果和 HTTP status;
|
|
104
|
+
- 可选 W3C `traceparent`;
|
|
105
|
+
- 与 Resource Timing 在最多 200ms 内匹配;
|
|
106
|
+
- 向 View/Action activity 通知开始与结束。
|
|
107
|
+
|
|
108
|
+
静态资源插件消费 Resource PerformanceEntry。跨域没有 `Timing-Allow-Origin` 时,只发送浏览器能看到的字段,不猜测 DNS/TCP/TLS。
|
|
109
|
+
|
|
110
|
+
WebSocket 仅记录 connect/open/error/close,不记录 message、payload、数量或字节。
|
|
111
|
+
|
|
112
|
+
## 错误与安全
|
|
113
|
+
|
|
114
|
+
自动 Error 会记录:
|
|
115
|
+
|
|
116
|
+
- 归一 Span 分类和 ERROR status;
|
|
117
|
+
- error message/source/handled;
|
|
118
|
+
- 可用时 exception type/message/stack;
|
|
119
|
+
- JS 行列/文件或资源 URL/tag。
|
|
120
|
+
|
|
121
|
+
SDK 不做错误节流、fingerprint 和分组。CSP 插件每次 violation 建原始 Span,可能产生高事件量并包含原始策略。
|
|
122
|
+
|
|
123
|
+
## Web Vitals 与 Long Task
|
|
124
|
+
|
|
125
|
+
Vitals:CLS、FCP、INP、LCP、TTFB。每个指标保留 value、rating 和浏览器可提供的 attribution。CLS 和 INP 按当前 View 聚合边界定稿,不是全站一个永久累计值。
|
|
126
|
+
|
|
127
|
+
Long Task 优先 Long Animation Frame 获取脚本归因,不支持时回退 Long Tasks。默认关闭,threshold 默认 50ms。
|
|
128
|
+
|
|
129
|
+
## Action 与白屏
|
|
130
|
+
|
|
131
|
+
Action 以点击后的副作用窗口建模,关联请求、DOM、错误和页面活动。可识别:
|
|
132
|
+
|
|
133
|
+
- rage click:短时间相近位置的点击链;
|
|
134
|
+
- error click:Action 窗口内出现错误;
|
|
135
|
+
- dead click:没有有效副作用且满足排除条件。
|
|
136
|
+
|
|
137
|
+
默认只从显式 data attribute 命名,不读取任意 DOM 文本。
|
|
138
|
+
|
|
139
|
+
白屏在页面活动稳定后,对视口九点采样并连续确认两次;每个 View 最多上报一次。它是启发式检测,不适合所有 Canvas/iframe/非常规布局。
|
|
140
|
+
|
|
141
|
+
## 浏览器降级矩阵
|
|
142
|
+
|
|
143
|
+
| 缺失/限制 | 降级结果 |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| `PerformanceObserver` 不支持 resource | Fetch/XHR 基础 Span仍可有;资源时序和静态资源跳过 |
|
|
146
|
+
| Long Animation Frame 不支持 | 尝试 Long Tasks API |
|
|
147
|
+
| 两种长任务 API 都不支持 | 不产生 Long Task,不阻断页面 |
|
|
148
|
+
| Event Timing/指标 API 不支持 | 对应 Vital 缺失,不伪造 |
|
|
149
|
+
| 跨域资源无 TAO | 详细 timing/size 可能缺失 |
|
|
150
|
+
| Network Information 不支持 | network.* 运行时字段缺失 |
|
|
151
|
+
| UA-CH 不支持 | 回退 userAgent 解析 |
|
|
152
|
+
| localStorage 抛错 | Session/Device 持久化退回内存 |
|
|
153
|
+
| `elementsFromPoint` 不支持 | 白屏使用单个 `elementFromPoint` |
|
|
154
|
+
| 插件 init 抛错 | 隔离插件;debug 模式警告 |
|
|
155
|
+
| 页面快速退出 | flush/keepalive 尽力发送,不保证交付 |
|
|
156
|
+
|
|
157
|
+
## SDK 明确不提供
|
|
158
|
+
|
|
159
|
+
- HTTP request/response Body;
|
|
160
|
+
- WebSocket message;
|
|
161
|
+
- OpenTelemetry Metric/Log;
|
|
162
|
+
- 客户端 Counter/Histogram/分位数;
|
|
163
|
+
- IP、geo、ASN;
|
|
164
|
+
- 错误 fingerprint/group;
|
|
165
|
+
- Session replay;`session.has_replay` 当前固定 false;
|
|
166
|
+
- 自动 user.id hash;
|
|
167
|
+
- 自动动态路由识别;
|
|
168
|
+
- 离线持久队列和 exactly-once 交付;
|
|
169
|
+
- 服务端 trace 聚合、留存、权限与删除。
|
|
170
|
+
|
|
171
|
+
## 成本和风险选择
|
|
172
|
+
|
|
173
|
+
| 入口 | 主要影响 | 建议 |
|
|
86
174
|
| --- | --- | --- |
|
|
87
|
-
| `session.sampleRate` |
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
175
|
+
| `session.sampleRate` | 全局 Span 量 | 先测平均 Span/Session,再定比例 |
|
|
176
|
+
| `resource` | 页面资源多时事件量大 | 通常保留;用服务端采样/聚合 |
|
|
177
|
+
| `longTask` | 卡顿高时大量事件和脚本字段 | 问题驱动、小流量开启 |
|
|
178
|
+
| `cspViolation` | 策略异常时事件风暴 | 先评估并脱敏 original policy |
|
|
179
|
+
| `websocket` | 全局构造器 patch、长连接 | 只在连接可观测确有需求时开 |
|
|
180
|
+
| Action `text` | DOM 文本隐私 | 保持 explicit,使用稳定 data name |
|
|
181
|
+
| Device persistent ID | 跨 Session 关联 | 需 Consent/存储政策支持 |
|
|
182
|
+
| traceparent | CORS 与第三方泄露 | 精确 allowlist |
|
|
183
|
+
|
|
184
|
+
## 阅读路径
|
|
185
|
+
|
|
186
|
+
- 想先跑起来:[快速上手](./getting-started.md)
|
|
187
|
+
- 准备上线:[生产接入指南](./production.md)
|
|
188
|
+
- 查全部配置:[配置参考](./configuration.md)
|
|
189
|
+
- 查 Span 和字段:[遥测字段字典](./telemetry-reference.md)
|
|
190
|
+
- 理解内部流程:[架构与数据流](./architecture.md)
|