@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06
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/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2440 -1199
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +16710 -8876
- package/dist/applicationinsights-core-js.api.md +465 -140
- package/dist/applicationinsights-core-js.d.ts +856 -217
- package/dist/applicationinsights-core-js.js +2440 -1199
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +856 -217
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +4 -72
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +496 -99
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +120 -21
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +202 -87
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +7 -148
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +45 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +13 -12
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +477 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +80 -86
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/NotificationManager.js +37 -42
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +430 -119
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +30 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +60 -14
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +81 -0
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +51 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +10 -9
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +13 -7
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +4 -105
- package/src/JavaScriptSDK/BaseCore.ts +696 -120
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +205 -31
- package/src/JavaScriptSDK/ChannelController.ts +242 -103
- package/src/JavaScriptSDK/CookieMgr.ts +7 -5
- package/src/JavaScriptSDK/CoreUtils.ts +8 -172
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +49 -12
- package/src/JavaScriptSDK/EnvUtils.ts +13 -12
- package/src/JavaScriptSDK/EventHelpers.ts +550 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +114 -97
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -2
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +34 -37
- package/src/JavaScriptSDK/PerfManager.ts +4 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +543 -134
- package/src/JavaScriptSDK/RandomHelper.ts +35 -3
- package/src/JavaScriptSDK/TelemetryHelpers.ts +83 -21
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +111 -0
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +56 -0
- package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +48 -8
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +183 -87
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +82 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +16 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +16 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +94 -14
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +28 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
- package/types/JavaScriptSDK/BaseCore.d.ts +81 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +53 -10
- package/types/JavaScriptSDK/ChannelController.d.ts +16 -17
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -48
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +23 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +37 -32
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +69 -6
- package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +23 -3
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +16 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +34 -0
- package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +14 -9
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +89 -86
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +72 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +16 -5
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +82 -11
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +25 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
- package/types/applicationinsights-core-js.d.ts +20 -10
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
|
@@ -3,17 +3,21 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
import { IAppInsightsCore } from "./IAppInsightsCore";
|
|
6
|
-
import { IDiagnosticLogger } from "./IDiagnosticLogger";
|
|
7
6
|
import { IConfiguration } from "./IConfiguration";
|
|
7
|
+
import { IDiagnosticLogger } from "./IDiagnosticLogger";
|
|
8
8
|
import { ITelemetryItem } from "./ITelemetryItem";
|
|
9
|
-
import { IPlugin } from "./ITelemetryPlugin";
|
|
9
|
+
import { IPlugin, ITelemetryPlugin } from "./ITelemetryPlugin";
|
|
10
10
|
import { ITelemetryPluginChain } from "./ITelemetryPluginChain";
|
|
11
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
12
|
+
import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export const enum GetExtCfgMergeType {
|
|
15
|
+
None = 0,
|
|
16
|
+
MergeDefaultOnly = 1,
|
|
17
|
+
MergeDefaultFromRootOrDefault = 2,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IBaseProcessingContext {
|
|
17
21
|
/**
|
|
18
22
|
* The current core instance for the request
|
|
19
23
|
*/
|
|
@@ -27,12 +31,12 @@ export interface IProcessTelemetryContext {
|
|
|
27
31
|
/**
|
|
28
32
|
* Gets the current core config instance
|
|
29
33
|
*/
|
|
30
|
-
getCfg: ()=> IConfiguration;
|
|
34
|
+
getCfg: () => IConfiguration;
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
37
|
* Gets the named extension config
|
|
34
38
|
*/
|
|
35
|
-
getExtCfg: <T>(identifier: string, defaultValue?:T|any) => T;
|
|
39
|
+
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
@@ -41,7 +45,7 @@ export interface IProcessTelemetryContext {
|
|
|
41
45
|
* @param field The config field name
|
|
42
46
|
* @param defaultValue The default value to return if no defined config exists
|
|
43
47
|
*/
|
|
44
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
|
|
48
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
@@ -57,20 +61,96 @@ export interface IProcessTelemetryContext {
|
|
|
57
61
|
/**
|
|
58
62
|
* Helper to set the next plugin proxy
|
|
59
63
|
*/
|
|
60
|
-
setNext: (nextCtx:ITelemetryPluginChain) => void;
|
|
64
|
+
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
68
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
69
|
+
* @param callback - The function call for each plugin in the context chain
|
|
70
|
+
*/
|
|
71
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
75
|
+
* @param onComplete - The onComplete to call
|
|
76
|
+
* @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
|
|
77
|
+
* @param args - Any additional arguments to pass to the onComplete function
|
|
78
|
+
*/
|
|
79
|
+
onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
|
|
61
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
83
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
84
|
+
* then the current execution order will be copied.
|
|
85
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
86
|
+
* order then the next plugin will be NOT set.
|
|
87
|
+
*/
|
|
88
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
|
|
93
|
+
* between multiple AppInsights instances
|
|
94
|
+
*/
|
|
95
|
+
export interface IProcessTelemetryContext extends IBaseProcessingContext {
|
|
62
96
|
/**
|
|
63
97
|
* Call back for telemetry processing before it it is sent
|
|
64
98
|
* @param env - This is the current event being reported
|
|
99
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
100
|
+
*/
|
|
101
|
+
processNext: (env: ITelemetryItem) => boolean | void;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
105
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
106
|
+
* then the current execution order will be copied.
|
|
107
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
108
|
+
* order then the next plugin will be NOT set.
|
|
109
|
+
*/
|
|
110
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The current context for the current call to teardown() implementations, used to support when plugins are being removed
|
|
115
|
+
* or the SDK is being unloaded.
|
|
116
|
+
*/
|
|
117
|
+
export interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* This Plugin has finished unloading, so unload the next one
|
|
121
|
+
* @param uploadState - The state of the unload process
|
|
122
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
123
|
+
*/
|
|
124
|
+
processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
128
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
129
|
+
* then the current execution order will be copied.
|
|
130
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
131
|
+
* order then the next plugin will be NOT set.
|
|
132
|
+
*/
|
|
133
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The current context for the current call to the plugin update() implementations, used to support the notifications
|
|
138
|
+
* for when plugins are added, removed or the configuration was changed.
|
|
139
|
+
*/
|
|
140
|
+
export interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
|
|
141
|
+
/**
|
|
142
|
+
* This Plugin has finished unloading, so unload the next one
|
|
143
|
+
* @param updateState - The update State
|
|
144
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
65
145
|
*/
|
|
66
|
-
processNext: (
|
|
146
|
+
processNext: (updateState: ITelemetryUpdateState) => boolean | void;
|
|
67
147
|
|
|
68
148
|
/**
|
|
69
|
-
* Create a new context using the core and config from the current instance
|
|
149
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
70
150
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
71
151
|
* then the current execution order will be copied.
|
|
72
152
|
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
73
153
|
* order then the next plugin will be NOT set.
|
|
74
154
|
*/
|
|
75
|
-
|
|
155
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
|
|
76
156
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ITelemetryItem } from "./ITelemetryItem";
|
|
2
|
+
|
|
3
|
+
export declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
|
|
4
|
+
|
|
5
|
+
export interface ITelemetryInitializerHandler {
|
|
6
|
+
remove(): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ITelemetryInitializerContainer {
|
|
10
|
+
/**
|
|
11
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
12
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
13
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
14
|
+
*/
|
|
15
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
16
|
+
}
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import { ITelemetryItem } from "./ITelemetryItem";
|
|
6
6
|
import { IConfiguration } from "./IConfiguration";
|
|
7
7
|
import { IAppInsightsCore } from "./IAppInsightsCore";
|
|
8
|
-
import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
|
|
8
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "./IProcessTelemetryContext";
|
|
9
9
|
import { ITelemetryPluginChain } from "./ITelemetryPluginChain";
|
|
10
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
11
|
+
import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
* Configuration provided to SDK core
|
|
13
|
-
*/
|
|
14
|
-
export interface ITelemetryPlugin extends IPlugin {
|
|
13
|
+
export interface ITelemetryProcessor {
|
|
15
14
|
/**
|
|
16
15
|
* Call back for telemetry processing before it it is sent
|
|
17
16
|
* @param env - This is the current event being reported
|
|
@@ -20,7 +19,22 @@ export interface ITelemetryPlugin extends IPlugin {
|
|
|
20
19
|
* to later plugins (vs appending items to the telemetry item)
|
|
21
20
|
*/
|
|
22
21
|
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings or
|
|
25
|
+
* plugins. If implemented this method will be called whenever a plugin is added or removed and if
|
|
26
|
+
* the configuration has bee updated.
|
|
27
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
28
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
29
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
30
|
+
*/
|
|
31
|
+
update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Configuration provided to SDK core
|
|
36
|
+
*/
|
|
37
|
+
export interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
|
|
24
38
|
/**
|
|
25
39
|
* Set next extension for telemetry processing, this is not optional as plugins should use the
|
|
26
40
|
* processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
|
|
@@ -43,7 +57,7 @@ export interface IPlugin {
|
|
|
43
57
|
* @param pluginChain - [Optional] specifies the current plugin chain which identifies the
|
|
44
58
|
* set of plugins and the order they should be executed for the current request.
|
|
45
59
|
*/
|
|
46
|
-
initialize: (config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) => void;
|
|
60
|
+
initialize: (config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => void;
|
|
47
61
|
|
|
48
62
|
/**
|
|
49
63
|
* Returns a value that indicates whether the plugin has already been previously initialized.
|
|
@@ -52,10 +66,14 @@ export interface IPlugin {
|
|
|
52
66
|
isInitialized?: () => boolean;
|
|
53
67
|
|
|
54
68
|
/**
|
|
55
|
-
* Tear down the plugin and remove any hooked value, the plugin should
|
|
56
|
-
* therefore
|
|
69
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
70
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
71
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
72
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
73
|
+
* @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.
|
|
74
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
57
75
|
*/
|
|
58
|
-
teardown?: () => void;
|
|
76
|
+
teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
59
77
|
|
|
60
78
|
/**
|
|
61
79
|
* Extension name
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
"use strict";
|
|
4
3
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { IProcessTelemetryUnloadContext } from "./IProcessTelemetryContext";
|
|
5
|
+
import { ITelemetryPlugin, ITelemetryProcessor } from "./ITelemetryPlugin";
|
|
6
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Configuration provided to SDK core
|
|
11
10
|
*/
|
|
12
|
-
export interface ITelemetryPluginChain {
|
|
11
|
+
export interface ITelemetryPluginChain extends ITelemetryProcessor {
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Returns the underlying plugin that is being proxied for the processTelemetry call
|
|
@@ -22,11 +21,10 @@ export interface ITelemetryPluginChain {
|
|
|
22
21
|
getNext: () => ITelemetryPluginChain;
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @param
|
|
28
|
-
*
|
|
29
|
-
* to later plugins (vs appending items to the telemetry item)
|
|
24
|
+
* This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
|
|
25
|
+
* call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
|
|
26
|
+
* @param unloadCtx - The unload context to use for this call.
|
|
27
|
+
* @param unloadState - The details of the unload operation
|
|
30
28
|
*/
|
|
31
|
-
|
|
29
|
+
unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
32
30
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { TelemetryUnloadReason } from "../JavaScriptSDK.Enums/TelemetryUnloadReason";
|
|
5
|
+
|
|
6
|
+
export interface ITelemetryUnloadState {
|
|
7
|
+
reason: TelemetryUnloadReason;
|
|
8
|
+
isAsync: boolean;
|
|
9
|
+
flushComplete?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { TelemetryUpdateReason } from "../JavaScriptSDK.Enums/TelemetryUpdateReason";
|
|
5
|
+
//import { IConfiguration } from "./IConfiguration";
|
|
6
|
+
import { IPlugin } from "./ITelemetryPlugin";
|
|
7
|
+
|
|
8
|
+
export interface ITelemetryUpdateState {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Identifies the reason for the update notification, this is a bitwise numeric value
|
|
12
|
+
*/
|
|
13
|
+
reason: TelemetryUpdateReason;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* If this is a configuration update this was the previous configuration that was used
|
|
17
|
+
*/
|
|
18
|
+
//prvCfg?: IConfiguration,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* If this is a configuration update is the new configuration that is being used
|
|
22
|
+
*/
|
|
23
|
+
//newCfg?: IConfiguration,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
|
|
27
|
+
*/
|
|
28
|
+
added?: IPlugin[];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
|
|
32
|
+
*/
|
|
33
|
+
removed?: IPlugin[]
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IProcessTelemetryUnloadContext } from "./IProcessTelemetryContext";
|
|
2
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
3
|
+
|
|
4
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
// Licensed under the MIT License.
|
|
6
|
+
|
|
7
|
+
export interface IUnloadableComponent {
|
|
8
|
+
/**
|
|
9
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
10
|
+
* finishes it's removal.
|
|
11
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
12
|
+
* @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.
|
|
13
|
+
* @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.
|
|
14
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
15
|
+
*/
|
|
16
|
+
_doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
17
|
+
}
|
|
@@ -3,31 +3,10 @@ import { BaseCore } from "./BaseCore";
|
|
|
3
3
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
4
4
|
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
5
5
|
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
6
|
-
import { INotificationListener } from "../JavaScriptSDK.Interfaces/INotificationListener";
|
|
7
6
|
import { INotificationManager } from "../JavaScriptSDK.Interfaces/INotificationManager";
|
|
8
7
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
9
8
|
export declare class AppInsightsCore extends BaseCore implements IAppInsightsCore {
|
|
10
9
|
constructor();
|
|
11
10
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
12
11
|
track(telemetryItem: ITelemetryItem): void;
|
|
13
|
-
/**
|
|
14
|
-
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
15
|
-
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
16
|
-
* called.
|
|
17
|
-
* @param {INotificationListener} listener - An INotificationListener object.
|
|
18
|
-
*/
|
|
19
|
-
addNotificationListener(listener: INotificationListener): void;
|
|
20
|
-
/**
|
|
21
|
-
* Removes all instances of the listener.
|
|
22
|
-
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
23
|
-
*/
|
|
24
|
-
removeNotificationListener(listener: INotificationListener): void;
|
|
25
|
-
/**
|
|
26
|
-
* Periodically check logger.queue for
|
|
27
|
-
*/
|
|
28
|
-
pollInternalLogs(eventName?: string): number;
|
|
29
|
-
/**
|
|
30
|
-
* Periodically check logger.queue for
|
|
31
|
-
*/
|
|
32
|
-
stopPollingInternalLogs(): void;
|
|
33
12
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
1
|
+
import { IAppInsightsCore, ILoadedPlugin } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
2
2
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
3
|
-
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
3
|
+
import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
4
4
|
import { IChannelControls } from "../JavaScriptSDK.Interfaces/IChannelControls";
|
|
5
5
|
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
6
6
|
import { INotificationManager } from "../JavaScriptSDK.Interfaces/INotificationManager";
|
|
7
|
+
import { INotificationListener } from "../JavaScriptSDK.Interfaces/INotificationListener";
|
|
7
8
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
8
|
-
import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
9
|
+
import { IProcessTelemetryContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
9
10
|
import { IPerfManager } from "../JavaScriptSDK.Interfaces/IPerfManager";
|
|
10
11
|
import { ICookieMgr } from "../JavaScriptSDK.Interfaces/ICookieMgr";
|
|
12
|
+
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "../JavaScriptSDK.Interfaces/ITelemetryInitializers";
|
|
13
|
+
import { UnloadHandler } from "./UnloadHandlerContainer";
|
|
14
|
+
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
15
|
+
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
16
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
11
17
|
export declare class BaseCore implements IAppInsightsCore {
|
|
12
18
|
static defaultConfig: IConfiguration;
|
|
13
19
|
config: IConfiguration;
|
|
@@ -20,6 +26,18 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
20
26
|
track(telemetryItem: ITelemetryItem): void;
|
|
21
27
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
22
28
|
getNotifyMgr(): INotificationManager;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
31
|
+
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
32
|
+
* called.
|
|
33
|
+
* @param {INotificationListener} listener - An INotificationListener object.
|
|
34
|
+
*/
|
|
35
|
+
addNotificationListener(listener: INotificationListener): void;
|
|
36
|
+
/**
|
|
37
|
+
* Removes all instances of the listener.
|
|
38
|
+
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
39
|
+
*/
|
|
40
|
+
removeNotificationListener(listener: INotificationListener): void;
|
|
23
41
|
/**
|
|
24
42
|
* Get the current cookie manager for this instance
|
|
25
43
|
*/
|
|
@@ -32,5 +50,65 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
32
50
|
getPerfMgr(): IPerfManager;
|
|
33
51
|
setPerfMgr(perfMgr: IPerfManager): void;
|
|
34
52
|
eventCnt(): number;
|
|
53
|
+
/**
|
|
54
|
+
* Periodically check logger.queue for
|
|
55
|
+
*/
|
|
56
|
+
pollInternalLogs(eventName?: string): number;
|
|
57
|
+
/**
|
|
58
|
+
* Periodically check logger.queue for
|
|
59
|
+
*/
|
|
60
|
+
stopPollingInternalLogs(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
63
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
64
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
65
|
+
*/
|
|
66
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
67
|
+
/**
|
|
68
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
69
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
70
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
71
|
+
* approach is to create a new instance and initialize that instance.
|
|
72
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
73
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
74
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
75
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
76
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
77
|
+
*/
|
|
78
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
79
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
80
|
+
/**
|
|
81
|
+
* Add a new plugin to the installation
|
|
82
|
+
* @param plugin - The new plugin to add
|
|
83
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
84
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
85
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
86
|
+
*/
|
|
87
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
88
|
+
/**
|
|
89
|
+
* Returns the unique event namespace that should be used
|
|
90
|
+
*/
|
|
91
|
+
evtNamespace(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
94
|
+
* @param handler - the handler
|
|
95
|
+
*/
|
|
96
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
97
|
+
/**
|
|
98
|
+
* Flush and send any batched / cached data immediately
|
|
99
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
100
|
+
* @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.
|
|
101
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
102
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
103
|
+
* @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
|
|
104
|
+
*/
|
|
105
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
|
|
35
106
|
protected releaseQueue(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
|
|
109
|
+
* @param updateCtx - The plugin update context
|
|
110
|
+
* @param updateState - The Update State
|
|
111
|
+
* @returns boolean - True means the extension class will call updateState otherwise the Core will
|
|
112
|
+
*/
|
|
113
|
+
protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
36
114
|
}
|
|
@@ -3,14 +3,25 @@ import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
|
3
3
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
4
4
|
import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
5
5
|
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
6
|
-
import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
6
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
7
7
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
8
|
+
import { UnloadHandler } from "./UnloadHandlerContainer";
|
|
9
|
+
import { IInstrumentHook } from "../JavaScriptSDK.Interfaces/IInstrumentHooks";
|
|
10
|
+
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
11
|
+
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
8
12
|
/**
|
|
9
13
|
* BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
|
|
10
14
|
* can avoid implementation the same set of boiler plate code as well as provide a base
|
|
11
15
|
* implementation so that new default implementations can be added without breaking all plugins.
|
|
12
16
|
*/
|
|
13
17
|
export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
18
|
+
identifier: string;
|
|
19
|
+
version?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Holds the core instance that was used during initialization
|
|
22
|
+
*/
|
|
23
|
+
core: IAppInsightsCore;
|
|
24
|
+
priority: number;
|
|
14
25
|
/**
|
|
15
26
|
* Call back for telemetry processing before it it is sent
|
|
16
27
|
* @param env - This is the current event being reported
|
|
@@ -32,13 +43,6 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
32
43
|
* Returns whether the plugin has been initialized
|
|
33
44
|
*/
|
|
34
45
|
isInitialized: () => boolean;
|
|
35
|
-
identifier: string;
|
|
36
|
-
version?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Holds the core instance that was used during initialization
|
|
39
|
-
*/
|
|
40
|
-
core: IAppInsightsCore;
|
|
41
|
-
priority: number;
|
|
42
46
|
/**
|
|
43
47
|
* Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
|
|
44
48
|
* returns that value (helps with minification for callers), otherwise it will return the configured
|
|
@@ -51,10 +55,49 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
51
55
|
*/
|
|
52
56
|
protected setInitialized: (isInitialized: boolean) => void;
|
|
53
57
|
/**
|
|
54
|
-
*
|
|
58
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
59
|
+
* finishes it's removal.
|
|
60
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
61
|
+
* @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.
|
|
62
|
+
* @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.
|
|
63
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
64
|
+
*/
|
|
65
|
+
protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
|
|
68
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
69
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
70
|
+
* @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.
|
|
71
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
55
72
|
*/
|
|
56
|
-
|
|
73
|
+
protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
|
|
57
74
|
constructor();
|
|
58
75
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
76
|
+
/**
|
|
77
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
78
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
79
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
80
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
81
|
+
* @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.
|
|
82
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
83
|
+
*/
|
|
84
|
+
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
59
85
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
86
|
+
/**
|
|
87
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings.
|
|
88
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
89
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
90
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
91
|
+
*/
|
|
92
|
+
update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
95
|
+
* @param handler - the handler
|
|
96
|
+
*/
|
|
97
|
+
protected _addUnloadCb(handler: UnloadHandler): void;
|
|
98
|
+
/**
|
|
99
|
+
* Add this hook so that it is automatically removed during unloading
|
|
100
|
+
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
101
|
+
*/
|
|
102
|
+
protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
|
|
60
103
|
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
1
2
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
2
|
-
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
3
3
|
import { IChannelControls } from "../JavaScriptSDK.Interfaces/IChannelControls";
|
|
4
|
-
import {
|
|
4
|
+
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
5
|
+
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
5
6
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Static constructor, attempt to create accessors
|
|
19
|
-
*/
|
|
20
|
-
private static _staticInit;
|
|
7
|
+
export declare const ChannelControllerPriority = 500;
|
|
8
|
+
export interface IChannelController extends IChannelControls {
|
|
9
|
+
flush(isAsync: boolean, callBack: (flushComplete?: boolean) => void, sendReason: SendRequestReason, cbTimeout?: number): void;
|
|
10
|
+
getChannel<T extends IPlugin = IPlugin>(pluginIdentifier: string): T;
|
|
11
|
+
}
|
|
12
|
+
export interface IInternalChannelController extends IChannelController {
|
|
13
|
+
_setQueue: (channels: _IInternalChannels[]) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface _IInternalChannels {
|
|
16
|
+
queue: IChannelControls[];
|
|
17
|
+
chain: ITelemetryPluginChain;
|
|
21
18
|
}
|
|
19
|
+
export declare function createChannelControllerPlugin(channelQueue: _IInternalChannels[], core: IAppInsightsCore): IChannelController;
|
|
20
|
+
export declare function createChannelQueues(channels: IChannelControls[][], extensions: IPlugin[], config: IConfiguration, core: IAppInsightsCore): _IInternalChannels[];
|