@launchdarkly/o11y 0.0.0-stage → 1.2.0
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.
- package/CHANGELOG.md +9 -0
- package/LICENSE +13 -0
- package/README.md +15 -2
- package/dist/LDObserve-CHIjcqIn.js +92 -0
- package/dist/LDObserve-CHIjcqIn.js.map +1 -0
- package/dist/LDObserve.d.ts +645 -0
- package/dist/LDObserve.js +6 -0
- package/dist/LDObserve.js.map +1 -0
- package/dist/LDRecord.d.ts +149 -0
- package/dist/LDRecord.js +48 -0
- package/dist/LDRecord.js.map +1 -0
- package/dist/assets/highlight-client-worker-DsbKMpxq.js.map +1 -0
- package/dist/buffer-DIFxvF2Q.js +102 -0
- package/dist/buffer-DIFxvF2Q.js.map +1 -0
- package/dist/common-DQ61tUu9.js +4587 -0
- package/dist/common-DQ61tUu9.js.map +1 -0
- package/dist/index.d.ts +2772 -0
- package/dist/index.js +1657 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +495 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/observe-CFB6c1lu.js +12196 -0
- package/dist/observe-CFB6c1lu.js.map +1 -0
- package/dist/observe.d.ts +1195 -0
- package/dist/observe.js +8 -0
- package/dist/observe.js.map +1 -0
- package/dist/record-C_yieA7u.js +11270 -0
- package/dist/record-C_yieA7u.js.map +1 -0
- package/dist/record.d.ts +1725 -0
- package/dist/record.js +8 -0
- package/dist/record.js.map +1 -0
- package/package.json +158 -3
|
@@ -0,0 +1,1195 @@
|
|
|
1
|
+
import { EvaluationSeriesContext } from '@launchdarkly/js-client-sdk';
|
|
2
|
+
import { EvaluationSeriesData } from '@launchdarkly/js-client-sdk';
|
|
3
|
+
import { Hook as Hook_2 } from '@launchdarkly/js-client-sdk';
|
|
4
|
+
import { LDContext } from '@launchdarkly/js-client-sdk';
|
|
5
|
+
import { LDEvaluationReason } from '@launchdarkly/js-client-sdk';
|
|
6
|
+
import { LDFlagValue } from '@launchdarkly/js-client-sdk';
|
|
7
|
+
import { LDPluginEnvironmentMetadata } from '@launchdarkly/js-client-sdk';
|
|
8
|
+
import { LDPluginMetadata } from '@launchdarkly/js-client-sdk';
|
|
9
|
+
|
|
10
|
+
declare const ALL_CONSOLE_METHODS: readonly ["assert", "count", "countReset", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "table", "time", "timeEnd", "timeLog", "trace", "warn"];
|
|
11
|
+
|
|
12
|
+
declare interface AmplitudeIntegrationOptions extends DefaultIntegrationOptions {
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Attributes is a map from string to attribute values.
|
|
18
|
+
*
|
|
19
|
+
* Note: only the own enumerable keys are counted as valid attribute keys.
|
|
20
|
+
*/
|
|
21
|
+
declare interface Attributes {
|
|
22
|
+
[attributeKey: string]: AttributeValue | undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Attribute values may be any non-nullish primitive value except an object.
|
|
27
|
+
*
|
|
28
|
+
* null or undefined attribute values are invalid and will result in undefined behavior.
|
|
29
|
+
*/
|
|
30
|
+
declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
|
|
31
|
+
|
|
32
|
+
declare type CommonOptions = {
|
|
33
|
+
/**
|
|
34
|
+
* Do not use this.
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
debug?: boolean | DebugOptions;
|
|
38
|
+
/**
|
|
39
|
+
* Specifies the name of the app.
|
|
40
|
+
*/
|
|
41
|
+
serviceName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies the version of your application.
|
|
44
|
+
* This is commonly a Git hash or a semantic version.
|
|
45
|
+
*/
|
|
46
|
+
version?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies where to send Highlight session data.
|
|
49
|
+
* You should not have to set this unless you are running an on-premise instance.
|
|
50
|
+
*/
|
|
51
|
+
backendUrl?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Set to `sessionStorage` to bypass all `window.localStorage` usage.
|
|
54
|
+
* This can help with compliance for cookie-consent regulation.
|
|
55
|
+
* Using `sessionStorage` will cause app close+reopens to start a new highlight session,
|
|
56
|
+
* as the session ID will not persist.
|
|
57
|
+
*/
|
|
58
|
+
storageMode?: 'sessionStorage' | 'localStorage';
|
|
59
|
+
/**
|
|
60
|
+
* By default, session data is stored in the `sessionStorage` of the browser.
|
|
61
|
+
* Set to `true` to store session data in a cookie instead.
|
|
62
|
+
* This can help with compliance for cookie-consent regulation.
|
|
63
|
+
*/
|
|
64
|
+
sessionCookie?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Specifies if Highlight should not automatically initialize when the class is created.
|
|
67
|
+
* This should be used with `.start()` and `.stop()` if you want to control when Highlight records.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
manualStart?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Key to use to determine the sessionSecureID in order to override session generation logic.
|
|
73
|
+
* If a sessionKey is provided, the session will be combined with the previous session with the same key.
|
|
74
|
+
* Otherwise, the current session logic will be used to generate a sessionSecureID.
|
|
75
|
+
*/
|
|
76
|
+
sessionKey?: string;
|
|
77
|
+
/**
|
|
78
|
+
* A function that returns a friendly name for a given context.
|
|
79
|
+
* This name will be used to identify the session in the observability UI.
|
|
80
|
+
* ```ts
|
|
81
|
+
* contextFriendlyName: (context: LDContext) => {
|
|
82
|
+
* if(context.kind === 'multi' && context.user?.email) {
|
|
83
|
+
* return context.user.email;
|
|
84
|
+
* } else if(context.kind === 'user') {
|
|
85
|
+
* return context.key;
|
|
86
|
+
* }
|
|
87
|
+
* // Use the default identifier for contexts which don't contain a user.
|
|
88
|
+
* return undefined;
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
* @param context The context to get a friendly name for.
|
|
92
|
+
* @returns The friendly name for the context, or undefined to use the
|
|
93
|
+
* default identifier.
|
|
94
|
+
*/
|
|
95
|
+
contextFriendlyName?: (context: LDContext) => string | undefined;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
declare type ConsoleMethods = ConsoleMethodsTuple[number];
|
|
99
|
+
|
|
100
|
+
declare type ConsoleMethodsTuple = typeof ALL_CONSOLE_METHODS;
|
|
101
|
+
|
|
102
|
+
declare interface Context {
|
|
103
|
+
/**
|
|
104
|
+
* Get a value from the context.
|
|
105
|
+
*
|
|
106
|
+
* @param key key which identifies a context value
|
|
107
|
+
*/
|
|
108
|
+
getValue(key: symbol): unknown;
|
|
109
|
+
/**
|
|
110
|
+
* Create a new context which inherits from this context and has
|
|
111
|
+
* the given key set to the given value.
|
|
112
|
+
*
|
|
113
|
+
* @param key context key for which to set the value
|
|
114
|
+
* @param value value to set for the given key
|
|
115
|
+
*/
|
|
116
|
+
setValue(key: symbol, value: unknown): Context;
|
|
117
|
+
/**
|
|
118
|
+
* Return a new context which inherits from this context but does
|
|
119
|
+
* not contain a value for the given key.
|
|
120
|
+
*
|
|
121
|
+
* @param key context key for which to clear a value
|
|
122
|
+
*/
|
|
123
|
+
deleteValue(key: symbol): Context;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare type DebugOptions = {
|
|
127
|
+
clientInteractions?: boolean;
|
|
128
|
+
domRecording?: boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
declare type DefaultIntegrationOptions = {
|
|
132
|
+
disabled?: boolean;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
declare type ErrorMessageType = 'console.error' | 'window.onerror' | 'window.onunhandledrejection' | 'custom' | 'React.ErrorBoundary';
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Defines Exception.
|
|
139
|
+
*
|
|
140
|
+
* string or an object with one of (message or name or code) and optional stack
|
|
141
|
+
*/
|
|
142
|
+
declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
|
|
143
|
+
|
|
144
|
+
declare interface ExceptionWithCode {
|
|
145
|
+
code: string | number;
|
|
146
|
+
name?: string;
|
|
147
|
+
message?: string;
|
|
148
|
+
stack?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare interface ExceptionWithMessage {
|
|
152
|
+
code?: string | number;
|
|
153
|
+
message: string;
|
|
154
|
+
name?: string;
|
|
155
|
+
stack?: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare interface ExceptionWithName {
|
|
159
|
+
code?: string | number;
|
|
160
|
+
message?: string;
|
|
161
|
+
name: string;
|
|
162
|
+
stack?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
declare interface Headers_2 {
|
|
166
|
+
[key: string]: any;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Interface for extending SDK functionality via hooks.
|
|
171
|
+
*/
|
|
172
|
+
declare type Hook = Omit<Hook_2, 'afterEvaluation'> & {
|
|
173
|
+
/**
|
|
174
|
+
* This method is called during the execution of the variation method
|
|
175
|
+
* after the flag value has been determined. The method is executed synchronously.
|
|
176
|
+
*
|
|
177
|
+
* @param hookContext Contains read-only information about the evaluation
|
|
178
|
+
* being performed.
|
|
179
|
+
* @param data A record associated with each stage of hook invocations. Each
|
|
180
|
+
* stage is called with the data of the previous stage for a series.
|
|
181
|
+
* @param detail The result of the evaluation. This value should not be
|
|
182
|
+
* modified.
|
|
183
|
+
* @returns Data to use when executing the next state of the hook in the evaluation series. It is
|
|
184
|
+
* recommended to expand the previous input into the return. This helps ensure your stage remains
|
|
185
|
+
* compatible moving forward as more stages are added.
|
|
186
|
+
* ```js
|
|
187
|
+
* return {...data, "my-new-field": /*my data/*}
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
afterEvaluation?(hookContext: EvaluationSeriesContext, data: EvaluationSeriesData, detail: {
|
|
191
|
+
/**
|
|
192
|
+
* The result of the flag evaluation. This will be either one of the flag's variations or
|
|
193
|
+
* the default value that was passed to `LDClient.variationDetail`.
|
|
194
|
+
*/
|
|
195
|
+
value: LDFlagValue;
|
|
196
|
+
/**
|
|
197
|
+
* The index of the returned value within the flag's list of variations, e.g. 0 for the
|
|
198
|
+
* first variation-- or `null` if the default value was returned.
|
|
199
|
+
*/
|
|
200
|
+
variationIndex?: number | null;
|
|
201
|
+
/**
|
|
202
|
+
* An object describing the main factor that influenced the flag evaluation value.
|
|
203
|
+
*/
|
|
204
|
+
reason?: LDEvaluationReason | null;
|
|
205
|
+
}): EvaluationSeriesData;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Defines High-Resolution Time.
|
|
210
|
+
*
|
|
211
|
+
* The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
|
|
212
|
+
* The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
|
|
213
|
+
* For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
|
|
214
|
+
* The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
|
|
215
|
+
* HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
|
|
216
|
+
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
|
|
217
|
+
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
|
|
218
|
+
* This is represented in HrTime format as [1609504210, 150000000].
|
|
219
|
+
*/
|
|
220
|
+
declare type HrTime = [number, number];
|
|
221
|
+
|
|
222
|
+
declare type IntegrationOptions = {
|
|
223
|
+
amplitude?: AmplitudeIntegrationOptions;
|
|
224
|
+
intercom?: IntercomIntegrationOptions;
|
|
225
|
+
mixpanel?: MixpanelIntegrationOptions;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
declare interface IntercomIntegrationOptions extends DefaultIntegrationOptions {
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
declare interface LDClientMin {
|
|
232
|
+
track(key: string, data?: any, metricValue?: number): void;
|
|
233
|
+
identify(ctx: any): void;
|
|
234
|
+
addHook(hook: Hook): void;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare interface LDPlugin {
|
|
238
|
+
getMetadata(): LDPluginMetadata;
|
|
239
|
+
register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
|
|
240
|
+
getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* A pointer from the current {@link Span} to another span in the same trace or
|
|
245
|
+
* in a different trace.
|
|
246
|
+
* Few examples of Link usage.
|
|
247
|
+
* 1. Batch Processing: A batch of elements may contain elements associated
|
|
248
|
+
* with one or more traces/spans. Since there can only be one parent
|
|
249
|
+
* SpanContext, Link is used to keep reference to SpanContext of all
|
|
250
|
+
* elements in the batch.
|
|
251
|
+
* 2. Public Endpoint: A SpanContext in incoming client request on a public
|
|
252
|
+
* endpoint is untrusted from service provider perspective. In such case it
|
|
253
|
+
* is advisable to start a new trace with appropriate sampling decision.
|
|
254
|
+
* However, it is desirable to associate incoming SpanContext to new trace
|
|
255
|
+
* initiated on service provider side so two traces (from Client and from
|
|
256
|
+
* Service Provider) can be correlated.
|
|
257
|
+
*/
|
|
258
|
+
declare interface Link {
|
|
259
|
+
/** The {@link SpanContext} of a linked span. */
|
|
260
|
+
context: SpanContext;
|
|
261
|
+
/** A set of {@link SpanAttributes} on the link. */
|
|
262
|
+
attributes?: SpanAttributes;
|
|
263
|
+
/** Count of attributes of the link that were dropped due to collection limits */
|
|
264
|
+
droppedAttributesCount?: number;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare type MaskInputOptions = Partial<{
|
|
268
|
+
color: boolean;
|
|
269
|
+
date: boolean;
|
|
270
|
+
'datetime-local': boolean;
|
|
271
|
+
email: boolean;
|
|
272
|
+
month: boolean;
|
|
273
|
+
number: boolean;
|
|
274
|
+
range: boolean;
|
|
275
|
+
search: boolean;
|
|
276
|
+
tel: boolean;
|
|
277
|
+
text: boolean;
|
|
278
|
+
time: boolean;
|
|
279
|
+
url: boolean;
|
|
280
|
+
week: boolean;
|
|
281
|
+
textarea: boolean;
|
|
282
|
+
select: boolean;
|
|
283
|
+
password: boolean;
|
|
284
|
+
}>;
|
|
285
|
+
|
|
286
|
+
declare interface MixpanelIntegrationOptions extends DefaultIntegrationOptions {
|
|
287
|
+
projectToken?: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
declare type NetworkRecordingOptions = {
|
|
291
|
+
/**
|
|
292
|
+
* Enables recording of network requests.
|
|
293
|
+
* The data includes the URLs, the size of the request, and how long the request took.
|
|
294
|
+
* @default true
|
|
295
|
+
*/
|
|
296
|
+
enabled?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* This enables recording XMLHttpRequest and Fetch headers and bodies.
|
|
299
|
+
* @default false
|
|
300
|
+
*/
|
|
301
|
+
recordHeadersAndBody?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* This disables recording WebSocket events.
|
|
304
|
+
* WebSocket events are recorded by default if recordHeadersAndBody is set.
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
307
|
+
disableWebSocketEventRecordings?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Request and response headers where the value is not recorded.
|
|
310
|
+
* The header value is replaced with '[REDACTED]'.
|
|
311
|
+
* These headers are case-insensitive.
|
|
312
|
+
* `recordHeadersAndBody` needs to be enabled.
|
|
313
|
+
* This option will be ignored if `headerKeysToRecord` is set.
|
|
314
|
+
* @example
|
|
315
|
+
* networkHeadersToRedact: ['Secret-Header', 'Plain-Text-Password']
|
|
316
|
+
*/
|
|
317
|
+
networkHeadersToRedact?: string[];
|
|
318
|
+
/**
|
|
319
|
+
* Specifies the keys for request/response JSON body that should not be recorded.
|
|
320
|
+
* The body value is replaced with '[REDACTED]'.
|
|
321
|
+
* These keys are case-insensitive.
|
|
322
|
+
* `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
|
|
323
|
+
* @example bodyKeysToRedact: ['secret-token', 'plain-text-password']
|
|
324
|
+
* // Only `body.id` and `body.pageNumber` will be recorded.
|
|
325
|
+
* body = {
|
|
326
|
+
* 'id': '123',
|
|
327
|
+
* 'pageNumber': '1',
|
|
328
|
+
* 'secret-token': 'super-sensitive-value',
|
|
329
|
+
* 'plain-text-password': 'password123',
|
|
330
|
+
* }
|
|
331
|
+
*/
|
|
332
|
+
networkBodyKeysToRedact?: string[];
|
|
333
|
+
/**
|
|
334
|
+
* URLs to not record headers and bodies for, and to not propagate trace
|
|
335
|
+
* headers (e.g. `traceparent`) to. Each entry is matched as a
|
|
336
|
+
* case-insensitive substring of the full request URL; a match suppresses
|
|
337
|
+
* both recording and trace-header propagation for that request.
|
|
338
|
+
* To disable recording headers and bodies for all URLs, set `recordHeadersAndBody` to `false`.
|
|
339
|
+
* @default ['https://www.googleapis.com/identitytoolkit', 'https://securetoken.googleapis.com']
|
|
340
|
+
*/
|
|
341
|
+
urlBlocklist?: string[];
|
|
342
|
+
/**
|
|
343
|
+
* Specifies the keys for request/response headers to record.
|
|
344
|
+
* This option will override `networkHeadersToRedact` if specified.
|
|
345
|
+
* `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
|
|
346
|
+
* @example headerKeysToRecord: ['id', 'pageNumber']
|
|
347
|
+
* // Only `headers.id` and `headers.pageNumber` will be recorded.
|
|
348
|
+
* headers = {
|
|
349
|
+
* 'id': '123',
|
|
350
|
+
* 'pageNumber': '1',
|
|
351
|
+
* 'secret-token': 'super-sensitive-value',
|
|
352
|
+
* 'plain-text-password': 'password123',
|
|
353
|
+
* }
|
|
354
|
+
*/
|
|
355
|
+
headerKeysToRecord?: string[];
|
|
356
|
+
/**
|
|
357
|
+
* Specifies the keys for request/response JSON body to record.
|
|
358
|
+
* This option will override `networkBodyKeysToRedact` if specified.
|
|
359
|
+
* `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
|
|
360
|
+
* @example bodyKeysToRecord: ['id', 'pageNumber']
|
|
361
|
+
* // Only `body.id` and `body.pageNumber` will be recorded.
|
|
362
|
+
* body = {
|
|
363
|
+
* 'id': '123',
|
|
364
|
+
* 'pageNumber': '1',
|
|
365
|
+
* 'secret-token': 'super-sensitive-value',
|
|
366
|
+
* 'plain-text-password': 'password123',
|
|
367
|
+
* }
|
|
368
|
+
*/
|
|
369
|
+
bodyKeysToRecord?: string[];
|
|
370
|
+
/**
|
|
371
|
+
* Record frontend network request metrics that are sent to
|
|
372
|
+
* the following list of domains. A domain substring match is used to
|
|
373
|
+
* determine if a network request matches one of the following values.
|
|
374
|
+
* @example destinationDomains: ['backend.example.com']
|
|
375
|
+
* // if your frontend makes requests to `backend.example.com` that you would like to record
|
|
376
|
+
*/
|
|
377
|
+
destinationDomains?: string[];
|
|
378
|
+
/**
|
|
379
|
+
* Function to edit/remove data in request/response pairs or ignore the pair entirely.
|
|
380
|
+
* @example
|
|
381
|
+
* ```
|
|
382
|
+
* requestResponseSanitizer: pair => {
|
|
383
|
+
* if (pair.request.url.toLowerCase().indexOf('ignore') !== -1) {
|
|
384
|
+
* // ignore the entire request/response pair (no network logs)
|
|
385
|
+
* return null
|
|
386
|
+
* }
|
|
387
|
+
*
|
|
388
|
+
* if (pair.response.body.indexOf('secret') !== -1) {
|
|
389
|
+
* // remove the body in the response
|
|
390
|
+
* delete pair.response.body;
|
|
391
|
+
* }
|
|
392
|
+
*
|
|
393
|
+
* return pair
|
|
394
|
+
* }
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
*/
|
|
398
|
+
requestResponseSanitizer?: (pair: RequestResponsePair) => RequestResponsePair | null;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
export declare class Observe extends Plugin_2<ObserveOptions> implements LDPlugin {
|
|
402
|
+
observe: Observe_2 | undefined;
|
|
403
|
+
options: ObserveOptions | undefined;
|
|
404
|
+
private readonly exposureDeduper;
|
|
405
|
+
constructor(options?: ObserveOptions);
|
|
406
|
+
private initialize;
|
|
407
|
+
getMetadata(): {
|
|
408
|
+
name: string;
|
|
409
|
+
};
|
|
410
|
+
register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
|
|
411
|
+
getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
declare interface Observe_2 {
|
|
415
|
+
/**
|
|
416
|
+
* Start the observability data capture when running in `manualStart` mode.
|
|
417
|
+
*/
|
|
418
|
+
start: () => Promise<void>;
|
|
419
|
+
/**
|
|
420
|
+
* Stop the observability data capture.
|
|
421
|
+
*/
|
|
422
|
+
stop: () => Promise<void>;
|
|
423
|
+
/**
|
|
424
|
+
* Record arbitrary metric values via as a Gauge.
|
|
425
|
+
* A Gauge records any point-in-time measurement, such as the current CPU utilization %.
|
|
426
|
+
* Values with the same metric name and attributes are aggregated via the OTel SDK.
|
|
427
|
+
* See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
|
|
428
|
+
*/
|
|
429
|
+
recordGauge: (metric: OTelMetric) => void;
|
|
430
|
+
/**
|
|
431
|
+
* Record arbitrary metric values via as a Counter.
|
|
432
|
+
* A Counter efficiently records an increment in a metric, such as number of cache hits.
|
|
433
|
+
* Values with the same metric name and attributes are aggregated via the OTel SDK.
|
|
434
|
+
* See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
|
|
435
|
+
*/
|
|
436
|
+
recordCount: (metric: OTelMetric) => void;
|
|
437
|
+
/**
|
|
438
|
+
* Record arbitrary metric values via as a Counter.
|
|
439
|
+
* A Counter efficiently records an increment in a metric, such as number of cache hits.
|
|
440
|
+
* Values with the same metric name and attributes are aggregated via the OTel SDK.
|
|
441
|
+
* See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
|
|
442
|
+
*/
|
|
443
|
+
recordIncr: (metric: Omit<OTelMetric, 'value'>) => void;
|
|
444
|
+
/**
|
|
445
|
+
* Record arbitrary metric values via as a Histogram.
|
|
446
|
+
* A Histogram efficiently records near-by point-in-time measurement into a bucketed aggregate.
|
|
447
|
+
* Values with the same metric name and attributes are aggregated via the OTel SDK.
|
|
448
|
+
* See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
|
|
449
|
+
*/
|
|
450
|
+
recordHistogram: (metric: OTelMetric) => void;
|
|
451
|
+
/**
|
|
452
|
+
* Record arbitrary metric values via as a UpDownCounter.
|
|
453
|
+
* A UpDownCounter efficiently records an increment or decrement in a metric, such as number of paying customers.
|
|
454
|
+
* Values with the same metric name and attributes are aggregated via the OTel SDK.
|
|
455
|
+
* See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
|
|
456
|
+
*/
|
|
457
|
+
recordUpDownCounter: (metric: OTelMetric) => void;
|
|
458
|
+
/**
|
|
459
|
+
* Starts a new span for tracing in Highlight. The span will be ended when the
|
|
460
|
+
* callback function returns.
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```typescript
|
|
464
|
+
* H.startSpan('span-name', callbackFn)
|
|
465
|
+
* ```
|
|
466
|
+
* @example
|
|
467
|
+
* ```typescript
|
|
468
|
+
* H.startSpan('span-name', options, callbackFn)
|
|
469
|
+
* ```
|
|
470
|
+
* @example
|
|
471
|
+
* ```typescript
|
|
472
|
+
* H.startSpan('span-name', options, context, callbackFn)
|
|
473
|
+
* ```
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* H.startSpan('span-name', async (span) => {
|
|
477
|
+
* span.setAttribute('key', 'value')
|
|
478
|
+
* await someAsyncFunction()
|
|
479
|
+
* })
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @param name The name of the span.
|
|
483
|
+
* @param options Options for the span.
|
|
484
|
+
* @param context The context for the span.
|
|
485
|
+
* @param callbackFn The function to run in the span.
|
|
486
|
+
*/
|
|
487
|
+
startSpan: {
|
|
488
|
+
<F extends (span?: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
|
|
489
|
+
<F extends (span?: Span) => ReturnType<F>>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
|
|
490
|
+
<F extends (span?: Span) => ReturnType<F>>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* Starts a new span for tracing in Highlight. The span will be ended when the
|
|
494
|
+
* `end()` is called on the span. It returns whatever is returned from the
|
|
495
|
+
* callback function.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```typescript
|
|
499
|
+
* H.startManualSpan('span-name', options, (span) => {
|
|
500
|
+
* span.addEvent('event-name', { key: 'value' })
|
|
501
|
+
* span.setAttribute('key', 'value')
|
|
502
|
+
* await someAsyncFunction()
|
|
503
|
+
* span.end()
|
|
504
|
+
* })
|
|
505
|
+
* ```
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```typescript
|
|
509
|
+
* const span = H.startManualSpan('span-name', (s) => s)
|
|
510
|
+
* span.addEvent('event-name', { key: 'value' })
|
|
511
|
+
* await someAsyncFunction()
|
|
512
|
+
* span.end()
|
|
513
|
+
* ```
|
|
514
|
+
*
|
|
515
|
+
* @param name The name of the span.
|
|
516
|
+
* @param options Options for the span.
|
|
517
|
+
* @param context The context for the span.
|
|
518
|
+
* @param fn The function to run in the span.
|
|
519
|
+
*/
|
|
520
|
+
startManualSpan: {
|
|
521
|
+
<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
|
|
522
|
+
<F extends (span: Span) => ReturnType<F>>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
|
|
523
|
+
<F extends (span: Span) => ReturnType<F>>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* Calling this method will report an error in Highlight and map it to the current session being recorded.
|
|
527
|
+
* A common use case for `H.error` is calling it right outside of an error boundary.
|
|
528
|
+
* @see {@link https://docs.highlight.run/grouping-errors} for more information.
|
|
529
|
+
*/
|
|
530
|
+
recordError: (error: any, message?: string, payload?: {
|
|
531
|
+
[key: string]: string;
|
|
532
|
+
}, source?: string, type?: ErrorMessageType) => void;
|
|
533
|
+
/**
|
|
534
|
+
* Record arbitrary logs from your own integrations or manual.
|
|
535
|
+
* Useful when you don't want to emit a console log to the browser dev tools but still want to report a custom log.
|
|
536
|
+
*/
|
|
537
|
+
recordLog: (message: any, level: ConsoleMethods, metadata?: Attributes) => void;
|
|
538
|
+
register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
|
|
539
|
+
getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
|
|
540
|
+
setLDContextKeyAttributes(contextKeys: Attributes): void;
|
|
541
|
+
getLDContextKeyAttributes(): Attributes | undefined;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
declare type ObserveOptions = CommonOptions & {
|
|
545
|
+
/**
|
|
546
|
+
* Specifies where the backend of the app lives. If specified, the SDK will attach the
|
|
547
|
+
* traceparent header to outgoing requests whose destination URLs match a substring
|
|
548
|
+
* or regexp from this list, so that backend errors can be linked back to the session.
|
|
549
|
+
* If 'true' is specified, all requests to the current domain will be matched.
|
|
550
|
+
* @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
|
|
551
|
+
*/
|
|
552
|
+
tracingOrigins?: boolean | (string | RegExp)[];
|
|
553
|
+
/**
|
|
554
|
+
* Specifies how and what the SDK records from network requests and responses.
|
|
555
|
+
*/
|
|
556
|
+
networkRecording?: boolean | NetworkRecordingOptions;
|
|
557
|
+
/**
|
|
558
|
+
* Specifies whether the SDK will record console messages.
|
|
559
|
+
* @default false
|
|
560
|
+
*/
|
|
561
|
+
disableConsoleRecording?: boolean;
|
|
562
|
+
/**
|
|
563
|
+
* Specifies whether the SDK will report `console.error` invocations as Errors.
|
|
564
|
+
* @default false
|
|
565
|
+
*/
|
|
566
|
+
reportConsoleErrors?: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Specifies which console methods to record.
|
|
569
|
+
* The value here will be ignored if `disabledConsoleRecording` is `true`.
|
|
570
|
+
* @default All console methods.
|
|
571
|
+
* @example consoleMethodsToRecord: ['log', 'info', 'error']
|
|
572
|
+
*/
|
|
573
|
+
consoleMethodsToRecord?: ConsoleMethods[];
|
|
574
|
+
/**
|
|
575
|
+
* Specifies whether to record performance metrics (e.g. FPS, device memory).
|
|
576
|
+
* @default true
|
|
577
|
+
*/
|
|
578
|
+
enablePerformanceRecording?: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Specifies whether to record main-thread `longtask` entries (>50ms) as
|
|
581
|
+
* `long_task.duration` histogram samples.
|
|
582
|
+
* @default true
|
|
583
|
+
*/
|
|
584
|
+
enableLongtaskRecording?: boolean;
|
|
585
|
+
/**
|
|
586
|
+
* Specifies whether to subscribe to the browser Reporting API and emit
|
|
587
|
+
* CSP/intervention reports as errors and deprecation reports as warn logs.
|
|
588
|
+
* @default true
|
|
589
|
+
*/
|
|
590
|
+
enableReportingObserver?: boolean;
|
|
591
|
+
/**
|
|
592
|
+
* Specifies the environment your application is running in.
|
|
593
|
+
* This is useful to distinguish whether your session was recorded on localhost or in production.
|
|
594
|
+
* @default 'production'
|
|
595
|
+
*/
|
|
596
|
+
environment?: 'development' | 'staging' | 'production' | string;
|
|
597
|
+
/**
|
|
598
|
+
* Specifies whether window.Promise should be patched
|
|
599
|
+
* to record the stack trace of promise rejections.
|
|
600
|
+
* @default true
|
|
601
|
+
*/
|
|
602
|
+
enablePromisePatch?: boolean;
|
|
603
|
+
/**
|
|
604
|
+
* OTLP options for OpenTelemetry tracing. Instrumentations are enabled by default.
|
|
605
|
+
*/
|
|
606
|
+
otel?: OtelOptions & {
|
|
607
|
+
/**
|
|
608
|
+
* OTLP HTTP endpoint for OpenTelemetry tracing.
|
|
609
|
+
*/
|
|
610
|
+
otlpEndpoint?: string;
|
|
611
|
+
};
|
|
612
|
+
/**
|
|
613
|
+
* Specifies whether to record product analytics events.
|
|
614
|
+
* @default true
|
|
615
|
+
*/
|
|
616
|
+
productAnalytics?: boolean | ProductAnalyticsEvents;
|
|
617
|
+
/**
|
|
618
|
+
* The time window, in milliseconds, during which repeated feature flag
|
|
619
|
+
* evaluations that resolve to the same result are deduplicated, so that only
|
|
620
|
+
* a single `feature_flag` exposure span is emitted per unique
|
|
621
|
+
* (flag key, value, variation, reason, context) within the window.
|
|
622
|
+
*
|
|
623
|
+
* This is useful for reducing exposure volume caused by frequent
|
|
624
|
+
* re-evaluations (for example, React re-renders).
|
|
625
|
+
*
|
|
626
|
+
* Set to `0` (the default) to disable deduplication and emit an exposure
|
|
627
|
+
* for every evaluation. Set a positive value to enable it.
|
|
628
|
+
*
|
|
629
|
+
* @default 0 (disabled)
|
|
630
|
+
*/
|
|
631
|
+
flagExposureDedupeWindowMillis?: number;
|
|
632
|
+
/**
|
|
633
|
+
* The maximum number of unique feature flag exposure keys tracked for
|
|
634
|
+
* deduplication at once. When exceeded, the least recently recorded keys are
|
|
635
|
+
* evicted to bound memory usage.
|
|
636
|
+
*
|
|
637
|
+
* @default 2000
|
|
638
|
+
*/
|
|
639
|
+
flagExposureDedupeMaxSize?: number;
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
declare type OtelInstrumentatonOptions = {
|
|
643
|
+
'@opentelemetry/instrumentation-document-load'?: false;
|
|
644
|
+
'@opentelemetry/instrumentation-fetch'?: false;
|
|
645
|
+
'@opentelemetry/instrumentation-xml-http-request'?: false;
|
|
646
|
+
'@opentelemetry/instrumentation-user-interaction'?: false;
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
declare interface OTelMetric {
|
|
650
|
+
name: string;
|
|
651
|
+
value: number;
|
|
652
|
+
/** UCUM / OTel unit for the instrument (e.g. `ms`, `By`). */
|
|
653
|
+
unit?: string;
|
|
654
|
+
attributes?: Attributes;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
declare type OtelOptions = {
|
|
658
|
+
instrumentations?: OtelInstrumentatonOptions;
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
declare class Plugin_2<T extends RecordOptions | ObserveOptions> {
|
|
662
|
+
protected sessionSecureID: string;
|
|
663
|
+
constructor(options?: T);
|
|
664
|
+
configureSession(ldCredential: string, options?: T): void;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
declare type PrivacySettingOption = 'strict' | 'default' | 'none';
|
|
668
|
+
|
|
669
|
+
declare type ProductAnalyticsEvents = {
|
|
670
|
+
/**
|
|
671
|
+
* Specifies whether to record product analytics for clicks.
|
|
672
|
+
* Requires the use of the @opentelemetry/instrumentation-user-interaction instrumentation.
|
|
673
|
+
* @default true
|
|
674
|
+
*/
|
|
675
|
+
clicks?: boolean;
|
|
676
|
+
/**
|
|
677
|
+
* Specifies whether to record product analytics for page views.
|
|
678
|
+
* Requires the use of the @opentelemetry/instrumentation-document-load instrumentation.
|
|
679
|
+
* @default true
|
|
680
|
+
*/
|
|
681
|
+
pageViews?: boolean;
|
|
682
|
+
/**
|
|
683
|
+
* Specifies whether to record product analytics for custom events.
|
|
684
|
+
* @default true
|
|
685
|
+
*/
|
|
686
|
+
trackEvents?: boolean;
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
declare type RecordOptions = CommonOptions & {
|
|
690
|
+
/**
|
|
691
|
+
* Specifies where the backend of the app lives. If specified, the SDK will attach the
|
|
692
|
+
* traceparent header to outgoing requests whose destination URLs match a substring
|
|
693
|
+
* or regexp from this list, so that backend errors can be linked back to the session.
|
|
694
|
+
* If 'true' is specified, all requests to the current domain will be matched.
|
|
695
|
+
* @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
|
|
696
|
+
*/
|
|
697
|
+
tracingOrigins?: boolean | (string | RegExp)[];
|
|
698
|
+
/**
|
|
699
|
+
* If set, the SDK will not record when your app is not visible (in the background).
|
|
700
|
+
* By default, the SDK will record in the background.
|
|
701
|
+
* @default false
|
|
702
|
+
*/
|
|
703
|
+
disableBackgroundRecording?: boolean;
|
|
704
|
+
enableSegmentIntegration?: boolean;
|
|
705
|
+
/**
|
|
706
|
+
* Specifies the environment your application is running in.
|
|
707
|
+
* This is useful to distinguish whether your session was recorded on localhost or in production.
|
|
708
|
+
* @default 'production'
|
|
709
|
+
*/
|
|
710
|
+
environment?: 'development' | 'staging' | 'production' | string;
|
|
711
|
+
/**
|
|
712
|
+
* Specifies how much data the SDK should redact during recording.
|
|
713
|
+
* strict - the SDK will redact all text data, input fields, images and videos on the page.
|
|
714
|
+
* default - the SDK will redact text data on the page that resembles PII (based on regex patterns).
|
|
715
|
+
* none - the SDK will not redact any text data on the page.
|
|
716
|
+
* // Redacted text will be randomized. Instead of seeing "Hello World" in a recording, you will see "1fds1 j59a0".
|
|
717
|
+
* @see {@link https://launchdarkly.com/docs/sdk/features/session-replay-config#privacy} for more information.
|
|
718
|
+
*/
|
|
719
|
+
privacySetting?: PrivacySettingOption;
|
|
720
|
+
/**
|
|
721
|
+
* Enable masking all <input/> elements. Only applies if privacySetting is `none`.
|
|
722
|
+
*/
|
|
723
|
+
maskAllInputs?: boolean;
|
|
724
|
+
/**
|
|
725
|
+
* Customize the input element types that are masked. Only applies if privacySetting is `none`.
|
|
726
|
+
*/
|
|
727
|
+
maskInputOptions?: MaskInputOptions;
|
|
728
|
+
/**
|
|
729
|
+
* Customize which elements' text should be masked by specifying a CSS class name or RegExp.
|
|
730
|
+
* Default class is 'highlight-mask'.
|
|
731
|
+
*/
|
|
732
|
+
maskTextClass?: string | RegExp;
|
|
733
|
+
/**
|
|
734
|
+
* Customize which elements' text should be masked via a CSS selector that will match the element
|
|
735
|
+
* and its descendants.
|
|
736
|
+
*/
|
|
737
|
+
maskTextSelector?: string;
|
|
738
|
+
/**
|
|
739
|
+
* Customize which elements should be blocked (not recorded) by specifying a class name or RegExp.
|
|
740
|
+
* Default is 'highlight-block'.
|
|
741
|
+
*/
|
|
742
|
+
blockClass?: string | RegExp;
|
|
743
|
+
/**
|
|
744
|
+
* Customize which elements should be blocked via a CSS selector.
|
|
745
|
+
*/
|
|
746
|
+
blockSelector?: string;
|
|
747
|
+
/**
|
|
748
|
+
* Customize which elements and their descendants should be ignored from DOM events by class.
|
|
749
|
+
* Default is 'highlight-ignore'.
|
|
750
|
+
*/
|
|
751
|
+
ignoreClass?: string;
|
|
752
|
+
/**
|
|
753
|
+
* Customize which elements should be ignored from DOM events via a CSS selector.
|
|
754
|
+
*/
|
|
755
|
+
ignoreSelector?: string;
|
|
756
|
+
/**
|
|
757
|
+
* Specifies whether to record canvas elements or not.
|
|
758
|
+
* @default false
|
|
759
|
+
*/
|
|
760
|
+
enableCanvasRecording?: boolean;
|
|
761
|
+
/**
|
|
762
|
+
* Configure the recording sampling options, eg. how frequently we record canvas updates.
|
|
763
|
+
*/
|
|
764
|
+
samplingStrategy?: SamplingStrategy;
|
|
765
|
+
/**
|
|
766
|
+
* Specifies whether to inline images into the recording.
|
|
767
|
+
* This means that images that are local to the client (eg. client-generated blob: urls)
|
|
768
|
+
* will be serialized into the recording and will be valid on replay.
|
|
769
|
+
* This will also use canvas snapshotting to inline <video> elements
|
|
770
|
+
* that use `src="blob:..."` data or webcam feeds (blank src) as <canvas> elements
|
|
771
|
+
* Only enable this if you are running into issues with client-local images.
|
|
772
|
+
* Will negatively affect performance.
|
|
773
|
+
* @default false
|
|
774
|
+
*/
|
|
775
|
+
inlineImages?: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* Specifies whether to inline <video> elements into the recording.
|
|
778
|
+
* This means that video that are not accessible at a later time
|
|
779
|
+
* (eg., a signed URL that is short lived)
|
|
780
|
+
* will be serialized into the recording and will be valid on replay.
|
|
781
|
+
* Only enable this if you are running into issues with the normal serialization.
|
|
782
|
+
* Will negatively affect performance.
|
|
783
|
+
* @default false
|
|
784
|
+
*/
|
|
785
|
+
inlineVideos?: boolean;
|
|
786
|
+
/**
|
|
787
|
+
* Specifies whether to inline stylesheets into the recording.
|
|
788
|
+
* This means that stylesheets that are local to the client (eg. client-generated blob: urls)
|
|
789
|
+
* will be serialized into the recording and will be valid on replay.
|
|
790
|
+
* Only enable this if you are running into issues with client-local stylesheets.
|
|
791
|
+
* May negatively affect performance.
|
|
792
|
+
* @default true
|
|
793
|
+
*/
|
|
794
|
+
inlineStylesheet?: boolean;
|
|
795
|
+
/**
|
|
796
|
+
* How often, in milliseconds, session replay checks that its CSSOM patches
|
|
797
|
+
* are still installed and re-sends CSS-in-JS rules another script on the
|
|
798
|
+
* page may have caused it to miss. Set to 0 to disable. Lower values recover
|
|
799
|
+
* styles faster; each check walks every stylesheet on the page.
|
|
800
|
+
* @default 2000
|
|
801
|
+
*/
|
|
802
|
+
styleSheetResyncInterval?: number;
|
|
803
|
+
/**
|
|
804
|
+
* Enables recording of cross-origin iframes. Should be set in both the parent window and
|
|
805
|
+
* in the cross-origin iframe.
|
|
806
|
+
* @default false
|
|
807
|
+
*/
|
|
808
|
+
recordCrossOriginIframe?: boolean;
|
|
809
|
+
integrations?: IntegrationOptions;
|
|
810
|
+
/**
|
|
811
|
+
* Specifies the keyboard shortcut to open the current session replay.
|
|
812
|
+
* @see {@link https://launchdarkly.com/docs/sdk/features/session-replay-config#retrieve-session-urls-on-the-client} for more information.
|
|
813
|
+
*/
|
|
814
|
+
sessionShortcut?: SessionShortcutOptions;
|
|
815
|
+
/**
|
|
816
|
+
* By default, data is serialized and send by the Web Worker. Set to `local` to force
|
|
817
|
+
* sending from the main js thread. Only use `local` for custom environments where Web Workers
|
|
818
|
+
* are not available (ie. Figma plugins).
|
|
819
|
+
*/
|
|
820
|
+
sendMode?: 'webworker' | 'local';
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
declare interface Request_2 {
|
|
824
|
+
sessionSecureID: string;
|
|
825
|
+
id: string;
|
|
826
|
+
url: string;
|
|
827
|
+
verb: string;
|
|
828
|
+
headers?: Headers_2;
|
|
829
|
+
body: any;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
declare interface RequestResponsePair {
|
|
833
|
+
request: Request_2;
|
|
834
|
+
response: Response_2;
|
|
835
|
+
/** Whether this URL matched a `urlToBlock` so the contents should not be recorded. */
|
|
836
|
+
urlBlocked: boolean;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
declare interface Response_2 {
|
|
840
|
+
status: number;
|
|
841
|
+
headers?: {
|
|
842
|
+
[k: string]: string;
|
|
843
|
+
};
|
|
844
|
+
body: any;
|
|
845
|
+
/** Number of Bytes transferred over the network. */
|
|
846
|
+
size?: number;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
declare type SamplingStrategy = {
|
|
850
|
+
/**
|
|
851
|
+
* 'all' will record every single canvas call.
|
|
852
|
+
* a number will record an image snapshots in a web-worker a (maximum) number of times per second.
|
|
853
|
+
* Number is only supported where [`OffscreenCanvas`](http://mdn.io/offscreencanvas) is supported.
|
|
854
|
+
*/
|
|
855
|
+
canvas?: 'all' | number;
|
|
856
|
+
/**
|
|
857
|
+
* For manual usage of `H.snapshot(element) from your canvas rendering function.
|
|
858
|
+
* See https://www.highlight.io/docs/getting-started/client-sdk/replay-configuration/canvas for setup.`
|
|
859
|
+
* a number will record an image snapshots in a web-worker a (maximum) number of times per second.
|
|
860
|
+
*/
|
|
861
|
+
canvasManualSnapshot?: number;
|
|
862
|
+
/**
|
|
863
|
+
* A quality at which to take canvas snapshots. See https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap
|
|
864
|
+
* @deprecated This value is no longer used.
|
|
865
|
+
*/
|
|
866
|
+
canvasQuality?: 'pixelated' | 'low' | 'medium' | 'high';
|
|
867
|
+
/**
|
|
868
|
+
* A multiplier resolution at which to take canvas snapshots.
|
|
869
|
+
*/
|
|
870
|
+
canvasFactor?: number;
|
|
871
|
+
/**
|
|
872
|
+
* The maximum dimension to take canvas snapshots at.
|
|
873
|
+
* This setting takes precedence over resizeFactor if the resulting image size
|
|
874
|
+
* from the resizeFactor calculation is larger than this value.
|
|
875
|
+
* Eg: set to 600 to ensure that the canvas is saved with images no larger than 600px
|
|
876
|
+
* in either dimension (while preserving the original canvas aspect ratio).
|
|
877
|
+
*/
|
|
878
|
+
canvasMaxSnapshotDimension?: number;
|
|
879
|
+
/**
|
|
880
|
+
* Default behavior for WebGL canvas elements with `preserveDrawingBuffer: false` is to clear the buffer to
|
|
881
|
+
* load the canvas into memory to avoid getting a transparent bitmap.
|
|
882
|
+
* Set to false to disable the clearing (in case there are visual glitches in the canvas).
|
|
883
|
+
*/
|
|
884
|
+
canvasClearWebGLBuffer?: boolean;
|
|
885
|
+
/**
|
|
886
|
+
* Time (in milliseconds) to wait before the initial snapshot of canvas/video elements.
|
|
887
|
+
*/
|
|
888
|
+
canvasInitialSnapshotDelay?: number;
|
|
889
|
+
/**
|
|
890
|
+
* Settings for canvas data serialization. Defaults to {"image/webp", 0.9} for browsers
|
|
891
|
+
* that support WebP and {"image/jpeg", 0.6} for others. Can be overridden to any type
|
|
892
|
+
* or quality value supported by [`toDataURL`](http://mdn.io/toDataURL).
|
|
893
|
+
*/
|
|
894
|
+
dataUrlOptions?: Partial<{
|
|
895
|
+
type: string;
|
|
896
|
+
quality: number;
|
|
897
|
+
}>;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
declare type SessionShortcutOptions = false | string;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* An interface that represents a span. A span represents a single operation
|
|
904
|
+
* within a trace. Examples of span might include remote procedure calls or a
|
|
905
|
+
* in-process function calls to sub-components. A Trace has a single, top-level
|
|
906
|
+
* "root" Span that in turn may have zero or more child Spans, which in turn
|
|
907
|
+
* may have children.
|
|
908
|
+
*
|
|
909
|
+
* Spans are created by the {@link Tracer.startSpan} method.
|
|
910
|
+
*/
|
|
911
|
+
declare interface Span {
|
|
912
|
+
/**
|
|
913
|
+
* Returns the {@link SpanContext} object associated with this Span.
|
|
914
|
+
*
|
|
915
|
+
* Get an immutable, serializable identifier for this span that can be used
|
|
916
|
+
* to create new child spans. Returned SpanContext is usable even after the
|
|
917
|
+
* span ends.
|
|
918
|
+
*
|
|
919
|
+
* @returns the SpanContext object associated with this Span.
|
|
920
|
+
*/
|
|
921
|
+
spanContext(): SpanContext;
|
|
922
|
+
/**
|
|
923
|
+
* Sets an attribute to the span.
|
|
924
|
+
*
|
|
925
|
+
* Sets a single Attribute with the key and value passed as arguments.
|
|
926
|
+
*
|
|
927
|
+
* @param key the key for this attribute.
|
|
928
|
+
* @param value the value for this attribute. Setting a value null or
|
|
929
|
+
* undefined is invalid and will result in undefined behavior.
|
|
930
|
+
*/
|
|
931
|
+
setAttribute(key: string, value: SpanAttributeValue): this;
|
|
932
|
+
/**
|
|
933
|
+
* Sets attributes to the span.
|
|
934
|
+
*
|
|
935
|
+
* @param attributes the attributes that will be added.
|
|
936
|
+
* null or undefined attribute values
|
|
937
|
+
* are invalid and will result in undefined behavior.
|
|
938
|
+
*/
|
|
939
|
+
setAttributes(attributes: SpanAttributes): this;
|
|
940
|
+
/**
|
|
941
|
+
* Adds an event to the Span.
|
|
942
|
+
*
|
|
943
|
+
* @param name the name of the event.
|
|
944
|
+
* @param [attributesOrStartTime] the attributes that will be added; these are
|
|
945
|
+
* associated with this event. Can be also a start time
|
|
946
|
+
* if type is {@type TimeInput} and 3rd param is undefined
|
|
947
|
+
* @param [startTime] start time of the event.
|
|
948
|
+
*/
|
|
949
|
+
addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this;
|
|
950
|
+
/**
|
|
951
|
+
* Adds a single link to the span.
|
|
952
|
+
*
|
|
953
|
+
* Links added after the creation will not affect the sampling decision.
|
|
954
|
+
* It is preferred span links be added at span creation.
|
|
955
|
+
*
|
|
956
|
+
* @param link the link to add.
|
|
957
|
+
*/
|
|
958
|
+
addLink(link: Link): this;
|
|
959
|
+
/**
|
|
960
|
+
* Adds multiple links to the span.
|
|
961
|
+
*
|
|
962
|
+
* Links added after the creation will not affect the sampling decision.
|
|
963
|
+
* It is preferred span links be added at span creation.
|
|
964
|
+
*
|
|
965
|
+
* @param links the links to add.
|
|
966
|
+
*/
|
|
967
|
+
addLinks(links: Link[]): this;
|
|
968
|
+
/**
|
|
969
|
+
* Sets a status to the span. If used, this will override the default Span
|
|
970
|
+
* status. Default is {@link SpanStatusCode.UNSET}. SetStatus overrides the value
|
|
971
|
+
* of previous calls to SetStatus on the Span.
|
|
972
|
+
*
|
|
973
|
+
* @param status the SpanStatus to set.
|
|
974
|
+
*/
|
|
975
|
+
setStatus(status: SpanStatus): this;
|
|
976
|
+
/**
|
|
977
|
+
* Updates the Span name.
|
|
978
|
+
*
|
|
979
|
+
* This will override the name provided via {@link Tracer.startSpan}.
|
|
980
|
+
*
|
|
981
|
+
* Upon this update, any sampling behavior based on Span name will depend on
|
|
982
|
+
* the implementation.
|
|
983
|
+
*
|
|
984
|
+
* @param name the Span name.
|
|
985
|
+
*/
|
|
986
|
+
updateName(name: string): this;
|
|
987
|
+
/**
|
|
988
|
+
* Marks the end of Span execution.
|
|
989
|
+
*
|
|
990
|
+
* Call to End of a Span MUST not have any effects on child spans. Those may
|
|
991
|
+
* still be running and can be ended later.
|
|
992
|
+
*
|
|
993
|
+
* Do not return `this`. The Span generally should not be used after it
|
|
994
|
+
* is ended so chaining is not desired in this context.
|
|
995
|
+
*
|
|
996
|
+
* @param [endTime] the time to set as Span's end time. If not provided,
|
|
997
|
+
* use the current time as the span's end time.
|
|
998
|
+
*/
|
|
999
|
+
end(endTime?: TimeInput): void;
|
|
1000
|
+
/**
|
|
1001
|
+
* Returns the flag whether this span will be recorded.
|
|
1002
|
+
*
|
|
1003
|
+
* @returns true if this Span is active and recording information like events
|
|
1004
|
+
* with the `AddEvent` operation and attributes using `setAttributes`.
|
|
1005
|
+
*/
|
|
1006
|
+
isRecording(): boolean;
|
|
1007
|
+
/**
|
|
1008
|
+
* Sets exception as a span event
|
|
1009
|
+
* @param exception the exception the only accepted values are string or Error
|
|
1010
|
+
* @param [time] the time to set as Span's event time. If not provided,
|
|
1011
|
+
* use the current time.
|
|
1012
|
+
*/
|
|
1013
|
+
recordException(exception: Exception, time?: TimeInput): void;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* @deprecated please use {@link Attributes}
|
|
1018
|
+
*/
|
|
1019
|
+
declare type SpanAttributes = Attributes;
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* @deprecated please use {@link AttributeValue}
|
|
1023
|
+
*/
|
|
1024
|
+
declare type SpanAttributeValue = AttributeValue;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* A SpanContext represents the portion of a {@link Span} which must be
|
|
1028
|
+
* serialized and propagated along side of a {@link Baggage}.
|
|
1029
|
+
*/
|
|
1030
|
+
declare interface SpanContext {
|
|
1031
|
+
/**
|
|
1032
|
+
* The ID of the trace that this span belongs to. It is worldwide unique
|
|
1033
|
+
* with practically sufficient probability by being made as 16 randomly
|
|
1034
|
+
* generated bytes, encoded as a 32 lowercase hex characters corresponding to
|
|
1035
|
+
* 128 bits.
|
|
1036
|
+
*/
|
|
1037
|
+
traceId: string;
|
|
1038
|
+
/**
|
|
1039
|
+
* The ID of the Span. It is globally unique with practically sufficient
|
|
1040
|
+
* probability by being made as 8 randomly generated bytes, encoded as a 16
|
|
1041
|
+
* lowercase hex characters corresponding to 64 bits.
|
|
1042
|
+
*/
|
|
1043
|
+
spanId: string;
|
|
1044
|
+
/**
|
|
1045
|
+
* Only true if the SpanContext was propagated from a remote parent.
|
|
1046
|
+
*/
|
|
1047
|
+
isRemote?: boolean;
|
|
1048
|
+
/**
|
|
1049
|
+
* Trace flags to propagate.
|
|
1050
|
+
*
|
|
1051
|
+
* It is represented as 1 byte (bitmap). Bit to represent whether trace is
|
|
1052
|
+
* sampled or not. When set, the least significant bit documents that the
|
|
1053
|
+
* caller may have recorded trace data. A caller who does not record trace
|
|
1054
|
+
* data out-of-band leaves this flag unset.
|
|
1055
|
+
*
|
|
1056
|
+
* see {@link TraceFlags} for valid flag values.
|
|
1057
|
+
*/
|
|
1058
|
+
traceFlags: number;
|
|
1059
|
+
/**
|
|
1060
|
+
* Tracing-system-specific info to propagate.
|
|
1061
|
+
*
|
|
1062
|
+
* The tracestate field value is a `list` as defined below. The `list` is a
|
|
1063
|
+
* series of `list-members` separated by commas `,`, and a list-member is a
|
|
1064
|
+
* key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
|
|
1065
|
+
* surrounding `list-members` are ignored. There can be a maximum of 32
|
|
1066
|
+
* `list-members` in a `list`.
|
|
1067
|
+
* More Info: https://www.w3.org/TR/trace-context/#tracestate-field
|
|
1068
|
+
*
|
|
1069
|
+
* Examples:
|
|
1070
|
+
* Single tracing system (generic format):
|
|
1071
|
+
* tracestate: rojo=00f067aa0ba902b7
|
|
1072
|
+
* Multiple tracing systems (with different formatting):
|
|
1073
|
+
* tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
|
|
1074
|
+
*/
|
|
1075
|
+
traceState?: TraceState;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
declare enum SpanKind {
|
|
1079
|
+
/** Default value. Indicates that the span is used internally. */
|
|
1080
|
+
INTERNAL = 0,
|
|
1081
|
+
/**
|
|
1082
|
+
* Indicates that the span covers server-side handling of an RPC or other
|
|
1083
|
+
* remote request.
|
|
1084
|
+
*/
|
|
1085
|
+
SERVER = 1,
|
|
1086
|
+
/**
|
|
1087
|
+
* Indicates that the span covers the client-side wrapper around an RPC or
|
|
1088
|
+
* other remote request.
|
|
1089
|
+
*/
|
|
1090
|
+
CLIENT = 2,
|
|
1091
|
+
/**
|
|
1092
|
+
* Indicates that the span describes producer sending a message to a
|
|
1093
|
+
* broker. Unlike client and server, there is no direct critical path latency
|
|
1094
|
+
* relationship between producer and consumer spans.
|
|
1095
|
+
*/
|
|
1096
|
+
PRODUCER = 3,
|
|
1097
|
+
/**
|
|
1098
|
+
* Indicates that the span describes consumer receiving a message from a
|
|
1099
|
+
* broker. Unlike client and server, there is no direct critical path latency
|
|
1100
|
+
* relationship between producer and consumer spans.
|
|
1101
|
+
*/
|
|
1102
|
+
CONSUMER = 4
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Options needed for span creation
|
|
1107
|
+
*/
|
|
1108
|
+
declare interface SpanOptions {
|
|
1109
|
+
/**
|
|
1110
|
+
* The SpanKind of a span
|
|
1111
|
+
* @default {@link SpanKind.INTERNAL}
|
|
1112
|
+
*/
|
|
1113
|
+
kind?: SpanKind;
|
|
1114
|
+
/** A span's attributes */
|
|
1115
|
+
attributes?: SpanAttributes;
|
|
1116
|
+
/** {@link Link}s span to other spans */
|
|
1117
|
+
links?: Link[];
|
|
1118
|
+
/** A manually specified start time for the created `Span` object. */
|
|
1119
|
+
startTime?: TimeInput;
|
|
1120
|
+
/** The new span should be a root span. (Ignore parent from context). */
|
|
1121
|
+
root?: boolean;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
declare interface SpanStatus {
|
|
1125
|
+
/** The status code of this message. */
|
|
1126
|
+
code: SpanStatusCode;
|
|
1127
|
+
/** A developer-facing error message. */
|
|
1128
|
+
message?: string;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* An enumeration of status codes.
|
|
1133
|
+
*/
|
|
1134
|
+
declare enum SpanStatusCode {
|
|
1135
|
+
/**
|
|
1136
|
+
* The default status.
|
|
1137
|
+
*/
|
|
1138
|
+
UNSET = 0,
|
|
1139
|
+
/**
|
|
1140
|
+
* The operation has been validated by an Application developer or
|
|
1141
|
+
* Operator to have completed successfully.
|
|
1142
|
+
*/
|
|
1143
|
+
OK = 1,
|
|
1144
|
+
/**
|
|
1145
|
+
* The operation contains an error.
|
|
1146
|
+
*/
|
|
1147
|
+
ERROR = 2
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Defines TimeInput.
|
|
1152
|
+
*
|
|
1153
|
+
* hrtime, epoch milliseconds, performance.now() or Date
|
|
1154
|
+
*/
|
|
1155
|
+
declare type TimeInput = HrTime | number | Date;
|
|
1156
|
+
|
|
1157
|
+
declare interface TraceState {
|
|
1158
|
+
/**
|
|
1159
|
+
* Create a new TraceState which inherits from this TraceState and has the
|
|
1160
|
+
* given key set.
|
|
1161
|
+
* The new entry will always be added in the front of the list of states.
|
|
1162
|
+
*
|
|
1163
|
+
* @param key key of the TraceState entry.
|
|
1164
|
+
* @param value value of the TraceState entry.
|
|
1165
|
+
*/
|
|
1166
|
+
set(key: string, value: string): TraceState;
|
|
1167
|
+
/**
|
|
1168
|
+
* Return a new TraceState which inherits from this TraceState but does not
|
|
1169
|
+
* contain the given key.
|
|
1170
|
+
*
|
|
1171
|
+
* @param key the key for the TraceState entry to be removed.
|
|
1172
|
+
*/
|
|
1173
|
+
unset(key: string): TraceState;
|
|
1174
|
+
/**
|
|
1175
|
+
* Returns the value to which the specified key is mapped, or `undefined` if
|
|
1176
|
+
* this map contains no mapping for the key.
|
|
1177
|
+
*
|
|
1178
|
+
* @param key with which the specified value is to be associated.
|
|
1179
|
+
* @returns the value to which the specified key is mapped, or `undefined` if
|
|
1180
|
+
* this map contains no mapping for the key.
|
|
1181
|
+
*/
|
|
1182
|
+
get(key: string): string | undefined;
|
|
1183
|
+
/**
|
|
1184
|
+
* Serializes the TraceState to a `list` as defined below. The `list` is a
|
|
1185
|
+
* series of `list-members` separated by commas `,`, and a list-member is a
|
|
1186
|
+
* key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
|
|
1187
|
+
* surrounding `list-members` are ignored. There can be a maximum of 32
|
|
1188
|
+
* `list-members` in a `list`.
|
|
1189
|
+
*
|
|
1190
|
+
* @returns the serialized string.
|
|
1191
|
+
*/
|
|
1192
|
+
serialize(): string;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
export { }
|