@microsoft/applicationinsights-web-basic 2.8.13-nightly.2304-34 → 2.8.13-nightly.2304-40

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,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.8.13-nightly.2304-34
2
+ * Microsoft.ApplicationInsights, 2.8.13-nightly.2304-40
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -13,11 +13,35 @@
13
13
  * ---------------------------------------------------------------------------
14
14
  */
15
15
 
16
- export declare class AppInsightsCore extends BaseCore implements IAppInsightsCore {
17
- constructor();
18
- initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
19
- track(telemetryItem: ITelemetryItem): void;
20
- }
16
+ import { AppInsightsCore } from '@microsoft/applicationinsights-core-js';
17
+ import { arrForEach } from '@microsoft/applicationinsights-core-js';
18
+ import { CoreUtils } from '@microsoft/applicationinsights-core-js';
19
+ import { _eInternalMessageId } from '@microsoft/applicationinsights-core-js';
20
+ import { eSeverityLevel } from '@microsoft/applicationinsights-common';
21
+ import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
22
+ import { IAutoExceptionTelemetry } from '@microsoft/applicationinsights-common';
23
+ import { IConfig } from '@microsoft/applicationinsights-common';
24
+ import { IConfiguration } from '@microsoft/applicationinsights-core-js';
25
+ import { IDependencyTelemetry } from '@microsoft/applicationinsights-common';
26
+ import { IEventTelemetry } from '@microsoft/applicationinsights-common';
27
+ import { ILoadedPlugin } from '@microsoft/applicationinsights-core-js';
28
+ import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
29
+ import { _InternalMessageId } from '@microsoft/applicationinsights-core-js';
30
+ import { IPageViewPerformanceTelemetry } from '@microsoft/applicationinsights-common';
31
+ import { IPageViewTelemetry } from '@microsoft/applicationinsights-common';
32
+ import { IPlugin } from '@microsoft/applicationinsights-core-js';
33
+ import { isNullOrUndefined } from '@microsoft/applicationinsights-core-js';
34
+ import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
35
+ import { ITelemetryPlugin } from '@microsoft/applicationinsights-core-js';
36
+ import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
37
+ import { proxyFunctions } from '@microsoft/applicationinsights-core-js';
38
+ import { Sender } from '@microsoft/applicationinsights-channel-js';
39
+ import { SendRequestReason } from '@microsoft/applicationinsights-core-js';
40
+ import { SeverityLevel } from '@microsoft/applicationinsights-common';
41
+ import { throwError } from '@microsoft/applicationinsights-core-js';
42
+ import { UnloadHandler } from '@microsoft/applicationinsights-core-js';
43
+
44
+ export { AppInsightsCore }
21
45
 
22
46
  /**
23
47
  * @export
@@ -85,2613 +109,52 @@ export declare class ApplicationInsights {
85
109
  addUnloadCb(handler: UnloadHandler): void;
86
110
  }
87
111
 
88
- /**
89
- * Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers
90
- * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
91
- * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
92
- * cause a testing requirement to test with and without the implementations
93
- * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
94
- * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
95
- */
96
- export declare function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
112
+ export { arrForEach }
97
113
 
98
- declare class BaseCore implements IAppInsightsCore {
99
- static defaultConfig: IConfiguration;
100
- config: IConfiguration;
101
- logger: IDiagnosticLogger;
102
- _extensions: IPlugin[];
103
- isInitialized: () => boolean;
104
- constructor();
105
- initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
106
- getTransmissionControls(): IChannelControls[][];
107
- track(telemetryItem: ITelemetryItem): void;
108
- getProcessTelContext(): IProcessTelemetryContext;
109
- getNotifyMgr(): INotificationManager;
110
- /**
111
- * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
112
- * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
113
- * called.
114
- * @param {INotificationListener} listener - An INotificationListener object.
115
- */
116
- addNotificationListener(listener: INotificationListener): void;
117
- /**
118
- * Removes all instances of the listener.
119
- * @param {INotificationListener} listener - INotificationListener to remove.
120
- */
121
- removeNotificationListener(listener: INotificationListener): void;
122
- /**
123
- * Get the current cookie manager for this instance
124
- */
125
- getCookieMgr(): ICookieMgr;
126
- /**
127
- * Set the current cookie manager for this instance
128
- * @param cookieMgr - The manager, if set to null/undefined will cause the default to be created
129
- */
130
- setCookieMgr(cookieMgr: ICookieMgr): void;
131
- getPerfMgr(): IPerfManager;
132
- setPerfMgr(perfMgr: IPerfManager): void;
133
- eventCnt(): number;
134
- /**
135
- * Periodically check logger.queue for
136
- */
137
- pollInternalLogs(eventName?: string): number;
138
- /**
139
- * Periodically check logger.queue for
140
- */
141
- stopPollingInternalLogs(): void;
142
- /**
143
- * Add a telemetry processor to decorate or drop telemetry events.
144
- * @param telemetryInitializer - The Telemetry Initializer function
145
- * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
146
- */
147
- addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
148
- /**
149
- * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
150
- * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
151
- * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
152
- * approach is to create a new instance and initialize that instance.
153
- * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
154
- * to successfully remove any global references or they may just be completing the unload process asynchronously.
155
- * @param isAsync - Can the unload be performed asynchronously (default)
156
- * @param unloadComplete - An optional callback that will be called once the unload has completed
157
- * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
158
- */
159
- unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
160
- getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
161
- /**
162
- * Add a new plugin to the installation
163
- * @param plugin - The new plugin to add
164
- * @param replaceExisting - should any existing plugin be replaced, default is false
165
- * @param doAsync - Should the add be performed asynchronously
166
- * @param addCb - [Optional] callback to call after the plugin has been added
167
- */
168
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
169
- /**
170
- * Returns the unique event namespace that should be used
171
- */
172
- evtNamespace(): string;
173
- /**
174
- * Add an unload handler that will be called when the SDK is being unloaded
175
- * @param handler - the handler
176
- */
177
- addUnloadCb(handler: UnloadHandler): void;
178
- /**
179
- * Flush and send any batched / cached data immediately
180
- * @param async - send data asynchronously when true (defaults to true)
181
- * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
182
- * If the caller doesn't return true the caller should assume that it may never be called.
183
- * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
184
- * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
185
- */
186
- flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
187
- /**
188
- * Gets the current distributed trace context for this instance if available
189
- * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
190
- */
191
- getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
192
- /**
193
- * Sets the current distributed trace context for this instance if available
194
- */
195
- setTraceCtx(newTracectx: IDistributedTraceContext): void;
196
- protected releaseQueue(): void;
197
- /**
198
- * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
199
- * @param updateCtx - The plugin update context
200
- * @param updateState - The Update State
201
- * @returns boolean - True means the extension class will call updateState otherwise the Core will
202
- */
203
- protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
204
- }
114
+ export { CoreUtils }
205
115
 
206
- /**
207
- * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
208
- * can avoid implementation the same set of boiler plate code as well as provide a base
209
- * implementation so that new default implementations can be added without breaking all plugins.
210
- */
211
- declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
212
- identifier: string;
213
- version?: string;
214
- /**
215
- * Holds the core instance that was used during initialization
216
- */
217
- core: IAppInsightsCore;
218
- priority: number;
219
- /**
220
- * Call back for telemetry processing before it it is sent
221
- * @param env - This is the current event being reported
222
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
223
- * can optionally use this to access the current core instance or define / pass additional information
224
- * to later plugins (vs appending items to the telemetry item)
225
- */
226
- processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
227
- /**
228
- * Set next extension for telemetry processing
229
- */
230
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
231
- /**
232
- * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
233
- * assigned a new default one will be created and returned.
234
- */
235
- diagLog: (itemCtx?: IProcessTelemetryContext) => IDiagnosticLogger;
236
- /**
237
- * Returns whether the plugin has been initialized
238
- */
239
- isInitialized: () => boolean;
240
- /**
241
- * Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
242
- * returns that value (helps with minification for callers), otherwise it will return the configured
243
- * context or a temporary one.
244
- * @param currentCtx - [Optional] The current execution context
245
- */
246
- protected _getTelCtx: (currentCtx?: IProcessTelemetryContext) => IProcessTelemetryContext;
247
- /**
248
- * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
249
- */
250
- protected setInitialized: (isInitialized: boolean) => void;
251
- /**
252
- * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
253
- * finishes it's removal.
254
- * @param unloadCtx - This is the context that should be used during unloading.
255
- * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
256
- * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
257
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
258
- */
259
- protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
260
- /**
261
- * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
262
- * @param updateCtx - This is the context that should be used during updating.
263
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
264
- * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.
265
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
266
- */
267
- protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
268
- constructor();
269
- initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
270
- /**
271
- * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
272
- * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
273
- * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
274
- * @param unloadCtx - This is the context that should be used during unloading.
275
- * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
276
- * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
277
- */
278
- teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
279
- abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
280
- /**
281
- * The the plugin should re-evaluate configuration and update any cached configuration settings.
282
- * @param updateCtx - This is the context that should be used during updating.
283
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
284
- * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
285
- */
286
- update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
287
- /**
288
- * Add an unload handler that will be called when the SDK is being unloaded
289
- * @param handler - the handler
290
- */
291
- protected _addUnloadCb(handler: UnloadHandler): void;
292
- /**
293
- * Add this hook so that it is automatically removed during unloading
294
- * @param hooks - The single hook or an array of IInstrumentHook objects
295
- */
296
- protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
297
- }
116
+ export { _eInternalMessageId }
298
117
 
299
- /**
300
- * Provides a collection of utility functions, included for backward compatibility with previous releases.
301
- * @deprecated Marking this instance as deprecated in favor of direct usage of the helper functions
302
- * as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items
303
- * in your resulting code.
304
- */
305
- export declare const CoreUtils: ICoreUtils;
118
+ export { eSeverityLevel }
306
119
 
307
- declare const DistributedTracingModes: EnumValue<typeof eDistributedTracingModes>;
120
+ export { IAppInsightsCore }
308
121
 
309
- declare type DistributedTracingModes = number | eDistributedTracingModes;
122
+ export { IAutoExceptionTelemetry }
310
123
 
311
- declare const enum eDistributedTracingModes {
312
- /**
313
- * (Default) Send Application Insights correlation headers
314
- */
315
- AI = 0,
316
- /**
317
- * Send both W3C Trace Context headers and back-compatibility Application Insights headers
318
- */
319
- AI_AND_W3C = 1,
320
- /**
321
- * Send W3C Trace Context headers
322
- */
323
- W3C = 2
324
- }
124
+ export { IConfiguration }
325
125
 
326
- export declare const enum _eInternalMessageId {
327
- BrowserDoesNotSupportLocalStorage = 0,
328
- BrowserCannotReadLocalStorage = 1,
329
- BrowserCannotReadSessionStorage = 2,
330
- BrowserCannotWriteLocalStorage = 3,
331
- BrowserCannotWriteSessionStorage = 4,
332
- BrowserFailedRemovalFromLocalStorage = 5,
333
- BrowserFailedRemovalFromSessionStorage = 6,
334
- CannotSendEmptyTelemetry = 7,
335
- ClientPerformanceMathError = 8,
336
- ErrorParsingAISessionCookie = 9,
337
- ErrorPVCalc = 10,
338
- ExceptionWhileLoggingError = 11,
339
- FailedAddingTelemetryToBuffer = 12,
340
- FailedMonitorAjaxAbort = 13,
341
- FailedMonitorAjaxDur = 14,
342
- FailedMonitorAjaxOpen = 15,
343
- FailedMonitorAjaxRSC = 16,
344
- FailedMonitorAjaxSend = 17,
345
- FailedMonitorAjaxGetCorrelationHeader = 18,
346
- FailedToAddHandlerForOnBeforeUnload = 19,
347
- FailedToSendQueuedTelemetry = 20,
348
- FailedToReportDataLoss = 21,
349
- FlushFailed = 22,
350
- MessageLimitPerPVExceeded = 23,
351
- MissingRequiredFieldSpecification = 24,
352
- NavigationTimingNotSupported = 25,
353
- OnError = 26,
354
- SessionRenewalDateIsZero = 27,
355
- SenderNotInitialized = 28,
356
- StartTrackEventFailed = 29,
357
- StopTrackEventFailed = 30,
358
- StartTrackFailed = 31,
359
- StopTrackFailed = 32,
360
- TelemetrySampledAndNotSent = 33,
361
- TrackEventFailed = 34,
362
- TrackExceptionFailed = 35,
363
- TrackMetricFailed = 36,
364
- TrackPVFailed = 37,
365
- TrackPVFailedCalc = 38,
366
- TrackTraceFailed = 39,
367
- TransmissionFailed = 40,
368
- FailedToSetStorageBuffer = 41,
369
- FailedToRestoreStorageBuffer = 42,
370
- InvalidBackendResponse = 43,
371
- FailedToFixDepricatedValues = 44,
372
- InvalidDurationValue = 45,
373
- TelemetryEnvelopeInvalid = 46,
374
- CreateEnvelopeError = 47,
375
- CannotSerializeObject = 48,
376
- CannotSerializeObjectNonSerializable = 49,
377
- CircularReferenceDetected = 50,
378
- ClearAuthContextFailed = 51,
379
- ExceptionTruncated = 52,
380
- IllegalCharsInName = 53,
381
- ItemNotInArray = 54,
382
- MaxAjaxPerPVExceeded = 55,
383
- MessageTruncated = 56,
384
- NameTooLong = 57,
385
- SampleRateOutOfRange = 58,
386
- SetAuthContextFailed = 59,
387
- SetAuthContextFailedAccountName = 60,
388
- StringValueTooLong = 61,
389
- StartCalledMoreThanOnce = 62,
390
- StopCalledWithoutStart = 63,
391
- TelemetryInitializerFailed = 64,
392
- TrackArgumentsNotSpecified = 65,
393
- UrlTooLong = 66,
394
- SessionStorageBufferFull = 67,
395
- CannotAccessCookie = 68,
396
- IdTooLong = 69,
397
- InvalidEvent = 70,
398
- FailedMonitorAjaxSetRequestHeader = 71,
399
- SendBrowserInfoOnUserInit = 72,
400
- PluginException = 73,
401
- NotificationException = 74,
402
- SnippetScriptLoadFailure = 99,
403
- InvalidInstrumentationKey = 100,
404
- CannotParseAiBlobValue = 101,
405
- InvalidContentBlob = 102,
406
- TrackPageActionEventFailed = 103,
407
- FailedAddingCustomDefinedRequestContext = 104,
408
- InMemoryStorageBufferFull = 105,
409
- InstrumentationKeyDeprecation = 106
410
- }
126
+ export { IDependencyTelemetry }
411
127
 
412
- declare const enum eLoggingSeverity {
413
- /**
414
- * Error will be sent as internal telemetry
415
- */
416
- CRITICAL = 1,
417
- /**
418
- * Error will NOT be sent as internal telemetry, and will only be shown in browser console
419
- */
420
- WARNING = 2
421
- }
128
+ export { IEventTelemetry }
422
129
 
423
- declare type EnumValue<E = any> = {
424
- readonly [key in keyof E]: E[key];
425
- };
130
+ export { ILoadedPlugin }
426
131
 
427
- /**
428
- * Defines the level of severity for the event.
429
- */
430
- export declare const enum eSeverityLevel {
431
- Verbose = 0,
432
- Information = 1,
433
- Warning = 2,
434
- Error = 3,
435
- Critical = 4
436
- }
132
+ export { IMetricTelemetry }
437
133
 
438
- declare const enum GetExtCfgMergeType {
439
- None = 0,
440
- MergeDefaultOnly = 1,
441
- MergeDefaultFromRootOrDefault = 2
442
- }
134
+ export { _InternalMessageId }
443
135
 
444
- export declare interface IAppInsightsCore extends IPerfManagerProvider {
445
- config: IConfiguration;
446
- logger: IDiagnosticLogger;
447
- /**
448
- * Returns a value that indicates whether the instance has already been previously initialized.
449
- */
450
- isInitialized?: () => boolean;
451
- initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
452
- getTransmissionControls(): IChannelControls[][];
453
- track(telemetryItem: ITelemetryItem): void;
454
- /**
455
- * Get the current notification manager
456
- */
457
- getNotifyMgr(): INotificationManager;
458
- /**
459
- * Get the current cookie manager for this instance
460
- */
461
- getCookieMgr(): ICookieMgr;
462
- /**
463
- * Set the current cookie manager for this instance
464
- * @param cookieMgr - The manager, if set to null/undefined will cause the default to be created
465
- */
466
- setCookieMgr(cookieMgr: ICookieMgr): void;
467
- /**
468
- * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
469
- * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
470
- * called.
471
- * @param {INotificationListener} listener - An INotificationListener object.
472
- */
473
- addNotificationListener?(listener: INotificationListener): void;
474
- /**
475
- * Removes all instances of the listener.
476
- * @param {INotificationListener} listener - INotificationListener to remove.
477
- */
478
- removeNotificationListener?(listener: INotificationListener): void;
479
- /**
480
- * Add a telemetry processor to decorate or drop telemetry events.
481
- * @param telemetryInitializer - The Telemetry Initializer function
482
- * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
483
- */
484
- addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
485
- pollInternalLogs?(eventName?: string): number;
486
- stopPollingInternalLogs?(): void;
487
- /**
488
- * Return a new instance of the IProcessTelemetryContext for processing events
489
- */
490
- getProcessTelContext(): IProcessTelemetryContext;
491
- /**
492
- * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
493
- * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
494
- * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
495
- * approach is to create a new instance and initialize that instance.
496
- * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
497
- * to successfully remove any global references or they may just be completing the unload process asynchronously.
498
- * @param isAsync - Can the unload be performed asynchronously (default)
499
- * @param unloadComplete - An optional callback that will be called once the unload has completed
500
- * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
501
- */
502
- unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
503
- /**
504
- * Find and return the (first) plugin with the specified identifier if present
505
- * @param pluginIdentifier
506
- */
507
- getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
508
- /**
509
- * Add a new plugin to the installation
510
- * @param plugin - The new plugin to add
511
- * @param replaceExisting - should any existing plugin be replaced, default is false
512
- * @param doAsync - Should the add be performed asynchronously
513
- * @param addCb - [Optional] callback to call after the plugin has been added
514
- */
515
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
516
- /**
517
- * Returns the unique event namespace that should be used when registering events
518
- */
519
- evtNamespace(): string;
520
- /**
521
- * Add a handler that will be called when the SDK is being unloaded
522
- * @param handler - the handler
523
- */
524
- addUnloadCb(handler: UnloadHandler): void;
525
- /**
526
- * Flush and send any batched / cached data immediately
527
- * @param async - send data asynchronously when true (defaults to true)
528
- * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
529
- * If the caller doesn't return true the caller should assume that it may never be called.
530
- * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
531
- * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
532
- * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
533
- */
534
- flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
535
- /**
536
- * Gets the current distributed trace context for this instance if available
537
- * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
538
- */
539
- getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
540
- /**
541
- * Sets the current distributed trace context for this instance if available
542
- */
543
- setTraceCtx(newTraceCtx: IDistributedTraceContext | null | undefined): void;
544
- }
136
+ export { IPageViewPerformanceTelemetry }
545
137
 
546
- /**
547
- * @description window.onerror function parameters
548
- * @export
549
- * @interface IAutoExceptionTelemetry
550
- */
551
- export declare interface IAutoExceptionTelemetry {
552
- /**
553
- * @description error message. Available as event in HTML onerror="" handler
554
- * @type {string}
555
- * @memberof IAutoExceptionTelemetry
556
- */
557
- message: string;
558
- /**
559
- * @description URL of the script where the error was raised
560
- * @type {string}
561
- * @memberof IAutoExceptionTelemetry
562
- */
563
- url: string;
564
- /**
565
- * @description Line number where error was raised
566
- * @type {number}
567
- * @memberof IAutoExceptionTelemetry
568
- */
569
- lineNumber: number;
570
- /**
571
- * @description Column number for the line where the error occurred
572
- * @type {number}
573
- * @memberof IAutoExceptionTelemetry
574
- */
575
- columnNumber: number;
576
- /**
577
- * @description Error Object (object)
578
- * @type {any}
579
- * @memberof IAutoExceptionTelemetry
580
- */
581
- error: any;
582
- /**
583
- * @description The event at the time of the exception (object)
584
- * @type {Event|string}
585
- * @memberof IAutoExceptionTelemetry
586
- */
587
- evt?: Event | string;
588
- /**
589
- * @description The provided stack for the error
590
- * @type {IStackDetails}
591
- * @memberof IAutoExceptionTelemetry
592
- */
593
- stackDetails?: IStackDetails;
594
- /**
595
- * @description The calculated type of the error
596
- * @type {string}
597
- * @memberof IAutoExceptionTelemetry
598
- */
599
- typeName?: string;
600
- /**
601
- * @description The descriptive source of the error
602
- * @type {string}
603
- * @memberof IAutoExceptionTelemetry
604
- */
605
- errorSrc?: string;
606
- }
138
+ export { IPageViewTelemetry }
607
139
 
608
- declare interface IBackendResponse {
609
- /**
610
- * Number of items received by the backend
611
- */
612
- readonly itemsReceived: number;
613
- /**
614
- * Number of items succesfuly accepted by the backend
615
- */
616
- readonly itemsAccepted: number;
617
- /**
618
- * List of errors for items which were not accepted
619
- */
620
- readonly errors: IResponseError[];
621
- /**
622
- * App id returned by the backend - not necessary returned, but we don't need it with each response.
623
- */
624
- readonly appId?: string;
625
- }
140
+ export { IPlugin }
626
141
 
627
- declare interface IBaseProcessingContext {
628
- /**
629
- * The current core instance for the request
630
- */
631
- core: () => IAppInsightsCore;
632
- /**
633
- * THe current diagnostic logger for the request
634
- */
635
- diagLog: () => IDiagnosticLogger;
636
- /**
637
- * Gets the current core config instance
638
- */
639
- getCfg: () => IConfiguration;
640
- /**
641
- * Gets the named extension config
642
- */
643
- getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
644
- /**
645
- * Gets the named config from either the named identifier extension or core config if neither exist then the
646
- * default value is returned
647
- * @param identifier The named extension identifier
648
- * @param field The config field name
649
- * @param defaultValue The default value to return if no defined config exists
650
- */
651
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
652
- /**
653
- * Helper to allow plugins to check and possibly shortcut executing code only
654
- * required if there is a nextPlugin
655
- */
656
- hasNext: () => boolean;
657
- /**
658
- * Returns the next configured plugin proxy
659
- */
660
- getNext: () => ITelemetryPluginChain;
661
- /**
662
- * Helper to set the next plugin proxy
663
- */
664
- setNext: (nextCtx: ITelemetryPluginChain) => void;
665
- /**
666
- * Synchronously iterate over the context chain running the callback for each plugin, once
667
- * every plugin has been executed via the callback, any associated onComplete will be called.
668
- * @param callback - The function call for each plugin in the context chain
669
- */
670
- iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
671
- /**
672
- * Set the function to call when the current chain has executed all processNext or unloadNext items.
673
- * @param onComplete - The onComplete to call
674
- * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
675
- * @param args - Any additional arguments to pass to the onComplete function
676
- */
677
- onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
678
- /**
679
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
680
- * @param plugins - The execution order to process the plugins, if null or not supplied
681
- * then the current execution order will be copied.
682
- * @param startAt - The plugin to start processing from, if missing from the execution
683
- * order then the next plugin will be NOT set.
684
- */
685
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
686
- }
142
+ export { isNullOrUndefined }
687
143
 
688
- /**
689
- * Provides data transmission capabilities
690
- */
691
- declare interface IChannelControls extends ITelemetryPlugin {
692
- /**
693
- * Pause sending data
694
- */
695
- pause(): void;
696
- /**
697
- * Resume sending data
698
- */
699
- resume(): void;
700
- /**
701
- * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
702
- * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
703
- * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
704
- * @param unloadCtx - This is the context that should be used during unloading.
705
- * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
706
- * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
707
- */
708
- teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
709
- /**
710
- * Flush to send data immediately; channel should default to sending data asynchronously
711
- * @param async - send data asynchronously when true
712
- * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
713
- * If the caller doesn't return true the caller should assume that it may never be called.
714
- * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
715
- * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
716
- */
717
- flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
718
- }
144
+ export { ITelemetryItem }
719
145
 
720
- declare interface IChannelControlsAI extends IChannelControls {
721
- }
146
+ export { ITelemetryPlugin }
722
147
 
723
- /**
724
- * Configuration settings for how telemetry is sent
725
- * @export
726
- * @interface IConfig
727
- */
728
- declare interface IConfig {
729
- /**
730
- * The JSON format (normal vs line delimited). True means line delimited JSON.
731
- */
732
- emitLineDelimitedJson?: boolean;
733
- /**
734
- * An optional account id, if your app groups users into accounts. No spaces, commas, semicolons, equals, or vertical bars.
735
- */
736
- accountId?: string;
737
- /**
738
- * A session is logged if the user is inactive for this amount of time in milliseconds. Default 30 mins.
739
- * @default 30*60*1000
740
- */
741
- sessionRenewalMs?: number;
742
- /**
743
- * A session is logged if it has continued for this amount of time in milliseconds. Default 24h.
744
- * @default 24*60*60*1000
745
- */
746
- sessionExpirationMs?: number;
747
- /**
748
- * Max size of telemetry batch. If batch exceeds limit, it is sent and a new batch is started
749
- * @default 100000
750
- */
751
- maxBatchSizeInBytes?: number;
752
- /**
753
- * How long to batch telemetry for before sending (milliseconds)
754
- * @default 15 seconds
755
- */
756
- maxBatchInterval?: number;
757
- /**
758
- * If true, debugging data is thrown as an exception by the logger. Default false
759
- * @defaultValue false
760
- */
761
- enableDebug?: boolean;
762
- /**
763
- * If true, exceptions are not autocollected. Default is false
764
- * @defaultValue false
765
- */
766
- disableExceptionTracking?: boolean;
767
- /**
768
- * If true, telemetry is not collected or sent. Default is false
769
- * @defaultValue false
770
- */
771
- disableTelemetry?: boolean;
772
- /**
773
- * Percentage of events that will be sent. Default is 100, meaning all events are sent.
774
- * @defaultValue 100
775
- */
776
- samplingPercentage?: number;
777
- /**
778
- * If true, on a pageview, the previous instrumented page's view time is tracked and sent as telemetry and a new timer is started for the current pageview. It is sent as a custom metric named PageVisitTime in milliseconds and is calculated via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less). Default is false.
779
- */
780
- autoTrackPageVisitTime?: boolean;
781
- /**
782
- * Automatically track route changes in Single Page Applications (SPA). If true, each route change will send a new Pageview to Application Insights.
783
- */
784
- enableAutoRouteTracking?: boolean;
785
- /**
786
- * If true, Ajax calls are not autocollected. Default is false
787
- * @defaultValue false
788
- */
789
- disableAjaxTracking?: boolean;
790
- /**
791
- * If true, Fetch requests are not autocollected. Default is false (Since 2.8.0, previously true).
792
- * @defaultValue false
793
- */
794
- disableFetchTracking?: boolean;
795
- /**
796
- * Provide a way to exclude specific route from automatic tracking for XMLHttpRequest or Fetch request. For an ajax / fetch request that the request url matches with the regex patterns, auto tracking is turned off.
797
- * @defaultValue undefined.
798
- */
799
- excludeRequestFromAutoTrackingPatterns?: string[] | RegExp[];
800
- /**
801
- * Provide a way to enrich dependencies logs with context at the beginning of api call.
802
- * Default is undefined.
803
- */
804
- addRequestContext?: (requestContext?: IRequestContext) => ICustomProperties;
805
- /**
806
- * If true, default behavior of trackPageView is changed to record end of page view duration interval when trackPageView is called. If false and no custom duration is provided to trackPageView, the page view performance is calculated using the navigation timing API. Default is false
807
- * @defaultValue false
808
- */
809
- overridePageViewDuration?: boolean;
810
- /**
811
- * Default 500 - controls how many ajax calls will be monitored per page view. Set to -1 to monitor all (unlimited) ajax calls on the page.
812
- */
813
- maxAjaxCallsPerView?: number;
814
- /**
815
- * @ignore
816
- * If false, internal telemetry sender buffers will be checked at startup for items not yet sent. Default is true
817
- * @defaultValue true
818
- */
819
- disableDataLossAnalysis?: boolean;
820
- /**
821
- * If false, the SDK will add two headers ('Request-Id' and 'Request-Context') to all dependency requests to correlate them with corresponding requests on the server side. Default is false.
822
- * @defaultValue false
823
- */
824
- disableCorrelationHeaders?: boolean;
825
- /**
826
- * Sets the distributed tracing mode. If AI_AND_W3C mode or W3C mode is set, W3C trace context headers (traceparent/tracestate) will be generated and included in all outgoing requests.
827
- * AI_AND_W3C is provided for back-compatibility with any legacy Application Insights instrumented services
828
- * @defaultValue AI_AND_W3C
829
- */
830
- distributedTracingMode?: DistributedTracingModes;
831
- /**
832
- * Disable correlation headers for specific domain
833
- */
834
- correlationHeaderExcludedDomains?: string[];
835
- /**
836
- * Default false. If true, flush method will not be called when onBeforeUnload, onUnload, onPageHide or onVisibilityChange (hidden state) event(s) trigger.
837
- */
838
- disableFlushOnBeforeUnload?: boolean;
839
- /**
840
- * Default value of {@link #disableFlushOnBeforeUnload}. If true, flush method will not be called when onPageHide or onVisibilityChange (hidden state) event(s) trigger.
841
- */
842
- disableFlushOnUnload?: boolean;
843
- /**
844
- * [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload
845
- * event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked if required by the SDK.
846
- * (Some page unload functionality may be disabled via disableFlushOnBeforeUnload or disableFlushOnUnload config entries)
847
- * Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide"
848
- */
849
- disablePageUnloadEvents?: string[];
850
- /**
851
- * [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event
852
- * hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked if required by the SDK.
853
- * Page Show events include "pageshow" and "visibilitychange" (with 'visible' state)
854
- */
855
- disablePageShowEvents?: string[];
856
- /**
857
- * If true, the buffer with all unsent telemetry is stored in session storage. The buffer is restored on page load. Default is true.
858
- * @defaultValue true
859
- */
860
- enableSessionStorageBuffer?: boolean;
861
- /**
862
- * If specified, overrides the storage & retrieval mechanism that is used to manage unsent telemetry.
863
- */
864
- bufferOverride?: IStorageBuffer;
865
- /**
866
- * @deprecated Use either disableCookiesUsage or specify a cookieCfg with the enabled value set.
867
- * If true, the SDK will not store or read any data from cookies. Default is false. As this field is being deprecated, when both
868
- * isCookieUseDisabled and disableCookiesUsage are used disableCookiesUsage will take precedent.
869
- * @defaultValue false
870
- */
871
- isCookieUseDisabled?: boolean;
872
- /**
873
- * If true, the SDK will not store or read any data from cookies. Default is false.
874
- * If you have also specified a cookieCfg then enabled property (if specified) will take precedent over this value.
875
- * @defaultValue false
876
- */
877
- disableCookiesUsage?: boolean;
878
- /**
879
- * Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.
880
- * @defaultValue ""
881
- */
882
- cookieDomain?: string;
883
- /**
884
- * Custom cookie path. This is helpful if you want to share Application Insights cookies behind an application gateway.
885
- * @defaultValue ""
886
- */
887
- cookiePath?: string;
888
- /**
889
- * Default false. If false, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error), 503 (service unavailable), and 0 (offline, only if detected)
890
- * @description
891
- * @defaultValue false
892
- */
893
- isRetryDisabled?: boolean;
894
- /**
895
- * @deprecated Used when initizialing from snippet only.
896
- * The url from where the JS SDK will be downloaded.
897
- */
898
- url?: string;
899
- /**
900
- * If true, the SDK will not store or read any data from local and session storage. Default is false.
901
- * @defaultValue false
902
- */
903
- isStorageUseDisabled?: boolean;
904
- /**
905
- * If false, the SDK will send all telemetry using the [Beacon API](https://www.w3.org/TR/beacon)
906
- * @defaultValue true
907
- */
908
- isBeaconApiDisabled?: boolean;
909
- /**
910
- * Don't use XMLHttpRequest or XDomainRequest (for IE < 9) by default instead attempt to use fetch() or sendBeacon.
911
- * If no other transport is available it will still use XMLHttpRequest
912
- */
913
- disableXhr?: boolean;
914
- /**
915
- * If fetch keepalive is supported do not use it for sending events during unload, it may still fallback to fetch() without keepalive
916
- */
917
- onunloadDisableFetch?: boolean;
918
- /**
919
- * Sets the sdk extension name. Only alphabetic characters are allowed. The extension name is added as a prefix to the 'ai.internal.sdkVersion' tag (e.g. 'ext_javascript:2.0.0'). Default is null.
920
- * @defaultValue null
921
- */
922
- sdkExtension?: string;
923
- /**
924
- * Default is false. If true, the SDK will track all [Browser Link](https://docs.microsoft.com/en-us/aspnet/core/client-side/using-browserlink) requests.
925
- * @defaultValue false
926
- */
927
- isBrowserLinkTrackingEnabled?: boolean;
928
- /**
929
- * AppId is used for the correlation between AJAX dependencies happening on the client-side with the server-side requets. When Beacon API is enabled, it cannot be used automatically, but can be set manually in the configuration. Default is null
930
- * @defaultValue null
931
- */
932
- appId?: string;
933
- /**
934
- * If true, the SDK will add two headers ('Request-Id' and 'Request-Context') to all CORS requests to correlate outgoing AJAX dependencies with corresponding requests on the server side. Default is false
935
- * @defaultValue false
936
- */
937
- enableCorsCorrelation?: boolean;
938
- /**
939
- * An optional value that will be used as name postfix for localStorage and session cookie name.
940
- * @defaultValue null
941
- */
942
- namePrefix?: string;
943
- /**
944
- * An optional value that will be used as name postfix for session cookie name. If undefined, namePrefix is used as name postfix for session cookie name.
945
- * @defaultValue null
946
- */
947
- sessionCookiePostfix?: string;
948
- /**
949
- * An optional value that will be used as name postfix for user cookie name. If undefined, no postfix is added on user cookie name.
950
- * @defaultValue null
951
- */
952
- userCookiePostfix?: string;
953
- /**
954
- * An optional value that will track Request Header through trackDependency function.
955
- * @defaultValue false
956
- */
957
- enableRequestHeaderTracking?: boolean;
958
- /**
959
- * An optional value that will track Response Header through trackDependency function.
960
- * @defaultValue false
961
- */
962
- enableResponseHeaderTracking?: boolean;
963
- /**
964
- * An optional value that will track Response Error data through trackDependency function.
965
- * @defaultValue false
966
- */
967
- enableAjaxErrorStatusText?: boolean;
968
- /**
969
- * Flag to enable looking up and including additional browser window.performance timings
970
- * in the reported ajax (XHR and fetch) reported metrics.
971
- * Defaults to false.
972
- */
973
- enableAjaxPerfTracking?: boolean;
974
- /**
975
- * The maximum number of times to look for the window.performance timings (if available), this
976
- * is required as not all browsers populate the window.performance before reporting the
977
- * end of the XHR request and for fetch requests this is added after its complete
978
- * Defaults to 3
979
- */
980
- maxAjaxPerfLookupAttempts?: number;
981
- /**
982
- * The amount of time to wait before re-attempting to find the windows.performance timings
983
- * for an ajax request, time is in milliseconds and is passed directly to setTimeout()
984
- * Defaults to 25.
985
- */
986
- ajaxPerfLookupDelay?: number;
987
- /**
988
- * Default false. when tab is closed, the SDK will send all remaining telemetry using the [Beacon API](https://www.w3.org/TR/beacon)
989
- * @defaultValue false
990
- */
991
- onunloadDisableBeacon?: boolean;
992
- /**
993
- * @ignore
994
- * Internal only
995
- */
996
- autoExceptionInstrumented?: boolean;
997
- /**
998
- *
999
- */
1000
- correlationHeaderDomains?: string[];
1001
- /**
1002
- * @ignore
1003
- * Internal only
1004
- */
1005
- autoUnhandledPromiseInstrumented?: boolean;
1006
- /**
1007
- * Default false. Define whether to track unhandled promise rejections and report as JS errors.
1008
- * When disableExceptionTracking is enabled (dont track exceptions) this value will be false.
1009
- * @defaultValue false
1010
- */
1011
- enableUnhandledPromiseRejectionTracking?: boolean;
1012
- /**
1013
- * Disable correlation headers using regular expressions
1014
- */
1015
- correlationHeaderExcludePatterns?: RegExp[];
1016
- /**
1017
- * The ability for the user to provide extra headers
1018
- */
1019
- customHeaders?: [{
1020
- header: string;
1021
- value: string;
1022
- }];
1023
- /**
1024
- * Provide user an option to convert undefined field to user defined value.
1025
- */
1026
- convertUndefined?: any;
1027
- /**
1028
- * [Optional] The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.
1029
- */
1030
- eventsLimitInMem?: number;
1031
- /**
1032
- * [Optional] Disable iKey deprecation error message.
1033
- * @defaultValue true
1034
- */
1035
- disableIkeyDeprecationMessage?: boolean;
1036
- /**
1037
- * [Optional] Flag to indicate whether the internal looking endpoints should be automatically
1038
- * added to the `excludeRequestFromAutoTrackingPatterns` collection. (defaults to true).
1039
- * This flag exists as the provided regex is generic and may unexpectedly match a domain that
1040
- * should not be excluded.
1041
- */
1042
- addIntEndpoints?: boolean;
1043
- }
1044
-
1045
- /**
1046
- * Configuration provided to SDK core
1047
- */
1048
- export declare interface IConfiguration {
1049
- /**
1050
- * Instrumentation key of resource. Either this or connectionString must be specified.
1051
- */
1052
- instrumentationKey?: string;
1053
- /**
1054
- * Connection string of resource. Either this or instrumentationKey must be specified.
1055
- */
1056
- connectionString?: string;
1057
- /**
1058
- * Polling interval (in ms) for internal logging queue
1059
- */
1060
- diagnosticLogInterval?: number;
1061
- /**
1062
- * Maximum number of iKey transmitted logging telemetry per page view
1063
- */
1064
- maxMessageLimit?: number;
1065
- /**
1066
- * Console logging level. All logs with a severity level higher
1067
- * than the configured level will be printed to console. Otherwise
1068
- * they are suppressed. ie Level 2 will print both CRITICAL and
1069
- * WARNING logs to console, level 1 prints only CRITICAL.
1070
- *
1071
- * Note: Logs sent as telemetry to instrumentation key will also
1072
- * be logged to console if their severity meets the configured loggingConsoleLevel
1073
- *
1074
- * 0: ALL console logging off
1075
- * 1: logs to console: severity >= CRITICAL
1076
- * 2: logs to console: severity >= WARNING
1077
- */
1078
- loggingLevelConsole?: number;
1079
- /**
1080
- * Telemtry logging level to instrumentation key. All logs with a severity
1081
- * level higher than the configured level will sent as telemetry data to
1082
- * the configured instrumentation key.
1083
- *
1084
- * 0: ALL iKey logging off
1085
- * 1: logs to iKey: severity >= CRITICAL
1086
- * 2: logs to iKey: severity >= WARNING
1087
- */
1088
- loggingLevelTelemetry?: number;
1089
- /**
1090
- * If enabled, uncaught exceptions will be thrown to help with debugging
1091
- */
1092
- enableDebug?: boolean;
1093
- /**
1094
- * If enabled, uncaught exceptions will be thrown to help with debugging
1095
- */
1096
- enableDebugExceptions?: boolean;
1097
- /**
1098
- * Endpoint where telemetry data is sent
1099
- */
1100
- endpointUrl?: string;
1101
- /**
1102
- * Extension configs loaded in SDK
1103
- */
1104
- extensionConfig?: {
1105
- [key: string]: any;
1106
- };
1107
- /**
1108
- * Additional plugins that should be loaded by core at runtime
1109
- */
1110
- extensions?: ITelemetryPlugin[];
1111
- /**
1112
- * Channel queues that is setup by caller in desired order.
1113
- * If channels are provided here, core will ignore any channels that are already setup, example if there is a SKU with an initialized channel
1114
- */
1115
- channels?: IChannelControls[][];
1116
- /**
1117
- * @type {boolean}
1118
- * Flag that disables the Instrumentation Key validation.
1119
- */
1120
- disableInstrumentationKeyValidation?: boolean;
1121
- /**
1122
- * [Optional] When enabled this will create local perfEvents based on sections of the code that have been instrumented
1123
- * to emit perfEvents (via the doPerf()) when this is enabled. This can be used to identify performance issues within
1124
- * the SDK, the way you are using it or optionally your own instrumented code.
1125
- * The provided IPerfManager implementation does NOT send any additional telemetry events to the server it will only fire
1126
- * the new perfEvent() on the INotificationManager which you can listen to.
1127
- * This also does not use the window.performance API, so it will work in environments where this API is not supported.
1128
- */
1129
- enablePerfMgr?: boolean;
1130
- /**
1131
- * [Optional] Callback function that will be called to create a the IPerfManager instance when required and ```enablePerfMgr```
1132
- * is enabled, this enables you to override the default creation of a PerfManager() without needing to ```setPerfMgr()```
1133
- * after initialization.
1134
- */
1135
- createPerfMgr?: (core: IAppInsightsCore, notificationManager: INotificationManager) => IPerfManager;
1136
- /**
1137
- * [Optional] Fire every single performance event not just the top level root performance event. Defaults to false.
1138
- */
1139
- perfEvtsSendAll?: boolean;
1140
- /**
1141
- * [Optional] Identifies the default length used to generate random session and user id's if non currently exists for the user / session.
1142
- * Defaults to 22, previous default value was 5, if you need to keep the previous maximum length you should set this value to 5.
1143
- */
1144
- idLength?: number;
1145
- /**
1146
- * @description Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains. It
1147
- * can be set here or as part of the cookieCfg.domain, the cookieCfg takes precedence if both are specified.
1148
- * @type {string}
1149
- * @defaultValue ""
1150
- */
1151
- cookieDomain?: string;
1152
- /**
1153
- * @description Custom cookie path. This is helpful if you want to share Application Insights cookies behind an application
1154
- * gateway. It can be set here or as part of the cookieCfg.domain, the cookieCfg takes precedence if both are specified.
1155
- * @type {string}
1156
- * @defaultValue ""
1157
- */
1158
- cookiePath?: string;
1159
- /**
1160
- * [Optional] A boolean that indicated whether to disable the use of cookies by the SDK. If true, the SDK will not store or
1161
- * read any data from cookies. Cookie usage can be re-enabled after initialization via the core.getCookieMgr().enable().
1162
- */
1163
- disableCookiesUsage?: boolean;
1164
- /**
1165
- * [Optional] A Cookie Manager configuration which includes hooks to allow interception of the get, set and delete cookie
1166
- * operations. If this configuration is specified any specified enabled and domain properties will take precedence over the
1167
- * cookieDomain and disableCookiesUsage values.
1168
- */
1169
- cookieCfg?: ICookieMgrConfig;
1170
- /**
1171
- * [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload
1172
- * event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked, if required by the SDK.
1173
- * Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide"
1174
- */
1175
- disablePageUnloadEvents?: string[];
1176
- /**
1177
- * [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event
1178
- * hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK.
1179
- * Page Show events include "pageshow" and "visibilitychange" (with 'visible' state)
1180
- */
1181
- disablePageShowEvents?: string[];
1182
- /**
1183
- * [Optional] A flag for performance optimization to disable attempting to use the Chrome Debug Extension, if disabled and the extension is installed
1184
- * this will not send any notifications.
1185
- */
1186
- disableDbgExt?: boolean;
1187
- }
1188
-
1189
- declare interface ICookieMgr {
1190
- /**
1191
- * Enable or Disable the usage of cookies
1192
- */
1193
- setEnabled(value: boolean): void;
1194
- /**
1195
- * Can the system use cookies, if this returns false then all cookie setting and access functions will return nothing
1196
- */
1197
- isEnabled(): boolean;
1198
- /**
1199
- * Set the named cookie with the value and optional domain and optional
1200
- * @param name - The name of the cookie
1201
- * @param value - The value of the cookie (Must already be encoded)
1202
- * @param maxAgeSec - [optional] The maximum number of SECONDS that this cookie should survive
1203
- * @param domain - [optional] The domain to set for the cookie
1204
- * @param path - [optional] Path to set for the cookie, if not supplied will default to "/"
1205
- * @returns - True if the cookie was set otherwise false (Because cookie usage is not enabled or available)
1206
- */
1207
- set(name: string, value: string, maxAgeSec?: number, domain?: string, path?: string): boolean;
1208
- /**
1209
- * Get the value of the named cookie
1210
- * @param name - The name of the cookie
1211
- */
1212
- get(name: string): string;
1213
- /**
1214
- * Delete/Remove the named cookie if cookie support is available and enabled.
1215
- * Note: Not using "delete" as the name because it's a reserved word which would cause issues on older browsers
1216
- * @param name - The name of the cookie
1217
- * @param path - [optional] Path to set for the cookie, if not supplied will default to "/"
1218
- * @returns - True if the cookie was marked for deletion otherwise false (Because cookie usage is not enabled or available)
1219
- */
1220
- del(name: string, path?: string): boolean;
1221
- /**
1222
- * Purge the cookie from the system if cookie support is available, this function ignores the enabled setting of the manager
1223
- * so any cookie will be removed.
1224
- * Note: Not using "delete" as the name because it's a reserved word which would cause issues on older browsers
1225
- * @param name - The name of the cookie
1226
- * @param path - [optional] Path to set for the cookie, if not supplied will default to "/"
1227
- * @returns - True if the cookie was marked for deletion otherwise false (Because cookie usage is not available)
1228
- */
1229
- purge(name: string, path?: string): boolean;
1230
- }
1231
-
1232
- /**
1233
- * Configuration definition for instance based cookie management configuration
1234
- */
1235
- declare interface ICookieMgrConfig {
1236
- /**
1237
- * Defaults to true, A boolean that indicates whether the use of cookies by the SDK is enabled by the current instance.
1238
- * If false, the instance of the SDK initialized by this configuration will not store or read any data from cookies
1239
- */
1240
- enabled?: boolean;
1241
- /**
1242
- * Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.
1243
- */
1244
- domain?: string;
1245
- /**
1246
- * Specifies the path to use for the cookie, defaults to '/'
1247
- */
1248
- path?: string;
1249
- /**
1250
- * Specify the cookie name(s) to be ignored, this will cause any matching cookie name to never be read or written.
1251
- * They may still be explicitly purged or deleted. You do not need to repeat the name in the `blockedCookies`
1252
- * configuration.(Since v2.8.8)
1253
- */
1254
- ignoreCookies?: string[];
1255
- /**
1256
- * Specify the cookie name(s) to never be written, this will cause any cookie name to never be created or updated,
1257
- * they will still be read unless also included in the ignoreCookies and may still be explicitly purged or deleted.
1258
- * If not provided defaults to the same list provided in ignoreCookies. (Since v2.8.8)
1259
- */
1260
- blockedCookies?: string[];
1261
- /**
1262
- * Hook function to fetch the named cookie value.
1263
- * @param name - The name of the cookie
1264
- */
1265
- getCookie?: (name: string) => string;
1266
- /**
1267
- * Hook function to set the named cookie with the specified value.
1268
- * @param name - The name of the cookie
1269
- * @param value - The value to set for the cookie
1270
- */
1271
- setCookie?: (name: string, value: string) => void;
1272
- /**
1273
- * Hook function to delete the named cookie with the specified value, separated from
1274
- * setCookie to avoid the need to parse the value to determine whether the cookie is being
1275
- * added or removed.
1276
- * @param name - The name of the cookie
1277
- * @param cookieValue - The value to set to expire the cookie
1278
- */
1279
- delCookie?: (name: string, cookieValue: string) => void;
1280
- }
1281
-
1282
- /**
1283
- * Provides a collection of utility functions, included for backward compatibility with previous releases.
1284
- * @deprecated Marking this interface and instance as deprecated in favor of direct usage of the helper functions
1285
- * as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items
1286
- * in your resulting code.
1287
- */
1288
- declare interface ICoreUtils {
1289
- /**
1290
- * Internal - Do not use directly.
1291
- * @deprecated Direct usage of this property is not recommend
1292
- */
1293
- _canUseCookies: boolean;
1294
- isTypeof: (value: any, theType: string) => boolean;
1295
- isUndefined: (value: any) => boolean;
1296
- isNullOrUndefined: (value: any) => boolean;
1297
- hasOwnProperty: (obj: any, prop: string) => boolean;
1298
- /**
1299
- * Checks if the passed of value is a function.
1300
- * @param {any} value - Value to be checked.
1301
- * @return {boolean} True if the value is a boolean, false otherwise.
1302
- */
1303
- isFunction: (value: any) => value is Function;
1304
- /**
1305
- * Checks if the passed of value is a function.
1306
- * @param {any} value - Value to be checked.
1307
- * @return {boolean} True if the value is a boolean, false otherwise.
1308
- */
1309
- isObject: (value: any) => boolean;
1310
- /**
1311
- * Check if an object is of type Date
1312
- */
1313
- isDate: (obj: any) => obj is Date;
1314
- /**
1315
- * Check if an object is of type Array
1316
- */
1317
- isArray: (obj: any) => boolean;
1318
- /**
1319
- * Check if an object is of type Error
1320
- */
1321
- isError: (obj: any) => obj is Error;
1322
- /**
1323
- * Checks if the type of value is a string.
1324
- * @param {any} value - Value to be checked.
1325
- * @return {boolean} True if the value is a string, false otherwise.
1326
- */
1327
- isString: (value: any) => value is string;
1328
- /**
1329
- * Checks if the type of value is a number.
1330
- * @param {any} value - Value to be checked.
1331
- * @return {boolean} True if the value is a number, false otherwise.
1332
- */
1333
- isNumber: (value: any) => value is number;
1334
- /**
1335
- * Checks if the type of value is a boolean.
1336
- * @param {any} value - Value to be checked.
1337
- * @return {boolean} True if the value is a boolean, false otherwise.
1338
- */
1339
- isBoolean: (value: any) => value is boolean;
1340
- /**
1341
- * Convert a date to I.S.O. format in IE8
1342
- */
1343
- toISOString: (date: Date) => string;
1344
- /**
1345
- * Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers
1346
- * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
1347
- * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
1348
- * cause a testing requirement to test with and without the implementations
1349
- * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
1350
- * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
1351
- */
1352
- arrForEach: <T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any) => void;
1353
- /**
1354
- * Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
1355
- * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
1356
- * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
1357
- * cause a testing requirement to test with and without the implementations
1358
- * @param searchElement The value to locate in the array.
1359
- * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
1360
- */
1361
- arrIndexOf: <T>(arr: T[], searchElement: T, fromIndex?: number) => number;
1362
- /**
1363
- * Calls a defined callback function on each element of an array, and returns an array that contains the results. This helper exists
1364
- * to avoid adding a polyfil for older browsers that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page
1365
- * checks for presence/absence of the prototype implementation. Note: For consistency this will not use the Array.prototype.xxxx
1366
- * implementation if it exists as this would cause a testing requirement to test with and without the implementations
1367
- * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
1368
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
1369
- */
1370
- arrMap: <T, R>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => R, thisArg?: any) => R[];
1371
- /**
1372
- * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is
1373
- * provided as an argument in the next call to the callback function. This helper exists to avoid adding a polyfil for older browsers that do not define
1374
- * Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype implementation. Note: For consistency
1375
- * this will not use the Array.prototype.xxxx implementation if it exists as this would cause a testing requirement to test with and without the implementations
1376
- * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
1377
- * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
1378
- */
1379
- arrReduce: <T, R>(arr: T[], callbackfn: (previousValue: T | R, currentValue?: T, currentIndex?: number, array?: T[]) => R, initialValue?: R) => R;
1380
- /**
1381
- * helper method to trim strings (IE8 does not implement String.prototype.trim)
1382
- */
1383
- strTrim: (str: any) => string;
1384
- /**
1385
- * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil
1386
- * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.
1387
- * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations
1388
- * @param obj Object to use as a prototype. May be null
1389
- */
1390
- objCreate: (obj: object) => any;
1391
- /**
1392
- * Returns the names of the enumerable string properties and methods of an object. This helper exists to avoid adding a polyfil for older browsers
1393
- * that do not define Object.keys eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.
1394
- * Note: For consistency this will not use the Object.keys implementation if it exists as this would cause a testing requirement to test with and without the implementations
1395
- * @param obj Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
1396
- */
1397
- objKeys: (obj: {}) => string[];
1398
- /**
1399
- * Try to define get/set object property accessors for the target object/prototype, this will provide compatibility with
1400
- * existing API definition when run within an ES5+ container that supports accessors but still enable the code to be loaded
1401
- * and executed in an ES3 container, providing basic IE8 compatibility.
1402
- * @param target The object on which to define the property.
1403
- * @param prop The name of the property to be defined or modified.
1404
- * @param getProp The getter function to wire against the getter.
1405
- * @param setProp The setter function to wire against the setter.
1406
- * @returns True if it was able to create the accessors otherwise false
1407
- */
1408
- objDefineAccessors: <T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void) => boolean;
1409
- /**
1410
- * Trys to add an event handler for the specified event to the window, body and document
1411
- * @param eventName {string} - The name of the event
1412
- * @param callback {any} - The callback function that needs to be executed for the given event
1413
- * @return {boolean} - true if the handler was successfully added
1414
- */
1415
- addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
1416
- /**
1417
- * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
1418
- * https://caniuse.com/#search=Date.now
1419
- */
1420
- dateNow: () => number;
1421
- /**
1422
- * Identifies whether the current environment appears to be IE
1423
- */
1424
- isIE: () => boolean;
1425
- /**
1426
- * @deprecated - Use the core.getCookieMgr().disable()
1427
- * Force the SDK not to store and read any data from cookies.
1428
- */
1429
- disableCookies: () => void;
1430
- newGuid: () => string;
1431
- /**
1432
- * Return the current value of the Performance Api now() function (if available) and fallback to dateNow() if it is unavailable (IE9 or less)
1433
- * https://caniuse.com/#search=performance.now
1434
- */
1435
- perfNow: () => number;
1436
- /**
1437
- * Generate random base64 id string.
1438
- * The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)
1439
- * @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22
1440
- */
1441
- newId: (maxLength?: number) => string;
1442
- /**
1443
- * Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.
1444
- * So maxValue(16) will produce a number from 0..16 (range of 17)
1445
- * @param maxValue
1446
- */
1447
- randomValue: (maxValue: number) => number;
1448
- /**
1449
- * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
1450
- * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
1451
- */
1452
- random32: (signed?: boolean) => number;
1453
- /**
1454
- * Seed the MWC random number generator with the specified seed or a random value
1455
- * @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen
1456
- */
1457
- mwcRandomSeed: (value?: number) => void;
1458
- /**
1459
- * Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)
1460
- * instead of Math.random() defaults to un-signed.
1461
- * Used as a replacement random generator for IE to avoid issues with older IE instances.
1462
- * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
1463
- */
1464
- mwcRandom32: (signed?: boolean) => number;
1465
- /**
1466
- * generate W3C trace id
1467
- */
1468
- generateW3CId: () => string;
1469
- }
1470
-
1471
- declare interface ICustomProperties {
1472
- [key: string]: any;
1473
- }
1474
-
1475
- /**
1476
- * DependencyTelemetry telemetry interface
1477
- */
1478
- export declare interface IDependencyTelemetry extends IPartC {
1479
- id: string;
1480
- name?: string;
1481
- duration?: number;
1482
- success?: boolean;
1483
- startTime?: Date;
1484
- responseCode: number;
1485
- correlationContext?: string;
1486
- type?: string;
1487
- data?: string;
1488
- target?: string;
1489
- iKey?: string;
1490
- }
1491
-
1492
- declare interface IDiagnosticLogger {
1493
- /**
1494
- * When this is true the SDK will throw exceptions to aid in debugging.
1495
- */
1496
- enableDebugExceptions: () => boolean;
1497
- /**
1498
- * 0: OFF
1499
- * 1: only critical (default)
1500
- * 2: critical + info
1501
- */
1502
- consoleLoggingLevel: () => number;
1503
- /**
1504
- * 0: OFF (default)
1505
- * 1: CRITICAL
1506
- * 2: WARNING
1507
- */
1508
- telemetryLoggingLevel: () => number;
1509
- /**
1510
- * The maximum number of internal messages allowed to be sent per page view
1511
- */
1512
- maxInternalMessageLimit: () => number;
1513
- /**
1514
- * The internal logging queue
1515
- */
1516
- queue: _InternalLogMessage[];
1517
- /**
1518
- * This method will throw exceptions in debug mode or attempt to log the error as a console warning.
1519
- * @param severity {LoggingSeverity} - The severity of the log message
1520
- * @param message {_InternalLogMessage} - The log message.
1521
- */
1522
- throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
1523
- /**
1524
- * This will write a warning to the console if possible
1525
- * @param message {string} - The warning message
1526
- */
1527
- warnToConsole(message: string): void;
1528
- /**
1529
- * This will write an error to the console if possible.
1530
- * Provided by the default DiagnosticLogger instance, and internally the SDK will fall back to warnToConsole, however,
1531
- * direct callers MUST check for its existence on the logger as you can provide your own IDiagnosticLogger instance.
1532
- * @param message {string} - The error message
1533
- */
1534
- errorToConsole?(message: string): void;
1535
- /**
1536
- * Resets the internal message count
1537
- */
1538
- resetInternalMessageCount(): void;
1539
- /**
1540
- * Logs a message to the internal queue.
1541
- * @param severity {LoggingSeverity} - The severity of the log message
1542
- * @param message {_InternalLogMessage} - The message to log.
1543
- */
1544
- logInternalMessage?(severity: LoggingSeverity, message: _InternalLogMessage): void;
1545
- }
1546
-
1547
- declare interface IDistributedTraceContext {
1548
- /**
1549
- * Returns the current name of the page
1550
- */
1551
- getName(): string;
1552
- /**
1553
- * Sets the current name of the page
1554
- * @param pageName
1555
- */
1556
- setName(pageName: string): void;
1557
- /**
1558
- * Returns the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1559
- * Must be read from incoming headers or generated according to the W3C TraceContext specification,
1560
- * in a hex representation of 16-byte array. A.k.a. trace-id, TraceID or Distributed TraceID
1561
- */
1562
- getTraceId(): string;
1563
- /**
1564
- * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1565
- * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1566
- * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
1567
- */
1568
- setTraceId(newValue: string): void;
1569
- /**
1570
- * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1571
- * Also know as the parentId, used to link requests together
1572
- */
1573
- getSpanId(): string;
1574
- /**
1575
- * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1576
- * Also know as the parentId, used to link requests together
1577
- * https://www.w3.org/TR/trace-context/#parent-id
1578
- */
1579
- setSpanId(newValue: string): void;
1580
- /**
1581
- * An integer representation of the W3C TraceContext trace-flags.
1582
- */
1583
- getTraceFlags(): number | undefined;
1584
- /**
1585
- * https://www.w3.org/TR/trace-context/#trace-flags
1586
- * @param newValue
1587
- */
1588
- setTraceFlags(newValue?: number): void;
1589
- }
1590
-
1591
- declare interface IEnvelope extends ISerializable {
1592
- /**
1593
- * Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1.
1594
- */
1595
- ver: number;
1596
- /**
1597
- * Type name of telemetry data item.
1598
- */
1599
- name: string;
1600
- /**
1601
- * Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z.
1602
- */
1603
- time: string;
1604
- /**
1605
- * Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.
1606
- */
1607
- sampleRate: number;
1608
- /**
1609
- * Sequence field used to track absolute order of uploaded events.
1610
- */
1611
- seq: string;
1612
- /**
1613
- * The application's instrumentation key. The key is typically represented as a GUID, but there are cases when it is not a guid. No code should rely on iKey being a GUID. Instrumentation key is case insensitive.
1614
- */
1615
- iKey: string;
1616
- /**
1617
- * Key/value collection of context properties. See ContextTagKeys for information on available properties.
1618
- */
1619
- tags: {
1620
- [name: string]: any;
1621
- };
1622
- /**
1623
- * Telemetry data item.
1624
- */
1625
- data: any;
1626
- }
1627
-
1628
- export declare interface IEventTelemetry extends IPartC {
1629
- /**
1630
- * @description An event name string
1631
- * @type {string}
1632
- * @memberof IEventTelemetry
1633
- */
1634
- name: string;
1635
- /**
1636
- * @description custom defined iKey
1637
- * @type {string}
1638
- * @memberof IEventTelemetry
1639
- */
1640
- iKey?: string;
1641
- }
1642
-
1643
- declare interface IInstrumentCallDetails {
1644
- name: string;
1645
- inst: any;
1646
- /**
1647
- * This returns an object that the hook function can use to store hook specific
1648
- * context, it it not shared with any other hook instances and is unique for the
1649
- * current call.
1650
- * A hook implementation can use this to pass / share context between different
1651
- * hook callbacks eg. request/response requst/hookErrors etc.
1652
- */
1653
- ctx: () => any;
1654
- /**
1655
- * Allows the hook functions to replace the original arguments
1656
- * @param idx - The argument index (0 based)
1657
- * @param value - The new value for the argument
1658
- */
1659
- set: (idx: number, value: any) => void;
1660
- /**
1661
- * The result of the original method, only populated after the original method has returned
1662
- */
1663
- rslt?: any;
1664
- /**
1665
- * The error (exception) which occurred while executing the original method
1666
- */
1667
- err?: Error;
1668
- /**
1669
- * The Event object from (window.event) at the start of the original call
1670
- */
1671
- evt?: Event;
1672
- }
1673
-
1674
- /**
1675
- * The holder of the specific instance callback
1676
- */
1677
- declare interface IInstrumentHook {
1678
- /** Unique Id for this callback on the hooked method */
1679
- id: number;
1680
- /** Holds the callbacks */
1681
- cbks: IInstrumentHooksCallbacks;
1682
- /** Remove this hook from the function */
1683
- rm: () => void;
1684
- }
1685
-
1686
- /**
1687
- * The callbacks to call for the instrumented function, you must provide at least the request and/or response callbacks, both are not required.
1688
- * You must always supply the error callback
1689
- */
1690
- declare interface IInstrumentHooksCallbacks {
1691
- /**
1692
- * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
1693
- * identify the source of the instrumented hooks
1694
- */
1695
- ns?: string | string[];
1696
- /**
1697
- * The hook callback to call before the original function is called
1698
- */
1699
- req?: InstrumentorHooksCallback;
1700
- /**
1701
- * The hook callback to call after the original function was called
1702
- */
1703
- rsp?: InstrumentorHooksCallback;
1704
- /**
1705
- * The callback to call if the hook function causes an exception
1706
- */
1707
- hkErr?: InstrumentorHooksCallback;
1708
- /**
1709
- * The callback to call if the original function causes an exception, even if you
1710
- * supply a callback the original exception will still be thrown
1711
- */
1712
- fnErr?: InstrumentorHooksCallback;
1713
- }
1714
-
1715
- export declare interface ILoadedPlugin<T extends IPlugin> {
1716
- plugin: T;
1717
- /**
1718
- * Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
1719
- * via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
1720
- * @returns boolean = true if the plugin is in a state where it is operational.
1721
- */
1722
- isEnabled: () => boolean;
1723
- /**
1724
- * You can optionally enable / disable a plugin from processing events.
1725
- * Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
1726
- * as the plugin must also have been successfully initialized and not had it's `teardown` method called
1727
- * (unless it's also been re-initialized)
1728
- */
1729
- setEnabled: (isEnabled: boolean) => void;
1730
- remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
1731
- }
1732
-
1733
- export declare interface IMetricTelemetry extends IPartC {
1734
- /**
1735
- * @description (required) - name of this metric
1736
- * @type {string}
1737
- * @memberof IMetricTelemetry
1738
- */
1739
- name: string;
1740
- /**
1741
- * @description (required) - Recorded value/average for this metric
1742
- * @type {number}
1743
- * @memberof IMetricTelemetry
1744
- */
1745
- average: number;
1746
- /**
1747
- * @description (optional) Number of samples represented by the average.
1748
- * @type {number=}
1749
- * @memberof IMetricTelemetry
1750
- * @default sampleCount=1
1751
- */
1752
- sampleCount?: number;
1753
- /**
1754
- * @description (optional) The smallest measurement in the sample. Defaults to the average
1755
- * @type {number}
1756
- * @memberof IMetricTelemetry
1757
- * @default min=average
1758
- */
1759
- min?: number;
1760
- /**
1761
- * @description (optional) The largest measurement in the sample. Defaults to the average.
1762
- * @type {number}
1763
- * @memberof IMetricTelemetry
1764
- * @default max=average
1765
- */
1766
- max?: number;
1767
- /**
1768
- * (optional) The standard deviation measurement in the sample, Defaults to undefined which results in zero.
1769
- */
1770
- stdDev?: number;
1771
- /**
1772
- * @description custom defined iKey
1773
- * @type {string}
1774
- * @memberof IMetricTelemetry
1775
- */
1776
- iKey?: string;
1777
- }
1778
-
1779
- /**
1780
- * An interface used for the notification listener.
1781
- * @interface
1782
- */
1783
- declare interface INotificationListener {
1784
- /**
1785
- * [Optional] A function called when events are sent.
1786
- * @param {ITelemetryItem[]} events - The array of events that have been sent.
1787
- */
1788
- eventsSent?: (events: ITelemetryItem[]) => void;
1789
- /**
1790
- * [Optional] A function called when events are discarded.
1791
- * @param {ITelemetryItem[]} events - The array of events that have been discarded.
1792
- * @param {number} reason - The reason for discarding the events. The EventsDiscardedReason
1793
- * constant should be used to check the different values.
1794
- */
1795
- eventsDiscarded?: (events: ITelemetryItem[], reason: number) => void;
1796
- /**
1797
- * [Optional] A function called when the events have been requested to be sent to the sever.
1798
- * @param {number} sendReason - The reason why the event batch is being sent.
1799
- * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1800
- */
1801
- eventsSendRequest?: (sendReason: number, isAsync?: boolean) => void;
1802
- /**
1803
- * [Optional] This event is sent if you have enabled perf events, they are primarily used to track internal performance testing and debugging
1804
- * the event can be displayed via the debug plugin extension.
1805
- * @param perfEvent
1806
- */
1807
- perfEvent?: (perfEvent: IPerfEvent) => void;
1808
- }
1809
-
1810
- /**
1811
- * Class to manage sending notifications to all the listeners.
1812
- */
1813
- declare interface INotificationManager {
1814
- listeners: INotificationListener[];
1815
- /**
1816
- * Adds a notification listener.
1817
- * @param {INotificationListener} listener - The notification listener to be added.
1818
- */
1819
- addNotificationListener(listener: INotificationListener): void;
1820
- /**
1821
- * Removes all instances of the listener.
1822
- * @param {INotificationListener} listener - AWTNotificationListener to remove.
1823
- */
1824
- removeNotificationListener(listener: INotificationListener): void;
1825
- /**
1826
- * Notification for events sent.
1827
- * @param {ITelemetryItem[]} events - The array of events that have been sent.
1828
- */
1829
- eventsSent(events: ITelemetryItem[]): void;
1830
- /**
1831
- * Notification for events being discarded.
1832
- * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.
1833
- * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
1834
- * constant should be used to check the different values.
1835
- */
1836
- eventsDiscarded(events: ITelemetryItem[], reason: number): void;
1837
- /**
1838
- * [Optional] A function called when the events have been requested to be sent to the sever.
1839
- * @param {number} sendReason - The reason why the event batch is being sent.
1840
- * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
1841
- */
1842
- eventsSendRequest?(sendReason: number, isAsync: boolean): void;
1843
- /**
1844
- * [Optional] This event is sent if you have enabled perf events, they are primarily used to track internal performance testing and debugging
1845
- * the event can be displayed via the debug plugin extension.
1846
- * @param perfEvent
1847
- */
1848
- perfEvent?(perfEvent: IPerfEvent): void;
1849
- }
1850
-
1851
- /**
1852
- * A callback function that will be called for the wrapped instrumentation function
1853
- * before the original function is executed.
1854
- */
1855
- declare type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetails, ...orgArgs: any[]) => void;
1856
-
1857
- declare class _InternalLogMessage {
1858
- static dataType: string;
1859
- message: string;
1860
- messageId: _InternalMessageId;
1861
- constructor(msgId: _InternalMessageId, msg: string, isUserAct?: boolean, properties?: Object);
1862
- }
1863
-
1864
- /**
1865
- * Internal message ID. Please create a new one for every conceptually different message. Please keep alphabetically ordered
1866
- */
1867
- export declare const _InternalMessageId: EnumValue<typeof _eInternalMessageId>;
1868
-
1869
- export declare type _InternalMessageId = number | _eInternalMessageId;
1870
-
1871
- export declare interface IPageViewPerformanceTelemetry extends IPartC {
1872
- /**
1873
- * name String - The name of the page. Defaults to the document title.
1874
- */
1875
- name?: string;
1876
- /**
1877
- * url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
1878
- */
1879
- uri?: string;
1880
- /**
1881
- * Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff". This is total duration in timespan format.
1882
- */
1883
- perfTotal?: string;
1884
- /**
1885
- * Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff". This represents the total page load time.
1886
- */
1887
- duration?: string;
1888
- /**
1889
- * Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff
1890
- */
1891
- networkConnect?: string;
1892
- /**
1893
- * Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff.
1894
- */
1895
- sentRequest?: string;
1896
- /**
1897
- * Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff.
1898
- */
1899
- receivedResponse?: string;
1900
- /**
1901
- * DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff
1902
- */
1903
- domProcessing?: string;
1904
- }
1905
-
1906
- /**
1907
- * Pageview telemetry interface
1908
- */
1909
- export declare interface IPageViewTelemetry extends IPartC {
1910
- /**
1911
- * name String - The string you used as the name in startTrackPage. Defaults to the document title.
1912
- */
1913
- name?: string;
1914
- /**
1915
- * uri String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
1916
- */
1917
- uri?: string;
1918
- /**
1919
- * refUri String - the URL of the source page where current page is loaded from
1920
- */
1921
- refUri?: string;
1922
- /**
1923
- * pageType String - page type
1924
- */
1925
- pageType?: string;
1926
- /**
1927
- * isLoggedIn - boolean is user logged in
1928
- */
1929
- isLoggedIn?: boolean;
1930
- /**
1931
- * Property bag to contain additional custom properties (Part C)
1932
- */
1933
- properties?: {
1934
- /**
1935
- * The number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
1936
- */
1937
- duration?: number;
1938
- [key: string]: any;
1939
- };
1940
- /**
1941
- * iKey String - custom defined iKey.
1942
- */
1943
- iKey?: string;
1944
- }
1945
-
1946
- /**
1947
- * PartC telemetry interface
1948
- */
1949
- declare interface IPartC {
1950
- /**
1951
- * Property bag to contain additional custom properties (Part C)
1952
- */
1953
- properties?: {
1954
- [key: string]: any;
1955
- };
1956
- /**
1957
- * Property bag to contain additional custom measurements (Part C)
1958
- * @deprecated -- please use properties instead
1959
- */
1960
- measurements?: {
1961
- [key: string]: number;
1962
- };
1963
- }
1964
-
1965
- /**
1966
- * This interface identifies the details of an internal performance event - it does not represent an outgoing reported event
1967
- */
1968
- declare interface IPerfEvent {
1969
- /**
1970
- * The name of the performance event
1971
- */
1972
- name: string;
1973
- /**
1974
- * The start time of the performance event
1975
- */
1976
- start: number;
1977
- /**
1978
- * The payload (contents) of the perfEvent, may be null or only set after the event has completed depending on
1979
- * the runtime environment.
1980
- */
1981
- payload: any;
1982
- /**
1983
- * Is this occurring from an asynchronous event
1984
- */
1985
- isAsync: boolean;
1986
- /**
1987
- * Identifies the total inclusive time spent for this event, including the time spent for child events,
1988
- * this will be undefined until the event is completed
1989
- */
1990
- time?: number;
1991
- /**
1992
- * Identifies the exclusive time spent in for this event (not including child events),
1993
- * this will be undefined until the event is completed.
1994
- */
1995
- exTime?: number;
1996
- /**
1997
- * The Parent event that was started before this event was created
1998
- */
1999
- parent?: IPerfEvent;
2000
- /**
2001
- * The child perf events that are contained within the total time of this event.
2002
- */
2003
- childEvts?: IPerfEvent[];
2004
- /**
2005
- * Identifies whether this event is a child event of a parent
2006
- */
2007
- isChildEvt: () => boolean;
2008
- /**
2009
- * Get the names additional context associated with this perf event
2010
- */
2011
- getCtx?: (key: string) => any;
2012
- /**
2013
- * Set the named additional context to be associated with this perf event, this will replace any existing value
2014
- */
2015
- setCtx?: (key: string, value: any) => void;
2016
- /**
2017
- * Mark this event as completed, calculating the total execution time.
2018
- */
2019
- complete: () => void;
2020
- }
2021
-
2022
- /**
2023
- * This defines an internal performance manager for tracking and reporting the internal performance of the SDK -- It does
2024
- * not represent or report any event to the server.
2025
- */
2026
- declare interface IPerfManager {
2027
- /**
2028
- * Create a new event and start timing, the manager may return null/undefined to indicate that it does not
2029
- * want to monitor this source event.
2030
- * @param src The source name of the event
2031
- * @param payloadDetails - An optional callback function to fetch the payload details for the event.
2032
- * @param isAsync - Is the event occurring from a async event
2033
- */
2034
- create(src: string, payloadDetails?: () => any, isAsync?: boolean): IPerfEvent | null | undefined;
2035
- /**
2036
- * Complete the perfEvent and fire any notifications.
2037
- * @param perfEvent Fire the event which will also complete the passed event
2038
- */
2039
- fire(perfEvent: IPerfEvent): void;
2040
- /**
2041
- * Set an execution context value
2042
- * @param key - The context key name
2043
- * @param value - The value
2044
- */
2045
- setCtx(key: string, value: any): void;
2046
- /**
2047
- * Get the execution context value
2048
- * @param key - The context key
2049
- */
2050
- getCtx(key: string): any;
2051
- }
2052
-
2053
- /**
2054
- * Identifies an interface to a host that can provide an IPerfManager implementation
2055
- */
2056
- declare interface IPerfManagerProvider {
2057
- /**
2058
- * Get the current performance manager
2059
- */
2060
- getPerfMgr(): IPerfManager;
2061
- /**
2062
- * Set the current performance manager
2063
- * @param perfMgr The performance manager
2064
- */
2065
- setPerfMgr(perfMgr: IPerfManager): void;
2066
- }
2067
-
2068
- export declare interface IPlugin {
2069
- /**
2070
- * Initialize plugin loaded by SDK
2071
- * @param config - The config for the plugin to use
2072
- * @param core - The current App Insights core to use for initializing this plugin instance
2073
- * @param extensions - The complete set of extensions to be used for initializing the plugin
2074
- * @param pluginChain - [Optional] specifies the current plugin chain which identifies the
2075
- * set of plugins and the order they should be executed for the current request.
2076
- */
2077
- initialize: (config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => void;
2078
- /**
2079
- * Returns a value that indicates whether the plugin has already been previously initialized.
2080
- * New plugins should implement this method to avoid being initialized more than once.
2081
- */
2082
- isInitialized?: () => boolean;
2083
- /**
2084
- * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
2085
- * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
2086
- * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
2087
- * @param unloadCtx - This is the context that should be used during unloading.
2088
- * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
2089
- * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
2090
- */
2091
- teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
2092
- /**
2093
- * Extension name
2094
- */
2095
- readonly identifier: string;
2096
- /**
2097
- * Plugin version (available in data.properties.version in common schema)
2098
- */
2099
- readonly version?: string;
2100
- /**
2101
- * The App Insights core to use for backward compatibility.
2102
- * Therefore the interface will be able to access the core without needing to cast to "any".
2103
- * [optional] any 3rd party plugins which are already implementing this interface don't fail to compile.
2104
- */
2105
- core?: IAppInsightsCore;
2106
- }
2107
-
2108
- /**
2109
- * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
2110
- * between multiple AppInsights instances
2111
- */
2112
- declare interface IProcessTelemetryContext extends IBaseProcessingContext {
2113
- /**
2114
- * Call back for telemetry processing before it it is sent
2115
- * @param env - This is the current event being reported
2116
- * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2117
- */
2118
- processNext: (env: ITelemetryItem) => boolean | void;
2119
- /**
2120
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
2121
- * @param plugins - The execution order to process the plugins, if null or not supplied
2122
- * then the current execution order will be copied.
2123
- * @param startAt - The plugin to start processing from, if missing from the execution
2124
- * order then the next plugin will be NOT set.
2125
- */
2126
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
2127
- }
2128
-
2129
- /**
2130
- * The current context for the current call to teardown() implementations, used to support when plugins are being removed
2131
- * or the SDK is being unloaded.
2132
- */
2133
- declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
2134
- /**
2135
- * This Plugin has finished unloading, so unload the next one
2136
- * @param uploadState - The state of the unload process
2137
- * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2138
- */
2139
- processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
2140
- /**
2141
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
2142
- * @param plugins - The execution order to process the plugins, if null or not supplied
2143
- * then the current execution order will be copied.
2144
- * @param startAt - The plugin to start processing from, if missing from the execution
2145
- * order then the next plugin will be NOT set.
2146
- */
2147
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
2148
- }
2149
-
2150
- /**
2151
- * The current context for the current call to the plugin update() implementations, used to support the notifications
2152
- * for when plugins are added, removed or the configuration was changed.
2153
- */
2154
- declare interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
2155
- /**
2156
- * This Plugin has finished unloading, so unload the next one
2157
- * @param updateState - The update State
2158
- * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2159
- */
2160
- processNext: (updateState: ITelemetryUpdateState) => boolean | void;
2161
- /**
2162
- * Create a new context using the core and config from the current instance, returns a new instance of the same type
2163
- * @param plugins - The execution order to process the plugins, if null or not supplied
2164
- * then the current execution order will be copied.
2165
- * @param startAt - The plugin to start processing from, if missing from the execution
2166
- * order then the next plugin will be NOT set.
2167
- */
2168
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
2169
- }
2170
-
2171
- declare interface IRequestContext {
2172
- status?: number;
2173
- xhr?: XMLHttpRequest;
2174
- request?: Request;
2175
- response?: Response | string;
2176
- }
2177
-
2178
- declare interface IResponseError {
2179
- readonly index: number;
2180
- readonly statusCode: number;
2181
- readonly message: string;
2182
- }
2183
-
2184
- declare interface ISample {
2185
- /**
2186
- * Sample rate
2187
- */
2188
- sampleRate: number;
2189
- isSampledIn(envelope: ITelemetryItem): boolean;
2190
- }
2191
-
2192
- declare interface ISendBuffer {
2193
- /**
2194
- * Enqueue the payload
2195
- */
2196
- enqueue: (payload: string) => void;
2197
- /**
2198
- * Returns the number of elements in the buffer
2199
- */
2200
- count: () => number;
2201
- /**
2202
- * Returns the current size of the serialized buffer
2203
- */
2204
- size: () => number;
2205
- /**
2206
- * Clears the buffer
2207
- */
2208
- clear: () => void;
2209
- /**
2210
- * Returns items stored in the buffer
2211
- */
2212
- getItems: () => string[];
2213
- /**
2214
- * Build a batch of all elements in the payload array
2215
- */
2216
- batchPayloads: (payload: string[]) => string;
2217
- /**
2218
- * Moves items to the SENT_BUFFER.
2219
- * The buffer holds items which were sent, but we haven't received any response from the backend yet.
2220
- */
2221
- markAsSent: (payload: string[]) => void;
2222
- /**
2223
- * Removes items from the SENT_BUFFER. Should be called on successful response from the backend.
2224
- */
2225
- clearSent: (payload: string[]) => void;
2226
- }
2227
-
2228
- declare interface ISenderConfig {
2229
- /**
2230
- * The url to which payloads will be sent
2231
- */
2232
- endpointUrl: () => string;
2233
- /**
2234
- * The JSON format (normal vs line delimited). True means line delimited JSON.
2235
- */
2236
- emitLineDelimitedJson: () => boolean;
2237
- /**
2238
- * The maximum size of a batch in bytes
2239
- */
2240
- maxBatchSizeInBytes: () => number;
2241
- /**
2242
- * The maximum interval allowed between calls to batchInvoke
2243
- */
2244
- maxBatchInterval: () => number;
2245
- /**
2246
- * The master off switch. Do not send any data if set to TRUE
2247
- */
2248
- disableTelemetry: () => boolean;
2249
- /**
2250
- * Store a copy of a send buffer in the session storage
2251
- */
2252
- enableSessionStorageBuffer: () => boolean;
2253
- /**
2254
- * Specify the storage buffer type implementation.
2255
- * @since 2.8.12
2256
- */
2257
- bufferOverride: () => IStorageBuffer | false;
2258
- /**
2259
- * Is retry handler disabled.
2260
- * If enabled, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error) and 503 (service unavailable).
2261
- */
2262
- isRetryDisabled: () => boolean;
2263
- isBeaconApiDisabled: () => boolean;
2264
- /**
2265
- * Don't use XMLHttpRequest or XDomainRequest (for IE < 9) by default instead attempt to use fetch() or sendBeacon.
2266
- * If no other transport is available it will still use XMLHttpRequest
2267
- */
2268
- disableXhr: () => boolean;
2269
- /**
2270
- * If fetch keepalive is supported do not use it for sending events during unload, it may still fallback to fetch() without keepalive
2271
- */
2272
- onunloadDisableFetch: () => boolean;
2273
- /**
2274
- * Is beacon disabled on page unload.
2275
- * If enabled, flush events through beaconSender.
2276
- */
2277
- onunloadDisableBeacon: () => boolean;
2278
- /**
2279
- * (Optional) Override the instrumentation key that this channel instance sends to
2280
- */
2281
- instrumentationKey: () => string;
2282
- namePrefix: () => string;
2283
- samplingPercentage: () => number;
2284
- /**
2285
- * (Optional) The ability for the user to provide extra headers
2286
- */
2287
- customHeaders: () => [{
2288
- header: string;
2289
- value: string;
2290
- }];
2291
- /**
2292
- * (Optional) Provide user an option to convert undefined field to user defined value.
2293
- */
2294
- convertUndefined: () => any;
2295
- /**
2296
- * (Optional) The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.
2297
- */
2298
- eventsLimitInMem: () => number;
2299
- }
2300
-
2301
- declare interface ISerializable {
2302
- /**
2303
- * The set of fields for a serializable object.
2304
- * This defines the serialization order and a value of true/false
2305
- * for each field defines whether the field is required or not.
2306
- */
2307
- aiDataContract: any;
2308
- }
2309
-
2310
- export declare function isNullOrUndefined(value: any): value is null | undefined;
2311
-
2312
- declare interface IStackDetails {
2313
- src: string;
2314
- obj: string[];
2315
- }
2316
-
2317
- /**
2318
- * Identifies a simple interface to allow you to override the storage mechanism used
2319
- * to track unsent and unacknowledged events. When provided it must provide both
2320
- * the get and set item functions.
2321
- * @since 2.8.12
2322
- */
2323
- declare interface IStorageBuffer {
2324
- /**
2325
- * Retrieves the stored value for a given key
2326
- */
2327
- getItem(logger: IDiagnosticLogger, name: string): string;
2328
- /**
2329
- * Sets the stored value for a given key
2330
- */
2331
- setItem(logger: IDiagnosticLogger, name: string, data: string): boolean;
2332
- }
2333
-
2334
- declare interface ITelemetryInitializerHandler {
2335
- remove(): void;
2336
- }
2337
-
2338
- /**
2339
- * Telemety item supported in Core
2340
- */
2341
- export declare interface ITelemetryItem {
2342
- /**
2343
- * CommonSchema Version of this SDK
2344
- */
2345
- ver?: string;
2346
- /**
2347
- * Unique name of the telemetry item
2348
- */
2349
- name: string;
2350
- /**
2351
- * Timestamp when item was sent
2352
- */
2353
- time?: string;
2354
- /**
2355
- * Identifier of the resource that uniquely identifies which resource data is sent to
2356
- */
2357
- iKey?: string;
2358
- /**
2359
- * System context properties of the telemetry item, example: ip address, city etc
2360
- */
2361
- ext?: {
2362
- [key: string]: any;
2363
- };
2364
- /**
2365
- * System context property extensions that are not global (not in ctx)
2366
- */
2367
- tags?: Tags & Tags[];
2368
- /**
2369
- * Custom data
2370
- */
2371
- data?: ICustomProperties;
2372
- /**
2373
- * Telemetry type used for part B
2374
- */
2375
- baseType?: string;
2376
- /**
2377
- * Based on schema for part B
2378
- */
2379
- baseData?: {
2380
- [key: string]: any;
2381
- };
2382
- }
2383
-
2384
- /**
2385
- * Configuration provided to SDK core
2386
- */
2387
- export declare interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
2388
- /**
2389
- * Set next extension for telemetry processing, this is not optional as plugins should use the
2390
- * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
2391
- * now for backward compatibility only.
2392
- */
2393
- setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
2394
- /**
2395
- * Priority of the extension
2396
- */
2397
- readonly priority: number;
2398
- }
2399
-
2400
- /**
2401
- * Configuration provided to SDK core
2402
- */
2403
- declare interface ITelemetryPluginChain extends ITelemetryProcessor {
2404
- /**
2405
- * Returns the underlying plugin that is being proxied for the processTelemetry call
2406
- */
2407
- getPlugin: () => ITelemetryPlugin;
2408
- /**
2409
- * Returns the next plugin
2410
- */
2411
- getNext: () => ITelemetryPluginChain;
2412
- /**
2413
- * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
2414
- * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
2415
- * @param unloadCtx - The unload context to use for this call.
2416
- * @param unloadState - The details of the unload operation
2417
- */
2418
- unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2419
- }
2420
-
2421
- declare interface ITelemetryProcessor {
2422
- /**
2423
- * Call back for telemetry processing before it it is sent
2424
- * @param env - This is the current event being reported
2425
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
2426
- * can optionally use this to access the current core instance or define / pass additional information
2427
- * to later plugins (vs appending items to the telemetry item)
2428
- */
2429
- processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2430
- /**
2431
- * The the plugin should re-evaluate configuration and update any cached configuration settings or
2432
- * plugins. If implemented this method will be called whenever a plugin is added or removed and if
2433
- * the configuration has bee updated.
2434
- * @param updateCtx - This is the context that should be used during updating.
2435
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
2436
- * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
2437
- */
2438
- update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2439
- }
2440
-
2441
- declare interface ITelemetryUnloadState {
2442
- reason: TelemetryUnloadReason;
2443
- isAsync: boolean;
2444
- flushComplete?: boolean;
2445
- }
2446
-
2447
- declare interface ITelemetryUpdateState {
2448
- /**
2449
- * Identifies the reason for the update notification, this is a bitwise numeric value
2450
- */
2451
- reason: TelemetryUpdateReason;
2452
- /**
2453
- * If this is a configuration update this was the previous configuration that was used
2454
- */
2455
- /**
2456
- * If this is a configuration update is the new configuration that is being used
2457
- */
2458
- /**
2459
- * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2460
- */
2461
- added?: IPlugin[];
2462
- /**
2463
- * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
2464
- */
2465
- removed?: IPlugin[];
2466
- }
2467
-
2468
- export declare interface ITraceTelemetry extends IPartC {
2469
- /**
2470
- * @description A message string
2471
- * @type {string}
2472
- * @memberof ITraceTelemetry
2473
- */
2474
- message: string;
2475
- /**
2476
- * @description Severity level of the logging message used for filtering in the portal
2477
- * @type {SeverityLevel}
2478
- * @memberof ITraceTelemetry
2479
- */
2480
- severityLevel?: SeverityLevel;
2481
- /**
2482
- * @description custom defiend iKey
2483
- * @type {SeverityLevel}
2484
- * @memberof ITraceTelemetry
2485
- */
2486
- iKey?: string;
2487
- }
2488
-
2489
- declare const LoggingSeverity: EnumValue<typeof eLoggingSeverity>;
2490
-
2491
- declare type LoggingSeverity = number | eLoggingSeverity;
2492
-
2493
- /**
2494
- * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
2495
- *
2496
- * @param target - The target object to be assigned with the source properties and functions
2497
- * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2498
- * @param functionsToProxy - An array of function names that will be proxied on the target
2499
- * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name
2500
- */
2501
- export declare function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
2502
-
2503
- export declare class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
2504
- static constructEnvelope(orig: ITelemetryItem, iKey: string, logger: IDiagnosticLogger, convertUndefined?: any): IEnvelope;
2505
- readonly priority: number;
2506
- readonly identifier: string;
2507
- /**
2508
- * The configuration for this sender instance
2509
- */
2510
- readonly _senderConfig: ISenderConfig;
2511
- /**
2512
- * A method which will cause data to be send to the url
2513
- */
2514
- _sender: SenderFunction;
2515
- /**
2516
- * A send buffer object
2517
- */
2518
- _buffer: ISendBuffer;
2519
- /**
2520
- * AppId of this component parsed from some backend response.
2521
- */
2522
- _appId: string;
2523
- protected _sample: ISample;
2524
- constructor();
2525
- /**
2526
- * Pause the sending (transmission) of events, this will cause all events to be batched only until the maximum limits are
2527
- * hit at which point new events are dropped. Will also cause events to NOT be sent during page unload, so if Session storage
2528
- * is disabled events will be lost.
2529
- * SessionStorage Limit is 2000 events, In-Memory (Array) Storage is 10,000 events (can be configured via the eventsLimitInMem).
2530
- */
2531
- pause(): void;
2532
- /**
2533
- * Resume the sending (transmission) of events, this will restart the timer and any batched events will be sent using the normal
2534
- * send interval.
2535
- */
2536
- resume(): void;
2537
- /**
2538
- * Flush the batched events immediately (not synchronously).
2539
- * Will not flush if the Sender has been paused.
2540
- */
2541
- flush(): void;
2542
- /**
2543
- * Flush the batched events synchronously (if possible -- based on configuration).
2544
- * Will not flush if the Send has been paused.
2545
- */
2546
- onunloadFlush(): void;
2547
- initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
2548
- processTelemetry(telemetryItem: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2549
- /**
2550
- * xhr state changes
2551
- */
2552
- _xhrReadyStateChange(xhr: XMLHttpRequest, payload: string[], countOfItemsInPayload: number): void;
2553
- /**
2554
- * Immediately send buffered data
2555
- * @param async {boolean} - Indicates if the events should be sent asynchronously
2556
- * @param forcedSender {SenderFunction} - Indicates the forcedSender, undefined if not passed
2557
- */
2558
- triggerSend(async?: boolean, forcedSender?: SenderFunction, sendReason?: SendRequestReason): void;
2559
- /**
2560
- * error handler
2561
- */
2562
- _onError(payload: string[], message: string, event?: ErrorEvent): void;
2563
- /**
2564
- * partial success handler
2565
- */
2566
- _onPartialSuccess(payload: string[], results: IBackendResponse): void;
2567
- /**
2568
- * success handler
2569
- */
2570
- _onSuccess(payload: string[], countOfItemsInPayload: number): void;
2571
- /**
2572
- * xdr state changes
2573
- */
2574
- _xdrOnLoad(xdr: XDomainRequest, payload: string[]): void;
2575
- /**
2576
- * Add header to request
2577
- * @param name - Header name.
2578
- * @param value - Header value.
2579
- */
2580
- addHeader(name: string, value: string): void;
2581
- }
2582
-
2583
- declare type SenderFunction = (payload: string[], isAsync: boolean) => void;
2584
-
2585
- /**
2586
- * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
2587
- */
2588
- export declare const enum SendRequestReason {
2589
- /**
2590
- * No specific reason was specified
2591
- */
2592
- Undefined = 0,
2593
- /**
2594
- * Events are being sent based on the normal event schedule / timer.
2595
- */
2596
- NormalSchedule = 1,
2597
- /**
2598
- * A manual flush request was received
2599
- */
2600
- ManualFlush = 1,
2601
- /**
2602
- * Unload event is being processed
2603
- */
2604
- Unload = 2,
2605
- /**
2606
- * The event(s) being sent are sync events
2607
- */
2608
- SyncEvent = 3,
2609
- /**
2610
- * The Channel was resumed
2611
- */
2612
- Resumed = 4,
2613
- /**
2614
- * The event(s) being sent as a retry
2615
- */
2616
- Retry = 5,
2617
- /**
2618
- * The SDK is unloading
2619
- */
2620
- SdkUnload = 6,
2621
- /**
2622
- * Maximum batch size would be exceeded
2623
- */
2624
- MaxBatchSize = 10,
2625
- /**
2626
- * The Maximum number of events have already been queued
2627
- */
2628
- MaxQueuedEvents = 20
2629
- }
2630
-
2631
- /**
2632
- * Defines the level of severity for the event.
2633
- */
2634
- export declare const SeverityLevel: EnumValue<typeof eSeverityLevel>;
2635
-
2636
- export declare type SeverityLevel = number | eSeverityLevel;
2637
-
2638
- declare interface Tags {
2639
- [key: string]: any;
2640
- }
148
+ export { ITraceTelemetry }
2641
149
 
2642
- declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2643
-
2644
- /**
2645
- * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2646
- */
2647
- declare const enum TelemetryUnloadReason {
2648
- /**
2649
- * Teardown has been called without any context.
2650
- */
2651
- ManualTeardown = 0,
2652
- /**
2653
- * Just this plugin is being removed
2654
- */
2655
- PluginUnload = 1,
2656
- /**
2657
- * This instance of the plugin is being removed and replaced
2658
- */
2659
- PluginReplace = 2,
2660
- /**
2661
- * The entire SDK is being unloaded
2662
- */
2663
- SdkUnload = 50
2664
- }
150
+ export { proxyFunctions }
2665
151
 
2666
- /**
2667
- * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
2668
- */
2669
- declare const enum TelemetryUpdateReason {
2670
- /**
2671
- * Unknown.
2672
- */
2673
- Unknown = 0,
2674
- /**
2675
- * The configuration has ben updated or changed
2676
- */
2677
- /**
2678
- * One or more plugins have been added
2679
- */
2680
- PluginAdded = 16,
2681
- /**
2682
- * One or more plugins have been removed
2683
- */
2684
- PluginRemoved = 32
2685
- }
152
+ export { Sender }
2686
153
 
2687
- export declare function throwError(message: string): never;
154
+ export { SendRequestReason }
2688
155
 
2689
- declare type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
156
+ export { SeverityLevel }
2690
157
 
2691
- declare interface XDomainRequest extends XMLHttpRequestEventTarget {
2692
- readonly responseText: string;
2693
- send(payload: string): void;
2694
- open(method: string, url: string): void;
2695
- }
158
+ export { throwError }
2696
159
 
2697
160
  export { }