@microsoft/applicationinsights-web-basic 3.0.1-nightly3.2304-35 → 3.0.1-nightly3.2304-41

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