@blueking/open-telemetry 0.0.7 → 0.0.9

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.
@@ -1,3 +1,9 @@
1
+ import type { BkOTActionPluginOptions } from '../plugins/action';
2
+ import type { BkOTBlankScreenPluginOptions } from '../plugins/blank-screen';
3
+ import type { BkOTDevicePluginOptions } from '../plugins/device';
4
+ import type { BkOTErrorPluginOptions } from '../plugins/error';
5
+ import type { BkOTLongTaskPluginOptions } from '../plugins/long-task';
6
+ import type { BkOTSessionPluginOptions } from '../plugins/session';
1
7
  import type { BkOTPlugin } from './plugin';
2
8
  import type { BkOTUserContext } from './runtime-context';
3
9
  import type { Attributes } from '@opentelemetry/api';
@@ -45,6 +51,7 @@ export interface BkOTHttpBodyRedactPayload {
45
51
  url: string;
46
52
  }
47
53
  export interface BkOTInstrumentationsConfig {
54
+ custom?: Instrumentation[];
48
55
  documentLoad?: boolean;
49
56
  fetch?: boolean;
50
57
  userInteraction?: boolean | {
@@ -58,17 +65,32 @@ export interface BkOTOptions {
58
65
  autoStart?: boolean;
59
66
  debug?: boolean;
60
67
  enabled?: boolean;
61
- instrumentations?: Instrumentation[];
62
- plugins?: BkOTPlugin[];
68
+ instrumentations?: BkOTInstrumentationsConfig;
69
+ plugins?: BkOTPluginsConfig;
63
70
  privacy?: BkOTPrivacyConfig;
64
71
  route?: BkOTRouteConfig;
65
- rum?: BkOTRumOptions;
66
72
  sampling?: BkOTSamplingConfig;
67
73
  spanBatch?: BkOTBatchConfig;
68
74
  spanProcessor?: BkOTSpanProcessorMode;
69
75
  transport?: BkOTTransportConfig;
70
76
  user?: BkOTUserContext;
71
77
  }
78
+ export interface BkOTPluginsConfig {
79
+ action?: BkOTActionPluginOptions | boolean;
80
+ blankScreen?: BkOTBlankScreenPluginOptions | boolean;
81
+ cspViolation?: boolean;
82
+ custom?: BkOTPlugin[];
83
+ device?: BkOTDevicePluginOptions | boolean;
84
+ error?: BkOTErrorPluginOptions | boolean;
85
+ httpBody?: BkOTHttpBodyConfig | boolean;
86
+ longTask?: BkOTLongTaskPluginOptions | boolean;
87
+ pageView?: boolean;
88
+ resource?: boolean;
89
+ routeTiming?: boolean;
90
+ session?: BkOTSessionPluginOptions | boolean;
91
+ websocket?: boolean;
92
+ webVitals?: boolean;
93
+ }
72
94
  export interface BkOTPrivacyConfig {
73
95
  redactAttributes?: (attributes: Attributes) => Attributes;
74
96
  redactUrl?: (url: string) => string;
@@ -80,43 +102,6 @@ export interface BkOTRouteConfig {
80
102
  */
81
103
  getPathGroup?: (url: string) => string | undefined;
82
104
  }
83
- export interface BkOTRumOptions {
84
- instrumentations?: BkOTInstrumentationsConfig;
85
- plugins?: BkOTRumPluginOptions;
86
- }
87
- export interface BkOTRumPluginOptions {
88
- cspViolation?: boolean;
89
- device?: boolean | {
90
- storageKey?: string;
91
- };
92
- httpBody?: BkOTHttpBodyConfig | boolean;
93
- pageView?: boolean;
94
- resource?: boolean;
95
- routeTiming?: boolean;
96
- websocket?: boolean;
97
- webVitals?: boolean;
98
- action?: boolean | {
99
- eventNames?: Array<'click' | 'input' | 'keydown' | 'pointerdown' | 'scroll' | 'submit'>;
100
- };
101
- blankScreen?: {
102
- checkDelay?: number;
103
- ignoreSelectors?: string[];
104
- rootSelector?: string;
105
- threshold?: number;
106
- } | boolean;
107
- error?: {
108
- maxPerWindow?: number;
109
- windowMs?: number;
110
- } | boolean;
111
- longTask?: {
112
- threshold?: number;
113
- } | boolean;
114
- session?: {
115
- inactivityMs?: number;
116
- maxLifetimeMs?: number;
117
- storageKey?: string;
118
- } | boolean;
119
- }
120
105
  export interface BkOTSamplingConfig {
121
106
  rate?: number;
122
107
  }
@@ -138,11 +123,10 @@ export interface ResolvedBkOTConfig {
138
123
  debug: boolean;
139
124
  enabled: boolean;
140
125
  hooks: ResolvedConfigHooks;
141
- instrumentations: Instrumentation[];
126
+ instrumentations: BkOTInstrumentationsConfig;
142
127
  metricIntervalMillis: number;
143
- plugins: BkOTPlugin[];
128
+ plugins: BkOTPluginsConfig;
144
129
  resourceAttributes: Attributes;
145
- rum: ResolvedRumConfig;
146
130
  sampling: ResolvedSamplingConfig;
147
131
  spanBatch?: BkOTBatchConfig;
148
132
  spanProcessor: BkOTSpanProcessorMode;
@@ -158,50 +142,6 @@ export interface ResolvedConfigHooks {
158
142
  redactAttributes: (attributes: Attributes) => Attributes;
159
143
  redactUrl: (url: string) => string;
160
144
  }
161
- export type ResolvedPluginOption<TConfig extends object = object> = (TConfig & {
162
- enabled: true;
163
- }) | {
164
- enabled: false;
165
- };
166
- export interface ResolvedRumConfig {
167
- plugins: ResolvedRumPluginConfig;
168
- instrumentations: Required<Pick<BkOTInstrumentationsConfig, 'documentLoad' | 'fetch' | 'xhr'>> & {
169
- userInteraction: BkOTInstrumentationsConfig['userInteraction'];
170
- };
171
- }
172
- export interface ResolvedRumPluginConfig {
173
- cspViolation: ResolvedPluginOption;
174
- device: ResolvedPluginOption<{
175
- storageKey?: string;
176
- }>;
177
- error: ResolvedPluginOption<{
178
- maxPerWindow: number;
179
- windowMs: number;
180
- }>;
181
- httpBody: ResolvedPluginOption<Required<BkOTHttpBodyConfig>>;
182
- longTask: ResolvedPluginOption<{
183
- threshold: number;
184
- }>;
185
- pageView: ResolvedPluginOption;
186
- resource: ResolvedPluginOption;
187
- routeTiming: ResolvedPluginOption;
188
- websocket: ResolvedPluginOption;
189
- webVitals: ResolvedPluginOption;
190
- action: ResolvedPluginOption<{
191
- eventNames: Array<'click' | 'input' | 'keydown' | 'pointerdown' | 'scroll' | 'submit'>;
192
- }>;
193
- blankScreen: ResolvedPluginOption<{
194
- checkDelay: number;
195
- ignoreSelectors?: string[];
196
- rootSelector?: string;
197
- threshold: number;
198
- }>;
199
- session: ResolvedPluginOption<{
200
- inactivityMs: number;
201
- maxLifetimeMs: number;
202
- storageKey?: string;
203
- }>;
204
- }
205
145
  export interface ResolvedSamplingConfig {
206
146
  rate: number;
207
147
  }
package/dist/index.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- export { type BkOTActionEventPayload, type BkOTAppConfig, type BkOTAttributesConfig, type BkOTAttributeValue, type BkOTBatchConfig, type BkOTCustomEventPayload, type BkOTHttpBodyConfig, type BkOTHttpBodyRedactPayload, type BkOTInstrumentationsConfig, type BkOTOptions, type BkOTPrivacyConfig, type BkOTRumOptions, type BkOTRumPluginOptions, type BkOTSamplingConfig, type BkOTTransportConfig, resolveConfig, type ResolvedBkOTConfig, type ResolvedConfigHooks, type ResolvedPluginOption, type ResolvedRumConfig, type ResolvedRumPluginConfig, 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 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';
5
5
  export { BkOpenTelemetry, type BkOTInstance } from './core/sdk';
6
6
  export { RUM_ATTRIBUTES, type RumAttributeKey } from './schema/attributes';
7
7
  export { buildRumSpanAttributes, getDurationBucket, RUM_SPAN_RESULT, RUM_SPAN_TYPE, type RumSpanClassification, type RumSpanResult, type RumSpanType, } from './schema/span';
8
- export { createActionPlugin } from './plugins/action';
9
- export { createBlankScreenPlugin } from './plugins/blank-screen';
8
+ export { createActionPlugin, type BkOTActionEventName, type BkOTActionPluginOptions } from './plugins/action';
9
+ export { createBlankScreenPlugin, type BkOTBlankScreenPluginOptions } from './plugins/blank-screen';
10
10
  export { createCommonInstrumentationsPlugin } from './plugins/common';
11
11
  export { createCspViolationPlugin } from './plugins/csp-violation';
12
- export { createDevicePlugin } from './plugins/device';
13
- export { createErrorPlugin } from './plugins/error';
12
+ export { createDevicePlugin, type BkOTDevicePluginOptions } from './plugins/device';
13
+ export { createErrorPlugin, type BkOTErrorPluginOptions } from './plugins/error';
14
14
  export { createHttpBodyPlugin } from './plugins/http-body';
15
- export { createLongTaskPlugin } from './plugins/long-task';
15
+ export { createLongTaskPlugin, type BkOTLongTaskPluginOptions } from './plugins/long-task';
16
16
  export { createPageViewPlugin } from './plugins/page-view';
17
17
  export { createResourcePlugin } from './plugins/resource';
18
18
  export { createRouteTimingPlugin } from './plugins/route-timing';
19
- export { createSessionPlugin } from './plugins/session';
19
+ export { createSessionPlugin, type BkOTSessionPluginOptions } from './plugins/session';
20
20
  export { createWebVitalsPlugin } from './plugins/web-vitals';
21
21
  export { createWebSocketPlugin } from './plugins/websocket';