@microsoft/applicationinsights-web-basic 2.8.0-beta.2202-07 → 2.8.0-beta.2203-03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/aib.2.8.0-beta.2203-03.integrity.json +26 -0
- package/browser/{aib.2.8.0-beta.2202-07.js → aib.2.8.0-beta.2203-03.js} +1024 -476
- package/browser/aib.2.8.0-beta.2203-03.js.map +1 -0
- package/browser/aib.2.8.0-beta.2203-03.min.js +6 -0
- package/browser/aib.2.8.0-beta.2203-03.min.js.map +1 -0
- package/browser/aib.2.js +1023 -475
- package/browser/aib.2.js.map +1 -1
- package/browser/aib.2.min.js +2 -2
- package/browser/aib.2.min.js.map +1 -1
- package/dist/applicationinsights-web-basic.api.json +256 -0
- package/dist/applicationinsights-web-basic.api.md +6 -1
- package/dist/applicationinsights-web-basic.d.ts +340 -78
- package/dist/applicationinsights-web-basic.js +1023 -475
- package/dist/applicationinsights-web-basic.js.map +1 -1
- package/dist/applicationinsights-web-basic.min.js +2 -2
- package/dist/applicationinsights-web-basic.min.js.map +1 -1
- package/dist/applicationinsights-web-basic.rollup.d.ts +340 -78
- package/dist-esm/index.js +1 -1
- package/package.json +4 -4
- package/browser/aib.2.8.0-beta.2202-07.integrity.json +0 -26
- package/browser/aib.2.8.0-beta.2202-07.js.map +0 -1
- package/browser/aib.2.8.0-beta.2202-07.min.js +0 -6
- package/browser/aib.2.8.0-beta.2202-07.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft.ApplicationInsights, 2.8.0-beta.
|
|
2
|
+
* Microsoft.ApplicationInsights, 2.8.0-beta.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -100,7 +100,26 @@ declare namespace ApplicationInsights {
|
|
|
100
100
|
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
101
101
|
*/
|
|
102
102
|
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
103
|
+
/**
|
|
104
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
105
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
106
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
107
|
+
* approach is to create a new instance and initialize that instance.
|
|
108
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
109
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
110
|
+
*/
|
|
111
|
+
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
103
112
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
113
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
|
|
114
|
+
/**
|
|
115
|
+
* Returns the unique event namespace that should be used
|
|
116
|
+
*/
|
|
117
|
+
evtNamespace(): string;
|
|
118
|
+
/**
|
|
119
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
120
|
+
* @param handler - the handler
|
|
121
|
+
*/
|
|
122
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
104
123
|
protected releaseQueue(): void;
|
|
105
124
|
}
|
|
106
125
|
|
|
@@ -149,9 +168,32 @@ declare namespace ApplicationInsights {
|
|
|
149
168
|
* Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
|
|
150
169
|
*/
|
|
151
170
|
protected setInitialized: (isInitialized: boolean) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
173
|
+
* finishes it's removal.
|
|
174
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
175
|
+
* @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.
|
|
176
|
+
* @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.
|
|
177
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
178
|
+
*/
|
|
179
|
+
protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
152
180
|
constructor();
|
|
153
181
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
182
|
+
/**
|
|
183
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
184
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
185
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
186
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
187
|
+
* @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.
|
|
188
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
189
|
+
*/
|
|
190
|
+
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
154
191
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
192
|
+
/**
|
|
193
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
194
|
+
* @param handler - the handler
|
|
195
|
+
*/
|
|
196
|
+
protected _addUnloadCb(handler: UnloadHandler): void;
|
|
155
197
|
/**
|
|
156
198
|
* Add this hook so that it is automatically removed during unloading
|
|
157
199
|
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
@@ -167,7 +209,15 @@ declare namespace ApplicationInsights {
|
|
|
167
209
|
*/
|
|
168
210
|
const CoreUtils: ICoreUtils;
|
|
169
211
|
|
|
170
|
-
|
|
212
|
+
const DistributedTracingModes: {
|
|
213
|
+
AI: number;
|
|
214
|
+
AI_AND_W3C: number;
|
|
215
|
+
W3C: number;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
type DistributedTracingModes = number | eDistributedTracingModes;
|
|
219
|
+
|
|
220
|
+
const enum eDistributedTracingModes {
|
|
171
221
|
/**
|
|
172
222
|
* (Default) Send Application Insights correlation headers
|
|
173
223
|
*/
|
|
@@ -182,6 +232,102 @@ declare namespace ApplicationInsights {
|
|
|
182
232
|
W3C = 2
|
|
183
233
|
}
|
|
184
234
|
|
|
235
|
+
const enum _eInternalMessageId {
|
|
236
|
+
BrowserDoesNotSupportLocalStorage = 0,
|
|
237
|
+
BrowserCannotReadLocalStorage = 1,
|
|
238
|
+
BrowserCannotReadSessionStorage = 2,
|
|
239
|
+
BrowserCannotWriteLocalStorage = 3,
|
|
240
|
+
BrowserCannotWriteSessionStorage = 4,
|
|
241
|
+
BrowserFailedRemovalFromLocalStorage = 5,
|
|
242
|
+
BrowserFailedRemovalFromSessionStorage = 6,
|
|
243
|
+
CannotSendEmptyTelemetry = 7,
|
|
244
|
+
ClientPerformanceMathError = 8,
|
|
245
|
+
ErrorParsingAISessionCookie = 9,
|
|
246
|
+
ErrorPVCalc = 10,
|
|
247
|
+
ExceptionWhileLoggingError = 11,
|
|
248
|
+
FailedAddingTelemetryToBuffer = 12,
|
|
249
|
+
FailedMonitorAjaxAbort = 13,
|
|
250
|
+
FailedMonitorAjaxDur = 14,
|
|
251
|
+
FailedMonitorAjaxOpen = 15,
|
|
252
|
+
FailedMonitorAjaxRSC = 16,
|
|
253
|
+
FailedMonitorAjaxSend = 17,
|
|
254
|
+
FailedMonitorAjaxGetCorrelationHeader = 18,
|
|
255
|
+
FailedToAddHandlerForOnBeforeUnload = 19,
|
|
256
|
+
FailedToSendQueuedTelemetry = 20,
|
|
257
|
+
FailedToReportDataLoss = 21,
|
|
258
|
+
FlushFailed = 22,
|
|
259
|
+
MessageLimitPerPVExceeded = 23,
|
|
260
|
+
MissingRequiredFieldSpecification = 24,
|
|
261
|
+
NavigationTimingNotSupported = 25,
|
|
262
|
+
OnError = 26,
|
|
263
|
+
SessionRenewalDateIsZero = 27,
|
|
264
|
+
SenderNotInitialized = 28,
|
|
265
|
+
StartTrackEventFailed = 29,
|
|
266
|
+
StopTrackEventFailed = 30,
|
|
267
|
+
StartTrackFailed = 31,
|
|
268
|
+
StopTrackFailed = 32,
|
|
269
|
+
TelemetrySampledAndNotSent = 33,
|
|
270
|
+
TrackEventFailed = 34,
|
|
271
|
+
TrackExceptionFailed = 35,
|
|
272
|
+
TrackMetricFailed = 36,
|
|
273
|
+
TrackPVFailed = 37,
|
|
274
|
+
TrackPVFailedCalc = 38,
|
|
275
|
+
TrackTraceFailed = 39,
|
|
276
|
+
TransmissionFailed = 40,
|
|
277
|
+
FailedToSetStorageBuffer = 41,
|
|
278
|
+
FailedToRestoreStorageBuffer = 42,
|
|
279
|
+
InvalidBackendResponse = 43,
|
|
280
|
+
FailedToFixDepricatedValues = 44,
|
|
281
|
+
InvalidDurationValue = 45,
|
|
282
|
+
TelemetryEnvelopeInvalid = 46,
|
|
283
|
+
CreateEnvelopeError = 47,
|
|
284
|
+
CannotSerializeObject = 48,
|
|
285
|
+
CannotSerializeObjectNonSerializable = 49,
|
|
286
|
+
CircularReferenceDetected = 50,
|
|
287
|
+
ClearAuthContextFailed = 51,
|
|
288
|
+
ExceptionTruncated = 52,
|
|
289
|
+
IllegalCharsInName = 53,
|
|
290
|
+
ItemNotInArray = 54,
|
|
291
|
+
MaxAjaxPerPVExceeded = 55,
|
|
292
|
+
MessageTruncated = 56,
|
|
293
|
+
NameTooLong = 57,
|
|
294
|
+
SampleRateOutOfRange = 58,
|
|
295
|
+
SetAuthContextFailed = 59,
|
|
296
|
+
SetAuthContextFailedAccountName = 60,
|
|
297
|
+
StringValueTooLong = 61,
|
|
298
|
+
StartCalledMoreThanOnce = 62,
|
|
299
|
+
StopCalledWithoutStart = 63,
|
|
300
|
+
TelemetryInitializerFailed = 64,
|
|
301
|
+
TrackArgumentsNotSpecified = 65,
|
|
302
|
+
UrlTooLong = 66,
|
|
303
|
+
SessionStorageBufferFull = 67,
|
|
304
|
+
CannotAccessCookie = 68,
|
|
305
|
+
IdTooLong = 69,
|
|
306
|
+
InvalidEvent = 70,
|
|
307
|
+
FailedMonitorAjaxSetRequestHeader = 71,
|
|
308
|
+
SendBrowserInfoOnUserInit = 72,
|
|
309
|
+
PluginException = 73,
|
|
310
|
+
NotificationException = 74,
|
|
311
|
+
SnippetScriptLoadFailure = 99,
|
|
312
|
+
InvalidInstrumentationKey = 100,
|
|
313
|
+
CannotParseAiBlobValue = 101,
|
|
314
|
+
InvalidContentBlob = 102,
|
|
315
|
+
TrackPageActionEventFailed = 103,
|
|
316
|
+
FailedAddingCustomDefinedRequestContext = 104,
|
|
317
|
+
InMemoryStorageBufferFull = 105
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const enum eLoggingSeverity {
|
|
321
|
+
/**
|
|
322
|
+
* Error will be sent as internal telemetry
|
|
323
|
+
*/
|
|
324
|
+
CRITICAL = 1,
|
|
325
|
+
/**
|
|
326
|
+
* Error will NOT be sent as internal telemetry, and will only be shown in browser console
|
|
327
|
+
*/
|
|
328
|
+
WARNING = 2
|
|
329
|
+
}
|
|
330
|
+
|
|
185
331
|
const enum GetExtCfgMergeType {
|
|
186
332
|
None = 0,
|
|
187
333
|
MergeDefaultOnly = 1,
|
|
@@ -235,11 +381,36 @@ declare namespace ApplicationInsights {
|
|
|
235
381
|
* Return a new instance of the IProcessTelemetryContext for processing events
|
|
236
382
|
*/
|
|
237
383
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
384
|
+
/**
|
|
385
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
386
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
387
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
388
|
+
* approach is to create a new instance and initialize that instance.
|
|
389
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
390
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
391
|
+
*/
|
|
392
|
+
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
238
393
|
/**
|
|
239
394
|
* Find and return the (first) plugin with the specified identifier if present
|
|
240
395
|
* @param pluginIdentifier
|
|
241
396
|
*/
|
|
242
397
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
398
|
+
/**
|
|
399
|
+
* Add a new plugin to the installation
|
|
400
|
+
* @param plugin - The new plugin to add
|
|
401
|
+
* @param replaceExisting - should any existing plugin be replaced
|
|
402
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
403
|
+
*/
|
|
404
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
|
|
405
|
+
/**
|
|
406
|
+
* Returns the unique event namespace that should be used when registering events
|
|
407
|
+
*/
|
|
408
|
+
evtNamespace(): string;
|
|
409
|
+
/**
|
|
410
|
+
* Add a handler that will be called when the SDK is being unloaded
|
|
411
|
+
* @param handler - the handler
|
|
412
|
+
*/
|
|
413
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
243
414
|
}
|
|
244
415
|
|
|
245
416
|
/**
|
|
@@ -323,6 +494,67 @@ declare namespace ApplicationInsights {
|
|
|
323
494
|
readonly appId?: string;
|
|
324
495
|
}
|
|
325
496
|
|
|
497
|
+
interface IBaseProcessingContext {
|
|
498
|
+
/**
|
|
499
|
+
* The current core instance for the request
|
|
500
|
+
*/
|
|
501
|
+
core: () => IAppInsightsCore;
|
|
502
|
+
/**
|
|
503
|
+
* THe current diagnostic logger for the request
|
|
504
|
+
*/
|
|
505
|
+
diagLog: () => IDiagnosticLogger;
|
|
506
|
+
/**
|
|
507
|
+
* Gets the current core config instance
|
|
508
|
+
*/
|
|
509
|
+
getCfg: () => IConfiguration;
|
|
510
|
+
/**
|
|
511
|
+
* Gets the named extension config
|
|
512
|
+
*/
|
|
513
|
+
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
514
|
+
/**
|
|
515
|
+
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
516
|
+
* default value is returned
|
|
517
|
+
* @param identifier The named extension identifier
|
|
518
|
+
* @param field The config field name
|
|
519
|
+
* @param defaultValue The default value to return if no defined config exists
|
|
520
|
+
*/
|
|
521
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
522
|
+
/**
|
|
523
|
+
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
524
|
+
* required if there is a nextPlugin
|
|
525
|
+
*/
|
|
526
|
+
hasNext: () => boolean;
|
|
527
|
+
/**
|
|
528
|
+
* Returns the next configured plugin proxy
|
|
529
|
+
*/
|
|
530
|
+
getNext: () => ITelemetryPluginChain;
|
|
531
|
+
/**
|
|
532
|
+
* Helper to set the next plugin proxy
|
|
533
|
+
*/
|
|
534
|
+
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
535
|
+
/**
|
|
536
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
537
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
538
|
+
* @param callback - The function call for each plugin in the context chain
|
|
539
|
+
*/
|
|
540
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
541
|
+
/**
|
|
542
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
543
|
+
* @param onComplete - The onComplete to call
|
|
544
|
+
* @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
|
|
545
|
+
* @param args - Any additional arguments to pass to the onComplete function
|
|
546
|
+
*/
|
|
547
|
+
onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
|
|
548
|
+
/**
|
|
549
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
550
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
551
|
+
* then the current execution order will be copied.
|
|
552
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
553
|
+
* order then the next plugin will be NOT set.
|
|
554
|
+
*/
|
|
555
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
|
|
556
|
+
}
|
|
557
|
+
|
|
326
558
|
/**
|
|
327
559
|
* Provides data transmission capabilities
|
|
328
560
|
*/
|
|
@@ -336,9 +568,14 @@ declare namespace ApplicationInsights {
|
|
|
336
568
|
*/
|
|
337
569
|
resume(): void;
|
|
338
570
|
/**
|
|
339
|
-
* Tear down
|
|
571
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
572
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
573
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
574
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
575
|
+
* @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.
|
|
576
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
340
577
|
*/
|
|
341
|
-
teardown()
|
|
578
|
+
teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
342
579
|
/**
|
|
343
580
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
344
581
|
* @param async - send data asynchronously when true
|
|
@@ -1022,7 +1259,7 @@ declare namespace ApplicationInsights {
|
|
|
1022
1259
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
1023
1260
|
* @return {boolean} - true if the handler was successfully added
|
|
1024
1261
|
*/
|
|
1025
|
-
addEventHandler: (eventName: string, callback: any) => boolean;
|
|
1262
|
+
addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
|
|
1026
1263
|
/**
|
|
1027
1264
|
* Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
|
|
1028
1265
|
* https://caniuse.com/#search=Date.now
|
|
@@ -1251,6 +1488,20 @@ declare namespace ApplicationInsights {
|
|
|
1251
1488
|
|
|
1252
1489
|
interface ILoadedPlugin<T extends IPlugin> {
|
|
1253
1490
|
plugin: T;
|
|
1491
|
+
/**
|
|
1492
|
+
* Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
|
|
1493
|
+
* via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
|
|
1494
|
+
* @returns boolean = true if the plugin is in a state where it is operational.
|
|
1495
|
+
*/
|
|
1496
|
+
isEnabled: () => boolean;
|
|
1497
|
+
/**
|
|
1498
|
+
* You can optionally enable / disable a plugin from processing events.
|
|
1499
|
+
* Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
|
|
1500
|
+
* as the plugin must also have been successfully initialized and not had it's `teardown` method called
|
|
1501
|
+
* (unless it's also been re-initialized)
|
|
1502
|
+
*/
|
|
1503
|
+
setEnabled: (isEnabled: boolean) => void;
|
|
1504
|
+
remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
|
|
1254
1505
|
}
|
|
1255
1506
|
|
|
1256
1507
|
interface IMetricTelemetry extends IPartC {
|
|
@@ -1472,7 +1723,7 @@ declare namespace ApplicationInsights {
|
|
|
1472
1723
|
InMemoryStorageBufferFull: number;
|
|
1473
1724
|
};
|
|
1474
1725
|
|
|
1475
|
-
type _InternalMessageId = number |
|
|
1726
|
+
type _InternalMessageId = number | _eInternalMessageId;
|
|
1476
1727
|
|
|
1477
1728
|
interface IPageViewPerformanceTelemetry extends IPartC {
|
|
1478
1729
|
/**
|
|
@@ -1687,10 +1938,14 @@ declare namespace ApplicationInsights {
|
|
|
1687
1938
|
*/
|
|
1688
1939
|
isInitialized?: () => boolean;
|
|
1689
1940
|
/**
|
|
1690
|
-
* Tear down the plugin and remove any hooked value, the plugin should
|
|
1691
|
-
* therefore
|
|
1941
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
1942
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
1943
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
1944
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
1945
|
+
* @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.
|
|
1946
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
1692
1947
|
*/
|
|
1693
|
-
teardown?: () => void;
|
|
1948
|
+
teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
1694
1949
|
/**
|
|
1695
1950
|
* Extension name
|
|
1696
1951
|
*/
|
|
@@ -1705,67 +1960,42 @@ declare namespace ApplicationInsights {
|
|
|
1705
1960
|
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
1706
1961
|
* between multiple AppInsights instances
|
|
1707
1962
|
*/
|
|
1708
|
-
interface IProcessTelemetryContext {
|
|
1709
|
-
/**
|
|
1710
|
-
* The current core instance for the request
|
|
1711
|
-
*/
|
|
1712
|
-
core: () => IAppInsightsCore;
|
|
1713
|
-
/**
|
|
1714
|
-
* THe current diagnostic logger for the request
|
|
1715
|
-
*/
|
|
1716
|
-
diagLog: () => IDiagnosticLogger;
|
|
1717
|
-
/**
|
|
1718
|
-
* Gets the current core config instance
|
|
1719
|
-
*/
|
|
1720
|
-
getCfg: () => IConfiguration;
|
|
1721
|
-
/**
|
|
1722
|
-
* Gets the named extension config
|
|
1723
|
-
*/
|
|
1724
|
-
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
1725
|
-
/**
|
|
1726
|
-
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
1727
|
-
* default value is returned
|
|
1728
|
-
* @param identifier The named extension identifier
|
|
1729
|
-
* @param field The config field name
|
|
1730
|
-
* @param defaultValue The default value to return if no defined config exists
|
|
1731
|
-
*/
|
|
1732
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
1733
|
-
/**
|
|
1734
|
-
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
1735
|
-
* required if there is a nextPlugin
|
|
1736
|
-
*/
|
|
1737
|
-
hasNext: () => boolean;
|
|
1738
|
-
/**
|
|
1739
|
-
* Returns the next configured plugin proxy
|
|
1740
|
-
*/
|
|
1741
|
-
getNext: () => ITelemetryPluginChain;
|
|
1742
|
-
/**
|
|
1743
|
-
* Helper to set the next plugin proxy
|
|
1744
|
-
*/
|
|
1745
|
-
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
1963
|
+
interface IProcessTelemetryContext extends IBaseProcessingContext {
|
|
1746
1964
|
/**
|
|
1747
1965
|
* Call back for telemetry processing before it it is sent
|
|
1748
1966
|
* @param env - This is the current event being reported
|
|
1967
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1749
1968
|
*/
|
|
1750
|
-
processNext: (env: ITelemetryItem) => void;
|
|
1751
|
-
/**
|
|
1752
|
-
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
1753
|
-
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
1754
|
-
* @param callback - The function call for each plugin in the context chain
|
|
1755
|
-
*/
|
|
1756
|
-
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
1969
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
1757
1970
|
/**
|
|
1758
|
-
* Create a new context using the core and config from the current instance
|
|
1971
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1759
1972
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1760
1973
|
* then the current execution order will be copied.
|
|
1761
1974
|
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1762
1975
|
* order then the next plugin will be NOT set.
|
|
1763
1976
|
*/
|
|
1764
1977
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
/**
|
|
1981
|
+
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
1982
|
+
* between multiple AppInsights instances
|
|
1983
|
+
*/
|
|
1984
|
+
interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
1765
1985
|
/**
|
|
1766
|
-
*
|
|
1986
|
+
* This Plugin has finished unloading, so unload the next one
|
|
1987
|
+
* @param uploadState - The state of the unload process
|
|
1988
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
1767
1989
|
*/
|
|
1768
|
-
|
|
1990
|
+
processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
|
|
1991
|
+
/**
|
|
1992
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
1993
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
1994
|
+
* then the current execution order will be copied.
|
|
1995
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
1996
|
+
* order then the next plugin will be NOT set.
|
|
1997
|
+
*/
|
|
1998
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
1769
1999
|
}
|
|
1770
2000
|
|
|
1771
2001
|
interface IRequestContext {
|
|
@@ -1960,15 +2190,7 @@ declare namespace ApplicationInsights {
|
|
|
1960
2190
|
/**
|
|
1961
2191
|
* Configuration provided to SDK core
|
|
1962
2192
|
*/
|
|
1963
|
-
interface ITelemetryPlugin extends IPlugin {
|
|
1964
|
-
/**
|
|
1965
|
-
* Call back for telemetry processing before it it is sent
|
|
1966
|
-
* @param env - This is the current event being reported
|
|
1967
|
-
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
1968
|
-
* can optionally use this to access the current core instance or define / pass additional information
|
|
1969
|
-
* to later plugins (vs appending items to the telemetry item)
|
|
1970
|
-
*/
|
|
1971
|
-
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2193
|
+
interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
|
|
1972
2194
|
/**
|
|
1973
2195
|
* Set next extension for telemetry processing, this is not optional as plugins should use the
|
|
1974
2196
|
* processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
|
|
@@ -1984,7 +2206,7 @@ declare namespace ApplicationInsights {
|
|
|
1984
2206
|
/**
|
|
1985
2207
|
* Configuration provided to SDK core
|
|
1986
2208
|
*/
|
|
1987
|
-
interface ITelemetryPluginChain {
|
|
2209
|
+
interface ITelemetryPluginChain extends ITelemetryProcessor {
|
|
1988
2210
|
/**
|
|
1989
2211
|
* Returns the underlying plugin that is being proxied for the processTelemetry call
|
|
1990
2212
|
*/
|
|
@@ -1993,6 +2215,16 @@ declare namespace ApplicationInsights {
|
|
|
1993
2215
|
* Returns the next plugin
|
|
1994
2216
|
*/
|
|
1995
2217
|
getNext: () => ITelemetryPluginChain;
|
|
2218
|
+
/**
|
|
2219
|
+
* This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
|
|
2220
|
+
* call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
|
|
2221
|
+
* @param unloadCtx - The unload context to use for this call.
|
|
2222
|
+
* @param unloadState - The details of the unload operation
|
|
2223
|
+
*/
|
|
2224
|
+
unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
interface ITelemetryProcessor {
|
|
1996
2228
|
/**
|
|
1997
2229
|
* Call back for telemetry processing before it it is sent
|
|
1998
2230
|
* @param env - This is the current event being reported
|
|
@@ -2000,7 +2232,13 @@ declare namespace ApplicationInsights {
|
|
|
2000
2232
|
* can optionally use this to access the current core instance or define / pass additional information
|
|
2001
2233
|
* to later plugins (vs appending items to the telemetry item)
|
|
2002
2234
|
*/
|
|
2003
|
-
processTelemetry: (env: ITelemetryItem, itemCtx
|
|
2235
|
+
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
interface ITelemetryUnloadState {
|
|
2239
|
+
reason: TelemetryUnloadReason;
|
|
2240
|
+
isAsync: boolean;
|
|
2241
|
+
flushComplete?: boolean;
|
|
2004
2242
|
}
|
|
2005
2243
|
|
|
2006
2244
|
interface ITraceTelemetry extends IPartC {
|
|
@@ -2024,16 +2262,12 @@ declare namespace ApplicationInsights {
|
|
|
2024
2262
|
iKey?: string;
|
|
2025
2263
|
}
|
|
2026
2264
|
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
* Error will NOT be sent as internal telemetry, and will only be shown in browser console
|
|
2034
|
-
*/
|
|
2035
|
-
WARNING = 2
|
|
2036
|
-
}
|
|
2265
|
+
const LoggingSeverity: {
|
|
2266
|
+
CRITICAL: number;
|
|
2267
|
+
WARNING: number;
|
|
2268
|
+
};
|
|
2269
|
+
|
|
2270
|
+
type LoggingSeverity = number | eLoggingSeverity;
|
|
2037
2271
|
|
|
2038
2272
|
class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
|
2039
2273
|
static constructEnvelope(orig: ITelemetryItem, iKey: string, logger: IDiagnosticLogger, convertUndefined?: any): IEnvelope;
|
|
@@ -2150,6 +2384,10 @@ declare namespace ApplicationInsights {
|
|
|
2150
2384
|
* The event(s) being sent as a retry
|
|
2151
2385
|
*/
|
|
2152
2386
|
Retry = 5,
|
|
2387
|
+
/**
|
|
2388
|
+
* The SDK is unloading
|
|
2389
|
+
*/
|
|
2390
|
+
SdkUnload = 6,
|
|
2153
2391
|
/**
|
|
2154
2392
|
* Maximum batch size would be exceeded
|
|
2155
2393
|
*/
|
|
@@ -2177,6 +2415,30 @@ declare namespace ApplicationInsights {
|
|
|
2177
2415
|
|
|
2178
2416
|
type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
|
|
2179
2417
|
|
|
2418
|
+
/**
|
|
2419
|
+
* The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
|
|
2420
|
+
*/
|
|
2421
|
+
const enum TelemetryUnloadReason {
|
|
2422
|
+
/**
|
|
2423
|
+
* Teardown has been called without any context.
|
|
2424
|
+
*/
|
|
2425
|
+
ManualTeardown = 0,
|
|
2426
|
+
/**
|
|
2427
|
+
* Just this plugin is being removed
|
|
2428
|
+
*/
|
|
2429
|
+
PluginUnload = 1,
|
|
2430
|
+
/**
|
|
2431
|
+
* This instance of the plugin is being removed and replaced
|
|
2432
|
+
*/
|
|
2433
|
+
PluginReplace = 2,
|
|
2434
|
+
/**
|
|
2435
|
+
* The entire SDK is being unloaded
|
|
2436
|
+
*/
|
|
2437
|
+
SdkUnload = 50
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
2441
|
+
|
|
2180
2442
|
interface XDomainRequest extends XMLHttpRequestEventTarget {
|
|
2181
2443
|
readonly responseText: string;
|
|
2182
2444
|
send(payload: string): void;
|