@blueking/open-telemetry 0.0.9 → 0.0.11

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.
@@ -54,6 +54,22 @@ export interface BkOTInstrumentationsConfig {
54
54
  custom?: Instrumentation[];
55
55
  documentLoad?: boolean;
56
56
  fetch?: boolean;
57
+ /**
58
+ * 控制 fetch/xhr 请求向哪些后台 API 注入 W3C `traceparent`(内含 OpenTelemetry traceId)请求头。
59
+ *
60
+ * 同源请求始终注入;该配置用于把跨域后台 API 也纳入注入范围(在同源基础上扩展):
61
+ * - `'all'`:所有请求都注入(含跨域,使用前确认涉及的隐私/CORS 影响)。
62
+ * - `string`:URL 包含该子串即注入,例如 `'api.example.com'`。
63
+ * - `RegExp`:URL 匹配该正则即注入。
64
+ * - 以上字符串/正则的数组:命中任意一个即注入。
65
+ * - `(url: string) => boolean`:完全自定义判断。
66
+ *
67
+ * 注意:向跨域服务注入自定义头会触发 CORS 预检,目标服务需在
68
+ * `Access-Control-Allow-Headers` 中放行 `traceparent`(以及按需的 `tracestate`)。
69
+ *
70
+ * 默认未配置时仅同源请求注入,保持既有行为。
71
+ */
72
+ propagateTraceHeaderUrls?: BkOTPropagateTraceHeaderUrls;
57
73
  userInteraction?: boolean | {
58
74
  eventNames?: string[];
59
75
  };
@@ -95,6 +111,7 @@ export interface BkOTPrivacyConfig {
95
111
  redactAttributes?: (attributes: Attributes) => Attributes;
96
112
  redactUrl?: (url: string) => string;
97
113
  }
114
+ export type BkOTPropagateTraceHeaderUrls = 'all' | ((url: string) => boolean) | Array<RegExp | string> | RegExp | string;
98
115
  export interface BkOTRouteConfig {
99
116
  /**
100
117
  * 返回低基数路由分组,例如 `/trace/:id`。
@@ -0,0 +1,3 @@
1
+ import type { Attributes } from '@opentelemetry/api';
2
+ export declare const getMetricViewAttributes: (runtimeAttributes: Attributes) => Attributes;
3
+ export declare const getInstrumentationSpanRuntimeAttributes: (runtimeAttributes: Attributes, fallbackViewPathGroup?: string) => Attributes;
@@ -1,4 +1,4 @@
1
1
  import type { ResolvedBkOTConfig } from './config';
2
2
  export declare const isBkOTEndpoint: (config: ResolvedBkOTConfig, url: string) => boolean;
3
3
  export declare const shouldIgnoreUrl: (config: ResolvedBkOTConfig, url: string) => boolean;
4
- export declare const shouldPropagateTraceHeader: (_config: ResolvedBkOTConfig, url: string) => boolean;
4
+ export declare const shouldPropagateTraceHeader: (config: ResolvedBkOTConfig, url: string) => boolean;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type BkOTActionEventPayload, type BkOTAppConfig, type BkOTAttributesConfig, type BkOTAttributeValue, type BkOTBatchConfig, type BkOTCustomEventPayload, type BkOTHttpBodyConfig, type BkOTHttpBodyRedactPayload, type BkOTInstrumentationsConfig, type BkOTOptions, type BkOTPluginsConfig, type BkOTPrivacyConfig, type BkOTSamplingConfig, type BkOTTransportConfig, resolveConfig, type ResolvedBkOTConfig, type ResolvedConfigHooks, type ResolvedTransportConfig, type SignalExporterConfig, type SignalExportersInputConfig, } from './core/config';
1
+ export { type BkOTActionEventPayload, type BkOTAppConfig, type BkOTAttributesConfig, type BkOTAttributeValue, type BkOTBatchConfig, type BkOTCustomEventPayload, type BkOTHttpBodyConfig, type BkOTHttpBodyRedactPayload, type BkOTInstrumentationsConfig, type BkOTOptions, type BkOTPluginsConfig, type BkOTPrivacyConfig, type BkOTPropagateTraceHeaderUrls, type BkOTSamplingConfig, type BkOTTransportConfig, resolveConfig, type ResolvedBkOTConfig, type ResolvedConfigHooks, type ResolvedTransportConfig, type SignalExporterConfig, type SignalExportersInputConfig, } from './core/config';
2
2
  export { type BkOTPlugin, type BkOTRuntimeContext, createPlugin, type PluginManager } from './core/plugin';
3
3
  export { FilteringSpanProcessor } from './core/processor';
4
4
  export { type BkOTUserContext, type BkOTViewContext, RumRuntimeContext } from './core/runtime-context';