@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-04
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 +1999 -793
- 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 +16363 -9167
- package/dist/applicationinsights-core-js.api.md +425 -48
- package/dist/applicationinsights-core-js.d.ts +784 -123
- package/dist/applicationinsights-core-js.js +1999 -793
- 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 +784 -123
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +3 -69
- 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 +25 -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 +89 -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/EventsDiscardedReason.js +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 +12 -7
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +2 -101
- 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 +27 -12
- package/src/JavaScriptSDK/EnvUtils.ts +13 -12
- package/src/JavaScriptSDK/EventHelpers.ts +550 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +123 -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/LoggingEnums.ts +184 -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 +10 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +33 -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/LoggingEnums.d.ts +91 -2
- 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 +18 -9
- 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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
|
|
6
|
+
*/
|
|
7
|
+
export const enum TelemetryUnloadReason {
|
|
8
|
+
/**
|
|
9
|
+
* Teardown has been called without any context.
|
|
10
|
+
*/
|
|
11
|
+
ManualTeardown = 0,
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Just this plugin is being removed
|
|
15
|
+
*/
|
|
16
|
+
PluginUnload = 1,
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This instance of the plugin is being removed and replaced
|
|
20
|
+
*/
|
|
21
|
+
PluginReplace = 2,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The entire SDK is being unloaded
|
|
25
|
+
*/
|
|
26
|
+
SdkUnload = 50
|
|
27
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { ITelemetryItem } from "./ITelemetryItem";
|
|
4
4
|
import { IChannelControls } from "./IChannelControls";
|
|
5
|
-
import { IPlugin } from "./ITelemetryPlugin";
|
|
5
|
+
import { IPlugin, ITelemetryPlugin } from "./ITelemetryPlugin";
|
|
6
6
|
import { IConfiguration } from "./IConfiguration";
|
|
7
7
|
import { INotificationManager } from "./INotificationManager";
|
|
8
8
|
import { INotificationListener } from "./INotificationListener";
|
|
@@ -10,8 +10,31 @@ import { IDiagnosticLogger } from "./IDiagnosticLogger";
|
|
|
10
10
|
import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
|
|
11
11
|
import { IPerfManagerProvider } from "./IPerfManager";
|
|
12
12
|
import { ICookieMgr } from "./ICookieMgr";
|
|
13
|
+
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "./ITelemetryInitializers";
|
|
14
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
15
|
+
import { UnloadHandler } from "../JavaScriptSDK/UnloadHandlerContainer";
|
|
16
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
export interface ILoadedPlugin<T extends IPlugin> {
|
|
19
|
+
plugin: T;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
|
|
23
|
+
* via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
|
|
24
|
+
* @returns boolean = true if the plugin is in a state where it is operational.
|
|
25
|
+
*/
|
|
26
|
+
isEnabled: () => boolean;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* You can optionally enable / disable a plugin from processing events.
|
|
30
|
+
* Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
|
|
31
|
+
* as the plugin must also have been successfully initialized and not had it's `teardown` method called
|
|
32
|
+
* (unless it's also been re-initialized)
|
|
33
|
+
*/
|
|
34
|
+
setEnabled: (isEnabled: boolean) => void;
|
|
35
|
+
|
|
36
|
+
remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
|
|
37
|
+
}
|
|
15
38
|
|
|
16
39
|
export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
17
40
|
|
|
@@ -72,6 +95,13 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
72
95
|
*/
|
|
73
96
|
removeNotificationListener?(listener: INotificationListener): void;
|
|
74
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
100
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
101
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
102
|
+
*/
|
|
103
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
104
|
+
|
|
75
105
|
pollInternalLogs?(eventName?: string): number;
|
|
76
106
|
|
|
77
107
|
stopPollingInternalLogs?(): void;
|
|
@@ -80,4 +110,54 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
80
110
|
* Return a new instance of the IProcessTelemetryContext for processing events
|
|
81
111
|
*/
|
|
82
112
|
getProcessTelContext() : IProcessTelemetryContext;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
116
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
117
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
118
|
+
* approach is to create a new instance and initialize that instance.
|
|
119
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
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.
|
|
124
|
+
*/
|
|
125
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Find and return the (first) plugin with the specified identifier if present
|
|
129
|
+
* @param pluginIdentifier
|
|
130
|
+
*/
|
|
131
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Add a new plugin to the installation
|
|
135
|
+
* @param plugin - The new plugin to add
|
|
136
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
137
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
138
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
139
|
+
*/
|
|
140
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Returns the unique event namespace that should be used when registering events
|
|
144
|
+
*/
|
|
145
|
+
evtNamespace(): string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Add a handler that will be called when the SDK is being unloaded
|
|
149
|
+
* @param handler - the handler
|
|
150
|
+
*/
|
|
151
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
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;
|
|
83
163
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
4
|
+
import { IProcessTelemetryUnloadContext } from "./IProcessTelemetryContext";
|
|
3
5
|
import { ITelemetryPlugin } from "./ITelemetryPlugin";
|
|
6
|
+
import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
|
|
4
7
|
|
|
5
8
|
"use strict";
|
|
6
9
|
|
|
@@ -20,16 +23,24 @@ export interface IChannelControls extends ITelemetryPlugin {
|
|
|
20
23
|
resume(): void;
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
|
-
* Tear down
|
|
26
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
27
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
28
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
29
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
30
|
+
* @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.
|
|
31
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
24
32
|
*/
|
|
25
|
-
teardown()
|
|
33
|
+
teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
26
34
|
|
|
27
35
|
/**
|
|
28
36
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
29
|
-
* @param async
|
|
30
|
-
* @param callBack
|
|
37
|
+
* @param async - send data asynchronously when true
|
|
38
|
+
* @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.
|
|
39
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
40
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
41
|
+
* @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
|
|
31
42
|
*/
|
|
32
|
-
flush(async: boolean, callBack?: () => void): void;
|
|
43
|
+
flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
export const MinChannelPriorty: number = 100;
|
|
@@ -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 {
|
|
@@ -85,4 +90,9 @@ export interface IInstrumentCallDetails {
|
|
|
85
90
|
* The error (exception) which occurred while executing the original method
|
|
86
91
|
*/
|
|
87
92
|
err?: Error;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The Event object from (window.event) at the start of the original call
|
|
96
|
+
*/
|
|
97
|
+
evt?: Event;
|
|
88
98
|
}
|
|
@@ -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
|
}
|