@blueking/open-telemetry 0.0.22-beta.1 → 0.0.23

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 (45) hide show
  1. package/README.md +258 -70
  2. package/dist/bk-rum.global.js +2 -2
  3. package/dist/bk-rum.global.js.map +1 -1
  4. package/dist/core/config.d.ts +10 -10
  5. package/dist/core/runtime-context.d.ts +1 -1
  6. package/dist/core/sdk.d.ts +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +608 -662
  9. package/dist/index.js.map +1 -1
  10. package/dist/plugins/blank-screen.d.ts +1 -1
  11. package/dist/plugins/common.d.ts +2 -2
  12. package/dist/plugins/device.d.ts +2 -2
  13. package/dist/plugins/resource.d.ts +1 -0
  14. package/dist/plugins/web-vitals.d.ts +1 -3
  15. package/dist/schema/attributes.d.ts +6 -7
  16. package/dist/schema/span.d.ts +24 -15
  17. package/package.json +1 -1
  18. package/skills/bk-rum-otele/SKILL.md +31 -30
  19. package/skills/bk-rum-otele/references/actions.md +166 -0
  20. package/skills/bk-rum-otele/references/api.md +248 -215
  21. package/skills/bk-rum-otele/references/architecture.md +139 -37
  22. package/skills/bk-rum-otele/references/blank-screen.md +190 -0
  23. package/skills/bk-rum-otele/references/capabilities.md +175 -83
  24. package/skills/bk-rum-otele/references/configuration.md +226 -151
  25. package/skills/bk-rum-otele/references/data-model.md +157 -24
  26. package/skills/bk-rum-otele/references/errors-security.md +168 -0
  27. package/skills/bk-rum-otele/references/extensions.md +237 -0
  28. package/skills/bk-rum-otele/references/framework-integration.md +318 -75
  29. package/skills/bk-rum-otele/references/getting-started.md +186 -70
  30. package/skills/bk-rum-otele/references/network.md +258 -0
  31. package/skills/bk-rum-otele/references/performance.md +198 -0
  32. package/skills/bk-rum-otele/references/privacy.md +236 -67
  33. package/skills/bk-rum-otele/references/production.md +266 -0
  34. package/skills/bk-rum-otele/references/session-context.md +185 -0
  35. package/skills/bk-rum-otele/references/telemetry-reference.md +500 -51
  36. package/skills/bk-rum-otele/references/transport-sampling.md +321 -32
  37. package/skills/bk-rum-otele/references/troubleshooting.md +341 -151
  38. package/skills/bk-rum-otele/references/views-routing.md +211 -0
  39. package/skills/bk-rum-otele/references/concepts.md +0 -60
  40. package/skills/bk-rum-otele/references/custom-plugin.md +0 -170
  41. package/skills/bk-rum-otele/references/plugins-basic.md +0 -135
  42. package/skills/bk-rum-otele/references/plugins-error-security.md +0 -86
  43. package/skills/bk-rum-otele/references/plugins-experience.md +0 -124
  44. package/skills/bk-rum-otele/references/plugins-network.md +0 -32
  45. package/skills/bk-rum-otele/references/plugins.md +0 -62
@@ -3,6 +3,7 @@ import type { BkOTBlankScreenPluginOptions } from '../plugins/blank-screen';
3
3
  import type { BkOTDevicePluginOptions } from '../plugins/device';
4
4
  import type { BkOTLongTaskPluginOptions } from '../plugins/long-task';
5
5
  import type { BkOTSessionConfig } from '../plugins/session';
6
+ import type { RumRequestOutcome } from '../schema/span';
6
7
  import type { BkOTPlugin } from './plugin';
7
8
  import type { BkOTUserContext } from './runtime-context';
8
9
  import type { Attributes } from '@opentelemetry/api';
@@ -71,13 +72,13 @@ export interface BkOTRequestConfig {
71
72
  excludedUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];
72
73
  beforeSend?: (event: BkOTRequestEvent, context: BkOTRequestContext) => boolean | void;
73
74
  }
75
+ export type BkOTRequestOutcome = RumRequestOutcome;
74
76
  export type BkOTRequestContext = {
75
77
  error?: unknown;
76
78
  request: Request | RequestInit;
77
79
  response?: Response;
78
80
  type: 'fetch';
79
81
  } | {
80
- requestBody?: Document | null | XMLHttpRequestBodyInit;
81
82
  type: 'xhr';
82
83
  xhr: XMLHttpRequest;
83
84
  };
@@ -86,8 +87,8 @@ export interface BkOTRequestEvent {
86
87
  type: 'resource';
87
88
  resource: {
88
89
  method?: string;
89
- statusCode?: number;
90
- type: 'fetch' | 'xhr';
90
+ outcome: BkOTRequestOutcome;
91
+ transport: 'fetch' | 'xhr';
91
92
  url?: string;
92
93
  };
93
94
  }
@@ -160,16 +161,15 @@ export interface ResolvedConfigHooks {
160
161
  export interface ResolvedSessionConfig extends BkOTSessionConfig {
161
162
  sampleRate: number;
162
163
  }
163
- export type ResolvedTransportConfig = SignalExporterConfig;
164
- export interface ResolvedViewConfig {
165
- excludedActivityUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];
166
- loadingTime: boolean;
167
- tracking: 'auto' | 'manual';
168
- }
169
- export interface SignalExporterConfig {
164
+ export interface ResolvedTransportConfig {
170
165
  concurrencyLimit?: number;
171
166
  endpoint: string;
172
167
  headers?: Record<string, string>;
173
168
  timeoutMillis?: number;
174
169
  }
170
+ export interface ResolvedViewConfig {
171
+ excludedActivityUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];
172
+ loadingTime: boolean;
173
+ tracking: 'auto' | 'manual';
174
+ }
175
175
  export declare const resolveConfig: (config: BkOTOptions) => ResolvedBkOTConfig;
@@ -43,7 +43,7 @@ export interface BkOTViewContext {
43
43
  * 管理 SDK 运行期公共属性快照。
44
44
  *
45
45
  * 这里仅保存“后续事件都需要带上”的低成本上下文,Session/View/用户切换时更新快照,
46
- * 插件发 span/log 时读取当前快照即可,避免每个插件重复维护公共字段。
46
+ * 插件发 Span 时读取当前快照即可,避免每个插件重复维护公共字段。
47
47
  */
48
48
  export declare class RumRuntimeContext {
49
49
  private readonly actionHistory;
@@ -1,8 +1,8 @@
1
1
  import { type Attributes, type Span } from '@opentelemetry/api';
2
- import { type Instrumentation } from '@opentelemetry/instrumentation';
3
2
  import { type BkOTActionEventPayload, type BkOTCustomEventPayload, type BkOTOptions, type BkOTTrackingConsent, type ResolvedBkOTConfig } from './config';
4
3
  import { type BkOTPlugin, type BkOTRuntimeContext, type BkOTStartSpanOptions } from './plugin';
5
4
  import { type BkOTSessionLifecycleEvent, type BkOTStartViewOptions, type BkOTUserContext } from './runtime-context';
5
+ import type { Instrumentation } from '@opentelemetry/instrumentation';
6
6
  export interface BkOTInstance extends Omit<BkOTRuntimeContext, 'notifyActivity' | 'onActivity' | 'onViewChange' | 'onViewCommand' | 'registerInstrumentations' | 'setView'> {
7
7
  flush: () => Promise<void>;
8
8
  reportAction: (payload: BkOTActionEventPayload) => void;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type BkOTActionEventPayload, type BkOTApplicationConfig, type BkOTAttributesConfig, type BkOTAttributeValue, type BkOTBatchConfig, type BkOTBeforeSendEvent, type BkOTContextConfig, type BkOTCustomEventPayload, type BkOTExtensionsConfig, type BkOTOptions, type BkOTPrivacyConfig, type BkOTRequestConfig, type BkOTRequestContext, type BkOTRequestEvent, type BkOTTrackingConfig, type BkOTTrackingConsent, type BkOTTransportConfig, type BkOTUrlMatcher, type BkOTViewConfig, resolveConfig, type ResolvedApplicationConfig, type ResolvedBkOTConfig, type ResolvedConfigHooks, type ResolvedTransportConfig, type ResolvedViewConfig, type SignalExporterConfig, } from './core/config';
1
+ export { type BkOTActionEventPayload, type BkOTApplicationConfig, type BkOTAttributesConfig, type BkOTAttributeValue, type BkOTBatchConfig, type BkOTBeforeSendEvent, type BkOTContextConfig, type BkOTCustomEventPayload, type BkOTExtensionsConfig, type BkOTOptions, type BkOTPrivacyConfig, type BkOTRequestConfig, type BkOTRequestContext, type BkOTRequestEvent, type BkOTRequestOutcome, type BkOTTrackingConfig, type BkOTTrackingConsent, type BkOTTransportConfig, type BkOTUrlMatcher, type BkOTViewConfig, resolveConfig, type ResolvedApplicationConfig, type ResolvedBkOTConfig, type ResolvedConfigHooks, type ResolvedTransportConfig, type ResolvedViewConfig, } 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 BkOTSessionLifecycleEvent, type BkOTStartViewOptions, type BkOTUserContext, type BkOTViewContext, RumRuntimeContext, } from './core/runtime-context';
@@ -16,4 +16,4 @@ export { type BkOTSessionConfig, createSessionPlugin } from './plugins/session';
16
16
  export { createWebVitalsPlugin } from './plugins/web-vitals';
17
17
  export { createWebSocketPlugin } from './plugins/websocket';
18
18
  export { RUM_ATTRIBUTES, type RumAttributeKey } from './schema/attributes';
19
- export { buildRumSpanAttributes, RUM_SPAN_RESULT, RUM_SPAN_TYPE, type RumSpanClassification, type RumSpanResult, type RumSpanType, } from './schema/span';
19
+ export { buildRumSpanAttributes, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE, type RumSpanClassification, type RumSpanOutcome, type RumSpanType, } from './schema/span';