@blueking/open-telemetry 0.0.25 → 0.0.26

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.
@@ -14,7 +14,7 @@ export declare const getDeviceResourceAttributes: () => Attributes;
14
14
  * - `device.memory_gib`:硬件能力快照,写入 Resource。
15
15
  * - `user_agent.name` / `user_agent.version` / `user_agent.os.name`:User Agent 信息,写入 Resource。
16
16
  * - `browser.viewport.*` / `browser.screen.*`:视口与屏幕尺寸。
17
- * - `network.status` / `network.effective_type` / `network.connection_type`:网络信息。
17
+ * - `network.status` / `network.effective_type` / `network.connection.type`:网络信息。
18
18
  *
19
19
  * 实时更新:
20
20
  * - viewport 监听 `resize` / `orientationchange`,并经 250ms debounce 合并,避免拖窗口时高频触发;
@@ -48,10 +48,10 @@ export declare const RUM_ATTRIBUTES: {
48
48
  readonly viewId: "view.id";
49
49
  readonly viewLoadEvent: "view.load_event";
50
50
  readonly viewLoadingTime: "view.loading_time";
51
+ readonly viewLoadingTimeSource: "view.loading_time_source";
51
52
  readonly viewLoadingType: "view.loading_type";
52
53
  readonly viewName: "view.name";
53
54
  readonly viewPhase: "view.phase";
54
- readonly viewSource: "view.source";
55
55
  readonly viewStartedAt: "view.started_at";
56
56
  readonly viewUrl: "view.url";
57
57
  readonly viewUrlPathGroup: "view.url_path_group";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/open-telemetry",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "OpenTelemetry browser SDK for BK RUM",
5
5
  "author": "TencentCloud Real User Monitoring",
6
6
  "main": "dist/index.js",
@@ -137,7 +137,7 @@ Device 插件还维护:
137
137
  | `browser.screen.width/height` | 启动、resize、orientationchange |
138
138
  | `network.status` | 启动、online、offline、connection change |
139
139
  | `network.effective_type` | 启动和 connection change |
140
- | `network.connection_type` | 同上 |
140
+ | `network.connection.type` | 同上 |
141
141
 
142
142
  视口变化使用 250ms trailing debounce。`network.status` 在浏览器环境中始终存在,其他网络字段只有浏览器实现 Network Information API 时才存在。这些变化不主动生成 Span,只影响后续 Span 的上下文。
143
143
 
@@ -106,7 +106,7 @@ Resource Attribute 描述产生 Span 的 SDK 实例和运行环境,同一实
106
106
  | `browser.screen.height` | number | 浏览器提供 `window.screen` 时 | 当前屏幕高度,单位 CSS px;不是当前网页可用区域高度。 |
107
107
  | `network.status` | string | 浏览器环境 | 根据 `navigator.onLine` 取 `connected` 或 `not_connected`;表示浏览器判断的联网状态,不保证目标服务实际可达。 |
108
108
  | `network.effective_type` | string | Network Information API 支持 | 浏览器估算的有效网络类型,常见为 `slow-2g`、`2g`、`3g`、`4g`。它反映体验模型,不等同于真实无线制式。 |
109
- | `network.connection_type` | string | 浏览器提供 `connection.type` 时 | 浏览器返回的原始连接类型,例如 `wifi`、`cellular`、`ethernet`;多数 Safari/Firefox 环境可能缺失。 |
109
+ | `network.connection.type` | string | 浏览器提供 `connection.type` 时 | 浏览器返回的原始连接类型,例如 `wifi`、`cellular`、`ethernet`;多数 Safari/Firefox 环境可能缺失。 |
110
110
 
111
111
  默认 `context.attributes.page()` 返回空对象,不附加独立页面属性。页面地址使用 View 创建时冻结并经过 `redactUrl` 的 `view.url`,低基数路由聚合使用 `view.url_path_group`;业务需要额外页面维度时可自定义该 Hook。
112
112
 
@@ -125,7 +125,7 @@ Resource Attribute 描述产生 Span 的 SDK 实例和运行环境,同一实
125
125
  | Span 名 | Kind | `span_type` | 领域分类字段 | 默认状态/入口 | 表达的事件 |
126
126
  | ---------------------------- | -------- | ----------- | --------------------------------- | --------------------------------- | -------------------------------------------------- |
127
127
  | `browser.session` | INTERNAL | `session` | `session.phase` | 始终随 SDK 启动 | Session 创建、轮换和结束生命周期。 |
128
- | `browser.view` | INTERNAL | `view` | `view.phase`、`view.source` | 自动;可切为手动 View | 初始页面或 SPA View 的 start/update/end 快照。 |
128
+ | `browser.view` | INTERNAL | `view` | `view.phase` | 自动;可切为手动 View | 初始页面或 SPA View 的 start/update/end 快照。 |
129
129
  | `browser.resource` | CLIENT | `resource` | `resource.type` | 请求、静态资源默认开启 | Fetch、XHR 或静态资源加载。 |
130
130
  | `browser.error` | INTERNAL | `error` | `error.source=window.error` | 错误采集默认开启 | `window.error` 捕获的 JavaScript 运行时错误。 |
131
131
  | `browser.unhandledrejection` | INTERNAL | `error` | `error.source=unhandledrejection` | 错误采集默认开启 | 未处理的 Promise rejection。 |
@@ -162,7 +162,6 @@ Session Span 允许没有 `view.id`:SDK 先建立 Session,再创建初始 Vi
162
162
  | 字段 | 类型 | 条件/单位 | 来源与详细说明 |
163
163
  | -------------------------- | ------ | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
164
164
  | `view.phase` | string | `start`、`update`、`end` | `start` 创建 View;`update` 写入自动/手动 Loading Time 或名称更新;`end` 关闭 View。 |
165
- | `view.source` | string | 所有阶段 | 创建来源会沿用到该 View 后续事件:`load`、`manual`、`pushState`、`replaceState`、`popstate`、`hashchange`、`bfCache`、`sessionRenewal`。 |
166
165
  | `view.id` | string | 所有阶段 | View 关联 ID。同一 View 的 start/update/end 使用相同值,可与该 View 内其他 Span 关联。 |
167
166
  | `view.version` | number | 从 1 递增 | 每次 `emitViewEvent` 递增;用于恢复同一 View 生命周期快照的先后顺序。 |
168
167
  | `view.started_at` | number | epoch ms | View 开始时间。初始 View 使用 `performance.timeOrigin`,路由/BFCache/续建 View 使用创建时刻。 |
@@ -171,7 +170,7 @@ Session Span 允许没有 `view.id`:SDK 先建立 Session,再创建初始 Vi
171
170
  | `view.url_path_group` | string | 所有阶段 | 低基数路由分组。数字 ID、UUID、长十六进制段默认折叠为 `:id`,用于稳定聚合动态路由。 |
172
171
  | `view.loading_type` | string | 所有阶段 | `initial_load`、`route_change`、`bf_cache` 或 `session_renewal`,含义见运行时公共属性。 |
173
172
  | `view.loading_time` | number | 计算完成后,ms | 从 `view.started_at` 到页面活动稳定的耗时。初始加载同时等待 load event 和页面活动,以较晚者为准;可由 `setViewLoadingTime()` 手动结束。 |
174
- | `view.loading_time.source` | string | 有 `view.loading_time` 时 | `auto` 表示 SDK 自动观察页面活动;`manual` 表示业务调用 `setViewLoadingTime()`。 |
173
+ | `view.loading_time_source` | string | 有 `view.loading_time` 时 | `auto` 表示 SDK 自动观察页面活动;`manual` 表示业务调用 `setViewLoadingTime()`。 |
175
174
  | `view.end_reason` | string | 仅 `end` | 结束原因:路由来源值、`manual`、`bfcache`、`pagehide`、`session_expired` 或 `shutdown`。它说明为何关闭旧 View,不是新 View 的加载类型。 |
176
175
  | `url.previous` | string | 所有阶段 | 创建 View 时记录的前序 URL,经 `redactUrl` 脱敏;初始 View 通常为空字符串。 |
177
176
  | `document.referrer` | string | 仅 `initial_load` | `document.referrer` 经 `redactUrl` 脱敏;没有来源页面时为空字符串。 |
@@ -26,8 +26,6 @@ View 表示一次可独立分析的页面体验。初始文档加载、SPA 路
26
26
  - query-only 变化不创建 View;
27
27
  - 指向当前页面真实元素 ID 的 hash 视为页内锚点,不创建 View。
28
28
 
29
- 路由触发源写入 `view.source`,初始加载为 `load`,手动调用为 `manual`,其余使用对应 History/浏览器事件名。
30
-
31
29
  ## 手动 View 模式
32
30
 
33
31
  框架路由希望完全控制边界时:
@@ -144,7 +142,7 @@ Span 名固定为 `browser.view`:
144
142
  - SPA/BFCache/Session Renewal:只有观察到页面活动时才生成自动 Loading Time,取 View 开始到页面活动结束的耗时。
145
143
  - 页面在计算期间变为 hidden:取消自动计算,不上报不可靠结果。
146
144
 
147
- `view.loading_time.source=auto` 表示自动计算。
145
+ `view.loading_time_source=auto` 表示自动计算。
148
146
 
149
147
  ## 排除长轮询和无关活动
150
148
 
@@ -176,7 +174,7 @@ bkOT.setViewLoadingTime();
176
174
 
177
175
  SDK 计算“调用时刻 - View 开始时间”,取消仍在进行的自动计算,并发送 update:
178
176
 
179
- - `view.loading_time.source=manual`
177
+ - `view.loading_time_source=manual`
180
178
  - 多次调用以后一次为准;每次都会产生新版本 update。
181
179
  - 没有采样有效 View 时忽略。
182
180