@video-lab/telemetry 1.0.1 → 2.0.0

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 (2) hide show
  1. package/README.md +17 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -4,6 +4,16 @@
4
4
  [`@video-lab/protocol`](https://www.npmjs.com/package/@video-lab/protocol),不发送 HTTP,
5
5
  不依赖 Sentry、React、Vue 或播放器内核。
6
6
 
7
+ ## 安装
8
+
9
+ ```bash
10
+ pnpm add @video-lab/telemetry
11
+ ```
12
+
13
+ 业务应用通常将 `onRecord` 和 `onSummary` 接到已有的传输层;本包不负责网络请求或供应商 SDK 初始化。
14
+
15
+ ## 用法
16
+
7
17
  提供安全的原始事件记录、QoE 会话摘要和受限业务 intent:
8
18
 
9
19
  <!-- doc-snippet-preamble
@@ -31,9 +41,13 @@ telemetry.recordIntent({ type: 'retry', origin: 'user' })
31
41
  telemetry.finish({ reason: 'page_unload' })
32
42
  ```
33
43
 
44
+ ## 数据与隐私
45
+
34
46
  每条 record 有 `eventId`、递增 `sequence`、时间、应用版本和最近的脱敏播放上下文。`error.payload.cause`
35
47
  会被移除;不会输出 URL query、签名、cookie、user ID 或业务 tags。
36
48
 
49
+ ## 会话行为
50
+
37
51
  若宿主的传输层有稳定 delivery id,可传入 `telemetry.record(event, { deliveryId })` 来安全地去重重试。
38
52
  没有该 id 时,相同 payload 仍可能是合法的不同媒体事件,本包不会猜测并丢弃它。
39
53
 
@@ -48,12 +62,13 @@ telemetry.finish({ reason: 'page_unload' })
48
62
  换源时,新 session 的 route 会等同 sessionId 的 `contextchange` 再归属,不能覆盖旧会话;未形成新 context
49
63
  的尝试仍会作为原始 record 送给 sink。
50
64
 
65
+ ## 边界
66
+
51
67
  `recordIntent()` 只接受固定的 `play`、`pause`、`seek`、`retry`、`source_change`、`exit` 和
52
68
  `user` / `api` origin。任意额外字段不会进入 record。sink 的异常被隔离,不会中断播放器;摘要的
53
69
  `completeness` 会报告 context、delivery-id 或 sink 证据缺口。
54
70
 
55
71
  本包不是网络上报客户端。若使用 Sentry,请在业务项目中按自己的已初始化 client 实现 sink,
56
- 不要把 `@sentry/*` 带进本包。映射规则与 React、Vue、iframe、静态 iframe 的完整接入示例见
57
- 请联系项目维护团队获取会话遥测接入的内部使用手册。
72
+ 不要把 `@sentry/*` 带进本包。跨框架映射规则与完整接入示例请向项目维护团队获取。
58
73
 
59
74
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@video-lab/telemetry",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "sideEffects": false,
26
26
  "dependencies": {
27
- "@video-lab/protocol": "1.0.1"
27
+ "@video-lab/protocol": "2.0.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "tsdown": "^0.22.9",