@blueking/open-telemetry 0.0.27 → 0.0.28

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.
@@ -71,8 +71,9 @@ export interface BkOTRequestConfig {
71
71
  allowedTracingUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];
72
72
  excludedUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];
73
73
  beforeSend?: (event: BkOTRequestEvent, context: BkOTRequestContext) => boolean | void;
74
+ /** 返回请求 URL 的低基数模板,例如 `/api/orders/{id}`;返回空值时回退到默认折叠规则。 */
75
+ getUrlTemplate?: (url: string) => string | undefined;
74
76
  }
75
- export type BkOTRequestOutcome = RumRequestOutcome;
76
77
  export type BkOTRequestContext = {
77
78
  error?: unknown;
78
79
  request: Request | RequestInit;
@@ -92,6 +93,7 @@ export interface BkOTRequestEvent {
92
93
  url?: string;
93
94
  };
94
95
  }
96
+ export type BkOTRequestOutcome = RumRequestOutcome;
95
97
  export type BkOTSpanProcessorMode = 'batch' | 'simple';
96
98
  export interface BkOTTrackingConfig {
97
99
  action?: BkOTActionPluginOptions | boolean;
@@ -124,8 +126,8 @@ export interface BkOTViewConfig {
124
126
  /** 自动计算初始加载与 SPA 路由的页面稳定耗时,默认开启。 */
125
127
  loadingTime?: boolean;
126
128
  tracking?: 'auto' | 'manual';
127
- /** 返回低基数路由分组,例如 `/trace/:id`。 */
128
- getPathGroup?: (url: string) => string | undefined;
129
+ /** 返回页面路由的低基数模板,例如 `/trace/:id`;返回空值时回退到默认折叠规则。 */
130
+ getUrlTemplate?: (url: string) => string | undefined;
129
131
  }
130
132
  export interface ResolvedApplicationConfig {
131
133
  environment: string;
@@ -154,7 +156,8 @@ export interface ResolvedConfigHooks {
154
156
  getCustomAttributes: () => Attributes;
155
157
  getErrorAttributes: () => Attributes;
156
158
  getPageAttributes: () => Attributes;
157
- getViewPathGroup: (url: string) => string;
159
+ getRequestUrlTemplate: (url: string) => string;
160
+ getViewUrlTemplate: (url: string) => string;
158
161
  redactAttributes: (attributes: Attributes) => Attributes;
159
162
  redactUrl: (url: string) => string;
160
163
  }
@@ -37,7 +37,7 @@ export interface BkOTViewContext {
37
37
  name?: string;
38
38
  startedAt?: number;
39
39
  url?: string;
40
- urlPathGroup?: string;
40
+ urlTemplate?: string;
41
41
  }
42
42
  /**
43
43
  * 管理 SDK 运行期公共属性快照。
@@ -1,5 +1,10 @@
1
1
  import type { BkOTUrlMatcher, ResolvedBkOTConfig } from './config';
2
2
  export declare const toAbsoluteUrl: (url: string) => string;
3
+ /**
4
+ * 常见数字 ID、UUID 和长十六进制段统一折叠为 :id,便于服务端按路由聚合。
5
+ * 同时服务 `view.url_template`(页面路由)与 `url.template`(请求路径)两个维度。
6
+ */
7
+ export declare const normalizeUrlPathTemplate: (pathGroup: string) => string;
3
8
  export declare const isBkOTEndpoint: (config: ResolvedBkOTConfig, url: string) => boolean;
4
9
  export declare const shouldIgnoreUrl: (config: ResolvedBkOTConfig, url: string) => boolean;
5
10
  export declare const matchesUrlList: (matchers: BkOTUrlMatcher | BkOTUrlMatcher[] | undefined, url: string) => boolean;