@blueking/open-telemetry 0.0.3 → 0.0.5

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.
@@ -0,0 +1,3 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ export declare const createBlankScreenPlugin: (option: BkOTRumConfig["blankScreen"]) => BkOTPlugin;
@@ -0,0 +1,3 @@
1
+ import type { BkOTInstrumentationsConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ export declare const createCommonInstrumentationsPlugin: (option: BkOTInstrumentationsConfig) => BkOTPlugin;
@@ -0,0 +1,6 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ /**
4
+ * 监听 CSP 违规事件并以 log 形式上报,便于排查脚本/资源被 CSP 拦截的问题。
5
+ */
6
+ export declare const createCspViolationPlugin: (enabled: BkOTRumConfig["cspViolation"]) => BkOTPlugin;
@@ -0,0 +1,7 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ /**
4
+ * 设备级永久标识 + 视口 / 网络元数据。
5
+ * 与 session 插件区分:device 跨会话持久,session 有过期与续期。
6
+ */
7
+ export declare const createDevicePlugin: (option: BkOTRumConfig["device"]) => BkOTPlugin;
@@ -0,0 +1,3 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ export declare const createErrorPlugin: (option: BkOTRumConfig["error"]) => BkOTPlugin;
@@ -0,0 +1,20 @@
1
+ import type { BkOTHttpBodyConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ interface BodySnapshot {
4
+ body: string;
5
+ contentType?: string;
6
+ truncated: boolean;
7
+ }
8
+ export declare const createHttpBodyPlugin: (option: false | Required<BkOTHttpBodyConfig>) => BkOTPlugin;
9
+ declare global {
10
+ interface XMLHttpRequest {
11
+ __bkOtHttpBodyRequest__?: BodySnapshot;
12
+ __bkOtHttpBodyRequestHeaders__?: Record<string, string>;
13
+ __bkOtHttpBodyMeta__?: {
14
+ method: string;
15
+ startTime: number;
16
+ url: string;
17
+ };
18
+ }
19
+ }
20
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ /**
4
+ * Long Task 监控:通过 PerformanceObserver type=longtask 捕获 >= threshold 的主线程长任务。
5
+ * 默认关闭,建议在性能敏感模块按需开启。
6
+ */
7
+ export declare const createLongTaskPlugin: (option: BkOTRumConfig["longTask"]) => BkOTPlugin;
@@ -0,0 +1,3 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ export declare const createPageViewPlugin: (enabled: BkOTRumConfig["pageView"]) => BkOTPlugin;
@@ -0,0 +1,7 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ /**
4
+ * 估算 SPA 路由切换耗时:路由变更 → 双 raf + 一个宏任务后视为"渲染完成"。
5
+ * 不依赖具体框架,但仅是粗粒度估算;如需精确,业务可走自定义 plugin 在框架钩子内 startSpan/end。
6
+ */
7
+ export declare const createRouteTimingPlugin: (enabled: BkOTRumConfig["routeTiming"]) => BkOTPlugin;
@@ -0,0 +1,7 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ /**
4
+ * 会话级标识:带不活跃过期时间,超过 inactivityMs 视为新会话。
5
+ * 与 device 插件互补:device 是设备终身标识,session 反映"用户连续访问"语义。
6
+ */
7
+ export declare const createSessionPlugin: (option: BkOTRumConfig["session"]) => BkOTPlugin;
@@ -0,0 +1,3 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ export declare const createWebVitalsPlugin: (enabled: BkOTRumConfig["webVitals"]) => BkOTPlugin;
@@ -0,0 +1,3 @@
1
+ import type { BkOTRumConfig } from '../core/config';
2
+ import type { BkOTPlugin } from '../core/plugin';
3
+ export declare const createWebSocketPlugin: (enabled: BkOTRumConfig["websocket"]) => BkOTPlugin;
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@blueking/open-telemetry",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "OpenTelemetry browser SDK for BK RUM",
5
5
  "author": "TencentCloud Real User Monitoring",
6
- "main": "src/index.ts",
7
- "types": "src/index.ts",
6
+ "main": "dist/index.js",
8
7
  "unpkg": "dist/bk-rum.global.js",
9
8
  "jsdelivr": "dist/bk-rum.global.js",
10
9
  "license": "MIT",
@@ -12,10 +11,12 @@
12
11
  "dist"
13
12
  ],
14
13
  "scripts": {
14
+ "prepublishOnly": "pnpm build && pnpm dts",
15
15
  "build": "vite build && vite build --mode cdn",
16
16
  "build:cdn": "vite build --mode cdn",
17
17
  "build:esm": "vite build",
18
- "dev": "vite dev"
18
+ "dev": "vite dev",
19
+ "dts": "vue-tsc --project tsconfig.dts.json"
19
20
  },
20
21
  "dependencies": {
21
22
  "@opentelemetry/api": "^1.9.1",
package/src/index.ts DELETED
@@ -1,55 +0,0 @@
1
- /*
2
- * Tencent is pleased to support the open source community by making
3
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
4
- *
5
- * Copyright (C) 2017-2025 Tencent. All rights reserved.
6
- *
7
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
8
- *
9
- * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
10
- *
11
- * ---------------------------------------------------
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
- *
17
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
- * the Software.
19
- *
20
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
- * IN THE SOFTWARE.
25
- */
26
-
27
- export {
28
- type BkOTAttributesConfig,
29
- type BkOTAttributeValue,
30
- type BkOTBatchConfig,
31
- type BkOTConfig,
32
- type BkOTCustomEventPayload,
33
- type BkOTHttpBodyConfig,
34
- type BkOTHttpBodyRedactPayload,
35
- type BkOTRedactConfig,
36
- type BkOTRumConfig,
37
- normalizeConfig,
38
- type NormalizedBkOTConfig,
39
- type SignalExporterConfig,
40
- } from './core/config';
41
- export { type BkOTPlugin, type BkOTRuntimeContext, createPlugin, type PluginManager } from './core/plugin';
42
- export { FilteringSpanProcessor } from './core/processor';
43
- export { type BkOTInstance, createBkOT, initBkOT } from './core/sdk';
44
- export { createBlankScreenPlugin } from './plugins/blank-screen';
45
- export { createCommonInstrumentationsPlugin } from './plugins/common';
46
- export { createCspViolationPlugin } from './plugins/csp-violation';
47
- export { createDevicePlugin } from './plugins/device';
48
- export { createErrorPlugin } from './plugins/error';
49
- export { createHttpBodyPlugin } from './plugins/http-body';
50
- export { createLongTaskPlugin } from './plugins/long-task';
51
- export { createPageViewPlugin } from './plugins/page-view';
52
- export { createRouteTimingPlugin } from './plugins/route-timing';
53
- export { createSessionPlugin } from './plugins/session';
54
- export { createWebVitalsPlugin } from './plugins/web-vitals';
55
- export { createWebSocketPlugin } from './plugins/websocket';