@microsoft/applicationinsights-core-js 2.8.0-beta.2203-04 → 2.8.0-beta.2203-07
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 +147 -33
- 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 +1832 -94
- package/dist/applicationinsights-core-js.api.md +70 -12
- package/dist/applicationinsights-core-js.d.ts +167 -11
- package/dist/applicationinsights-core-js.js +147 -33
- 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 +170 -14
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +41 -17
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +31 -3
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +15 -2
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +3 -2
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +14 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +18 -13
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +2 -12
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +56 -5
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +3 -2
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +3 -2
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- 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 -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 +1 -1
- 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 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +3 -3
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +82 -17
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +55 -3
- package/src/JavaScriptSDK/ChannelController.ts +20 -1
- package/src/JavaScriptSDK/CookieMgr.ts +3 -1
- package/src/JavaScriptSDK/DiagnosticLogger.ts +14 -0
- package/src/JavaScriptSDK/EventHelpers.ts +18 -12
- package/src/JavaScriptSDK/HelperFuncs.ts +3 -1
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +71 -8
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +3 -1
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +3 -1
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +22 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +11 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +25 -2
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +12 -1
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/types/JavaScriptSDK/BaseCore.d.ts +32 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +17 -1
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +10 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +4 -2
- package/types/JavaScriptSDK/HelperFuncs.d.ts +2 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +9 -1
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +20 -4
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +5 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +23 -2
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +11 -1
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/applicationinsights-core-js.d.ts +6 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
|
|
6
|
+
*/
|
|
7
|
+
export const enum TelemetryUpdateReason {
|
|
8
|
+
/**
|
|
9
|
+
* Unknown.
|
|
10
|
+
*/
|
|
11
|
+
Unknown = 0,
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The configuration has ben updated or changed
|
|
15
|
+
*/
|
|
16
|
+
//ConfigurationChanged = 0x01,
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* One or more plugins have been added
|
|
20
|
+
*/
|
|
21
|
+
PluginAdded = 0x10,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* One or more plugins have been removed
|
|
25
|
+
*/
|
|
26
|
+
PluginRemoved = 0x20,
|
|
27
|
+
}
|
|
@@ -11,7 +11,9 @@ import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
|
|
|
11
11
|
import { IPerfManagerProvider } from "./IPerfManager";
|
|
12
12
|
import { ICookieMgr } from "./ICookieMgr";
|
|
13
13
|
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "./ITelemetryInitializers";
|
|
14
|
-
import {
|
|
14
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
15
|
+
import { UnloadHandler } from "../JavaScriptSDK/UnloadHandlerContainer";
|
|
16
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
15
17
|
|
|
16
18
|
export interface ILoadedPlugin<T extends IPlugin> {
|
|
17
19
|
plugin: T;
|
|
@@ -116,8 +118,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
116
118
|
* approach is to create a new instance and initialize that instance.
|
|
117
119
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
118
120
|
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
121
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
122
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
123
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
119
124
|
*/
|
|
120
|
-
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
125
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
121
126
|
|
|
122
127
|
/**
|
|
123
128
|
* Find and return the (first) plugin with the specified identifier if present
|
|
@@ -128,10 +133,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
128
133
|
/**
|
|
129
134
|
* Add a new plugin to the installation
|
|
130
135
|
* @param plugin - The new plugin to add
|
|
131
|
-
* @param replaceExisting - should any existing plugin be replaced
|
|
136
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
132
137
|
* @param doAsync - Should the add be performed asynchronously
|
|
138
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
133
139
|
*/
|
|
134
|
-
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting
|
|
140
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
135
141
|
|
|
136
142
|
/**
|
|
137
143
|
* Returns the unique event namespace that should be used when registering events
|
|
@@ -143,4 +149,15 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
143
149
|
* @param handler - the handler
|
|
144
150
|
*/
|
|
145
151
|
addUnloadCb(handler: UnloadHandler): void;
|
|
146
|
-
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Flush and send any batched / cached data immediately
|
|
155
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
156
|
+
* @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.
|
|
157
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
158
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
159
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
160
|
+
* @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
|
|
161
|
+
*/
|
|
162
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
|
|
163
|
+
}
|
|
@@ -12,6 +12,11 @@ export type InstrumentorHooksCallback = (funcArgs:IInstrumentCallDetails, ...org
|
|
|
12
12
|
* You must always supply the error callback
|
|
13
13
|
*/
|
|
14
14
|
export interface IInstrumentHooksCallbacks {
|
|
15
|
+
/**
|
|
16
|
+
* [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
|
|
17
|
+
* identify the source of the instrumented hooks
|
|
18
|
+
*/
|
|
19
|
+
ns?: string | string[];
|
|
15
20
|
|
|
16
21
|
/**
|
|
17
22
|
* The hook callback to call before the original function is called
|
|
@@ -40,20 +45,20 @@ export interface IInstrumentHooksCallbacks {
|
|
|
40
45
|
*/
|
|
41
46
|
export interface IInstrumentHook {
|
|
42
47
|
/** Unique Id for this callback on the hooked method */
|
|
43
|
-
id:number;
|
|
48
|
+
id: number;
|
|
44
49
|
|
|
45
50
|
/** Holds the callbacks */
|
|
46
|
-
cbks:IInstrumentHooksCallbacks;
|
|
51
|
+
cbks: IInstrumentHooksCallbacks;
|
|
47
52
|
|
|
48
53
|
/** Remove this hook from the function */
|
|
49
54
|
rm: () => void;
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
export interface IInstrumentHooks {
|
|
53
|
-
i:number; // Used to create unique ids
|
|
54
|
-
n:string; // Function name
|
|
55
|
-
f:any; // Original Function
|
|
56
|
-
h:IInstrumentHook[]; // The hook
|
|
58
|
+
i: number; // Used to create unique ids
|
|
59
|
+
n: string; // Function name
|
|
60
|
+
f: any; // Original Function
|
|
61
|
+
h: IInstrumentHook[]; // The hook
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
export interface IInstrumentCallDetails {
|
|
@@ -9,6 +9,7 @@ import { ITelemetryItem } from "./ITelemetryItem";
|
|
|
9
9
|
import { IPlugin, ITelemetryPlugin } from "./ITelemetryPlugin";
|
|
10
10
|
import { ITelemetryPluginChain } from "./ITelemetryPluginChain";
|
|
11
11
|
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
12
|
+
import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
|
|
12
13
|
|
|
13
14
|
export const enum GetExtCfgMergeType {
|
|
14
15
|
None = 0,
|
|
@@ -110,8 +111,8 @@ export interface IProcessTelemetryContext extends IBaseProcessingContext {
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
|
-
* The current context for the current call to
|
|
114
|
-
*
|
|
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.
|
|
115
116
|
*/
|
|
116
117
|
export interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
117
118
|
|
|
@@ -131,3 +132,25 @@ export interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
|
131
132
|
*/
|
|
132
133
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
133
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)
|
|
145
|
+
*/
|
|
146
|
+
processNext: (updateState: ITelemetryUpdateState) => boolean | void;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
150
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
151
|
+
* then the current execution order will be copied.
|
|
152
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
153
|
+
* order then the next plugin will be NOT set.
|
|
154
|
+
*/
|
|
155
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
|
|
156
|
+
}
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import { ITelemetryItem } from "./ITelemetryItem";
|
|
6
6
|
import { IConfiguration } from "./IConfiguration";
|
|
7
7
|
import { IAppInsightsCore } from "./IAppInsightsCore";
|
|
8
|
-
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext } from "./IProcessTelemetryContext";
|
|
8
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "./IProcessTelemetryContext";
|
|
9
9
|
import { ITelemetryPluginChain } from "./ITelemetryPluginChain";
|
|
10
10
|
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
11
|
+
import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
|
|
11
12
|
|
|
12
13
|
export interface ITelemetryProcessor {
|
|
13
14
|
/**
|
|
@@ -18,6 +19,16 @@ export interface ITelemetryProcessor {
|
|
|
18
19
|
* to later plugins (vs appending items to the telemetry item)
|
|
19
20
|
*/
|
|
20
21
|
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
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;
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
/**
|
|
@@ -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
|
+
}
|
|
@@ -6,11 +6,14 @@ import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
|
6
6
|
import { INotificationManager } from "../JavaScriptSDK.Interfaces/INotificationManager";
|
|
7
7
|
import { INotificationListener } from "../JavaScriptSDK.Interfaces/INotificationListener";
|
|
8
8
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
9
|
-
import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
9
|
+
import { IProcessTelemetryContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
10
10
|
import { IPerfManager } from "../JavaScriptSDK.Interfaces/IPerfManager";
|
|
11
11
|
import { ICookieMgr } from "../JavaScriptSDK.Interfaces/ICookieMgr";
|
|
12
12
|
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "../JavaScriptSDK.Interfaces/ITelemetryInitializers";
|
|
13
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";
|
|
14
17
|
export declare class BaseCore implements IAppInsightsCore {
|
|
15
18
|
static defaultConfig: IConfiguration;
|
|
16
19
|
config: IConfiguration;
|
|
@@ -68,10 +71,20 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
68
71
|
* approach is to create a new instance and initialize that instance.
|
|
69
72
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
70
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.
|
|
71
77
|
*/
|
|
72
|
-
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
78
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
73
79
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
74
|
-
|
|
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;
|
|
75
88
|
/**
|
|
76
89
|
* Returns the unique event namespace that should be used
|
|
77
90
|
*/
|
|
@@ -81,5 +94,21 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
81
94
|
* @param handler - the handler
|
|
82
95
|
*/
|
|
83
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;
|
|
84
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;
|
|
85
114
|
}
|
|
@@ -3,11 +3,12 @@ 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, IProcessTelemetryUnloadContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
6
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
7
7
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
8
8
|
import { UnloadHandler } from "./UnloadHandlerContainer";
|
|
9
9
|
import { IInstrumentHook } from "../JavaScriptSDK.Interfaces/IInstrumentHooks";
|
|
10
10
|
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
11
|
+
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
11
12
|
/**
|
|
12
13
|
* BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
|
|
13
14
|
* can avoid implementation the same set of boiler plate code as well as provide a base
|
|
@@ -62,6 +63,14 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
62
63
|
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
63
64
|
*/
|
|
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.
|
|
72
|
+
*/
|
|
73
|
+
protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
|
|
65
74
|
constructor();
|
|
66
75
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
67
76
|
/**
|
|
@@ -74,6 +83,13 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
74
83
|
*/
|
|
75
84
|
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
76
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;
|
|
77
93
|
/**
|
|
78
94
|
* Add an unload handler that will be called when the SDK is being unloaded
|
|
79
95
|
* @param handler - the handler
|
|
@@ -63,3 +63,13 @@ export declare class DiagnosticLogger implements IDiagnosticLogger {
|
|
|
63
63
|
*/
|
|
64
64
|
logInternalMessage(severity: LoggingSeverity, message: _InternalLogMessage): void;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
|
|
68
|
+
* debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
|
|
69
|
+
* support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
|
|
70
|
+
* the code.
|
|
71
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
72
|
+
* @param severity {LoggingSeverity} - The severity of the log message
|
|
73
|
+
* @param message {_InternalLogMessage} - The log message.
|
|
74
|
+
*/
|
|
75
|
+
export declare function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
|
|
@@ -6,9 +6,11 @@ export interface _IRegisteredEvents {
|
|
|
6
6
|
* Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
|
|
7
7
|
* applications to remove their own events
|
|
8
8
|
* @param target - The EventTarget that has registered events
|
|
9
|
-
* @param
|
|
9
|
+
* @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
|
|
10
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
11
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
10
12
|
*/
|
|
11
|
-
export declare function __getRegisteredEvents(target: any,
|
|
13
|
+
export declare function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
|
|
12
14
|
export declare function mergeEvtNamespace(theNamespace: string, namespaces: string | string[]): string | string[];
|
|
13
15
|
/**
|
|
14
16
|
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
@@ -259,4 +259,5 @@ export declare function optimizeObject<T>(theObject: T): T;
|
|
|
259
259
|
* @param obj5 - object to merge.
|
|
260
260
|
* @returns The extended first object.
|
|
261
261
|
*/
|
|
262
|
-
export declare function objExtend<
|
|
262
|
+
export declare function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
|
|
263
|
+
export declare function objExtend<T1, T2, T3, T4, T5, T6>(obj1?: T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
|
|
@@ -2,7 +2,7 @@ import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
|
2
2
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
3
3
|
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
4
4
|
import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
5
|
-
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
5
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
6
6
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
7
7
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
8
8
|
/**
|
|
@@ -21,6 +21,14 @@ export declare function createProcessTelemetryContext(telemetryChain: ITelemetry
|
|
|
21
21
|
* @param startAt - Identifies the next plugin to execute, if null there is no "next" plugin and if undefined it should assume the start of the chain
|
|
22
22
|
*/
|
|
23
23
|
export declare function createProcessTelemetryUnloadContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryUnloadContext;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new Telemetry Item context with the current config, core and plugin execution chain for updating the configuration
|
|
26
|
+
* @param plugins - The plugin instances that will be executed
|
|
27
|
+
* @param config - The current config
|
|
28
|
+
* @param core - The current core instance
|
|
29
|
+
* @param startAt - Identifies the next plugin to execute, if null there is no "next" plugin and if undefined it should assume the start of the chain
|
|
30
|
+
*/
|
|
31
|
+
export declare function createProcessTelemetryUpdateContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryUpdateContext;
|
|
24
32
|
/**
|
|
25
33
|
* Creates an execution chain from the array of plugins
|
|
26
34
|
* @param plugins - The array of plugins that will be executed in this order
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
|
|
3
|
+
*/
|
|
4
|
+
export declare const enum TelemetryUpdateReason {
|
|
5
|
+
/**
|
|
6
|
+
* Unknown.
|
|
7
|
+
*/
|
|
8
|
+
Unknown = 0,
|
|
9
|
+
/**
|
|
10
|
+
* The configuration has ben updated or changed
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* One or more plugins have been added
|
|
14
|
+
*/
|
|
15
|
+
PluginAdded = 16,
|
|
16
|
+
/**
|
|
17
|
+
* One or more plugins have been removed
|
|
18
|
+
*/
|
|
19
|
+
PluginRemoved = 32
|
|
20
|
+
}
|
|
@@ -9,7 +9,9 @@ import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
|
|
|
9
9
|
import { IPerfManagerProvider } from "./IPerfManager";
|
|
10
10
|
import { ICookieMgr } from "./ICookieMgr";
|
|
11
11
|
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "./ITelemetryInitializers";
|
|
12
|
-
import {
|
|
12
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
13
|
+
import { UnloadHandler } from "../JavaScriptSDK/UnloadHandlerContainer";
|
|
14
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
13
15
|
export interface ILoadedPlugin<T extends IPlugin> {
|
|
14
16
|
plugin: T;
|
|
15
17
|
/**
|
|
@@ -81,8 +83,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
81
83
|
* approach is to create a new instance and initialize that instance.
|
|
82
84
|
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
83
85
|
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
86
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
87
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
88
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
84
89
|
*/
|
|
85
|
-
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
90
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
86
91
|
/**
|
|
87
92
|
* Find and return the (first) plugin with the specified identifier if present
|
|
88
93
|
* @param pluginIdentifier
|
|
@@ -91,10 +96,11 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
91
96
|
/**
|
|
92
97
|
* Add a new plugin to the installation
|
|
93
98
|
* @param plugin - The new plugin to add
|
|
94
|
-
* @param replaceExisting - should any existing plugin be replaced
|
|
99
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
95
100
|
* @param doAsync - Should the add be performed asynchronously
|
|
101
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
96
102
|
*/
|
|
97
|
-
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting
|
|
103
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
98
104
|
/**
|
|
99
105
|
* Returns the unique event namespace that should be used when registering events
|
|
100
106
|
*/
|
|
@@ -104,4 +110,14 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
104
110
|
* @param handler - the handler
|
|
105
111
|
*/
|
|
106
112
|
addUnloadCb(handler: UnloadHandler): void;
|
|
113
|
+
/**
|
|
114
|
+
* Flush and send any batched / cached data immediately
|
|
115
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
116
|
+
* @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.
|
|
117
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
118
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
119
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
120
|
+
* @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
|
|
121
|
+
*/
|
|
122
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
|
|
107
123
|
}
|
|
@@ -8,6 +8,11 @@ export declare type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetail
|
|
|
8
8
|
* You must always supply the error callback
|
|
9
9
|
*/
|
|
10
10
|
export interface IInstrumentHooksCallbacks {
|
|
11
|
+
/**
|
|
12
|
+
* [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
|
|
13
|
+
* identify the source of the instrumented hooks
|
|
14
|
+
*/
|
|
15
|
+
ns?: string | string[];
|
|
11
16
|
/**
|
|
12
17
|
* The hook callback to call before the original function is called
|
|
13
18
|
*/
|
|
@@ -5,6 +5,7 @@ import { ITelemetryItem } from "./ITelemetryItem";
|
|
|
5
5
|
import { IPlugin, ITelemetryPlugin } from "./ITelemetryPlugin";
|
|
6
6
|
import { ITelemetryPluginChain } from "./ITelemetryPluginChain";
|
|
7
7
|
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
8
|
+
import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
|
|
8
9
|
export declare const enum GetExtCfgMergeType {
|
|
9
10
|
None = 0,
|
|
10
11
|
MergeDefaultOnly = 1,
|
|
@@ -91,8 +92,8 @@ export interface IProcessTelemetryContext extends IBaseProcessingContext {
|
|
|
91
92
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
92
93
|
}
|
|
93
94
|
/**
|
|
94
|
-
* The current context for the current call to
|
|
95
|
-
*
|
|
95
|
+
* The current context for the current call to teardown() implementations, used to support when plugins are being removed
|
|
96
|
+
* or the SDK is being unloaded.
|
|
96
97
|
*/
|
|
97
98
|
export interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
98
99
|
/**
|
|
@@ -110,3 +111,23 @@ export interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
|
|
|
110
111
|
*/
|
|
111
112
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
|
|
112
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* The current context for the current call to the plugin update() implementations, used to support the notifications
|
|
116
|
+
* for when plugins are added, removed or the configuration was changed.
|
|
117
|
+
*/
|
|
118
|
+
export interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
|
|
119
|
+
/**
|
|
120
|
+
* This Plugin has finished unloading, so unload the next one
|
|
121
|
+
* @param updateState - The update State
|
|
122
|
+
* @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
|
|
123
|
+
*/
|
|
124
|
+
processNext: (updateState: ITelemetryUpdateState) => boolean | void;
|
|
125
|
+
/**
|
|
126
|
+
* Create a new context using the core and config from the current instance, returns a new instance of the same type
|
|
127
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
128
|
+
* then the current execution order will be copied.
|
|
129
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
130
|
+
* order then the next plugin will be NOT set.
|
|
131
|
+
*/
|
|
132
|
+
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
|
|
133
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ITelemetryItem } from "./ITelemetryItem";
|
|
2
2
|
import { IConfiguration } from "./IConfiguration";
|
|
3
3
|
import { IAppInsightsCore } from "./IAppInsightsCore";
|
|
4
|
-
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext } from "./IProcessTelemetryContext";
|
|
4
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "./IProcessTelemetryContext";
|
|
5
5
|
import { ITelemetryPluginChain } from "./ITelemetryPluginChain";
|
|
6
6
|
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
7
|
+
import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
|
|
7
8
|
export interface ITelemetryProcessor {
|
|
8
9
|
/**
|
|
9
10
|
* Call back for telemetry processing before it it is sent
|
|
@@ -13,6 +14,15 @@ export interface ITelemetryProcessor {
|
|
|
13
14
|
* to later plugins (vs appending items to the telemetry item)
|
|
14
15
|
*/
|
|
15
16
|
processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings or
|
|
19
|
+
* plugins. If implemented this method will be called whenever a plugin is added or removed and if
|
|
20
|
+
* the configuration has bee updated.
|
|
21
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
22
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
23
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
24
|
+
*/
|
|
25
|
+
update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
|
|
16
26
|
}
|
|
17
27
|
/**
|
|
18
28
|
* Configuration provided to SDK core
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TelemetryUpdateReason } from "../JavaScriptSDK.Enums/TelemetryUpdateReason";
|
|
2
|
+
import { IPlugin } from "./ITelemetryPlugin";
|
|
3
|
+
export interface ITelemetryUpdateState {
|
|
4
|
+
/**
|
|
5
|
+
* Identifies the reason for the update notification, this is a bitwise numeric value
|
|
6
|
+
*/
|
|
7
|
+
reason: TelemetryUpdateReason;
|
|
8
|
+
/**
|
|
9
|
+
* If this is a configuration update this was the previous configuration that was used
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* If this is a configuration update is the new configuration that is being used
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
|
|
16
|
+
*/
|
|
17
|
+
added?: IPlugin[];
|
|
18
|
+
/**
|
|
19
|
+
* This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
|
|
20
|
+
*/
|
|
21
|
+
removed?: IPlugin[];
|
|
22
|
+
}
|
|
@@ -3,20 +3,22 @@ export { IChannelControls, MinChannelPriorty } from "./JavaScriptSDK.Interfaces/
|
|
|
3
3
|
export { ITelemetryPlugin, IPlugin } from "./JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
4
4
|
export { IAppInsightsCore } from "./JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
5
5
|
export { ITelemetryItem, ICustomProperties, Tags } from "./JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
6
|
-
export { IProcessTelemetryContext, GetExtCfgMergeType } from "./JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
6
|
+
export { IBaseProcessingContext, IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext, GetExtCfgMergeType } from "./JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
7
7
|
export { INotificationListener } from "./JavaScriptSDK.Interfaces/INotificationListener";
|
|
8
8
|
export { ITelemetryPluginChain } from "./JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
9
9
|
export { IDiagnosticLogger } from "./JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
10
10
|
export { InstrumentorHooksCallback, IInstrumentHooksCallbacks, IInstrumentHooks, IInstrumentHook, IInstrumentCallDetails } from "./JavaScriptSDK.Interfaces/IInstrumentHooks";
|
|
11
11
|
export { EventsDiscardedReason } from "./JavaScriptSDK.Enums/EventsDiscardedReason";
|
|
12
12
|
export { SendRequestReason } from "./JavaScriptSDK.Enums/SendRequestReason";
|
|
13
|
+
export { TelemetryUpdateReason } from "./JavaScriptSDK.Enums/TelemetryUpdateReason";
|
|
14
|
+
export { TelemetryUnloadReason } from "./JavaScriptSDK.Enums/TelemetryUnloadReason";
|
|
13
15
|
export { AppInsightsCore } from "./JavaScriptSDK/AppInsightsCore";
|
|
14
16
|
export { BaseCore } from "./JavaScriptSDK/BaseCore";
|
|
15
17
|
export { BaseTelemetryPlugin } from "./JavaScriptSDK/BaseTelemetryPlugin";
|
|
16
18
|
export { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from "./JavaScriptSDK/RandomHelper";
|
|
17
19
|
export { CoreUtils, ICoreUtils, EventHelper, IEventHelper, Undefined, newGuid, perfNow, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr } from "./JavaScriptSDK/CoreUtils";
|
|
18
20
|
export { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal, createEnumStyle, objExtend } from "./JavaScriptSDK/HelperFuncs";
|
|
19
|
-
export { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, eventOn, eventOff, mergeEvtNamespace, _IRegisteredEvents, __getRegisteredEvents } from "./JavaScriptSDK/EventHelpers";
|
|
21
|
+
export { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, _IRegisteredEvents, __getRegisteredEvents } from "./JavaScriptSDK/EventHelpers";
|
|
20
22
|
export { getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported } from "./JavaScriptSDK/EnvUtils";
|
|
21
23
|
export { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from "@microsoft/applicationinsights-shims";
|
|
22
24
|
export { NotificationManager } from "./JavaScriptSDK/NotificationManager";
|
|
@@ -24,7 +26,7 @@ export { INotificationManager } from "./JavaScriptSDK.Interfaces/INotificationMa
|
|
|
24
26
|
export { IPerfEvent } from "./JavaScriptSDK.Interfaces/IPerfEvent";
|
|
25
27
|
export { IPerfManager, IPerfManagerProvider } from "./JavaScriptSDK.Interfaces/IPerfManager";
|
|
26
28
|
export { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from "./JavaScriptSDK/PerfManager";
|
|
27
|
-
export { safeGetLogger, DiagnosticLogger, _InternalLogMessage } from "./JavaScriptSDK/DiagnosticLogger";
|
|
29
|
+
export { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal } from "./JavaScriptSDK/DiagnosticLogger";
|
|
28
30
|
export { ProcessTelemetryContext, createProcessTelemetryContext } from "./JavaScriptSDK/ProcessTelemetryContext";
|
|
29
31
|
export { initializePlugins, sortPlugins } from "./JavaScriptSDK/TelemetryHelpers";
|
|
30
32
|
export { _InternalMessageId, _eInternalMessageId, LoggingSeverity, eLoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
|
|
@@ -37,4 +39,5 @@ export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils
|
|
|
37
39
|
export { TelemetryInitializerFunction, ITelemetryInitializerHandler, ITelemetryInitializerContainer } from "./JavaScriptSDK.Interfaces/ITelemetryInitializers";
|
|
38
40
|
export { createUniqueNamespace } from "./JavaScriptSDK/DataCacheHelper";
|
|
39
41
|
export { UnloadHandler, IUnloadHandlerContainer, createUnloadHandlerContainer } from "./JavaScriptSDK/UnloadHandlerContainer";
|
|
42
|
+
export { ITelemetryUpdateState } from "./JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
40
43
|
export { ITelemetryUnloadState } from "./JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|