@microsoft/applicationinsights-core-js 3.0.0-beta.2211-03 → 3.0.0-beta.2212-03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +1156 -1345
- 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 +85 -85
- package/dist/applicationinsights-core-js.api.md +8 -8
- package/dist/applicationinsights-core-js.d.ts +7 -7
- package/dist/applicationinsights-core-js.js +1156 -1345
- 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 +7 -7
- package/dist-esm/Config/ConfigDefaults.js +1 -1
- package/dist-esm/Config/DynamicConfig.js +1 -1
- package/dist-esm/Config/DynamicProperty.js +1 -1
- package/dist-esm/Config/DynamicState.js +1 -1
- package/dist-esm/Config/DynamicSupport.js +1 -1
- package/dist-esm/Config/IConfigDefaults.js +1 -1
- package/dist-esm/Config/IDynamicConfigHandler.js +1 -1
- package/dist-esm/Config/IDynamicPropertyHandler.js +1 -1
- package/dist-esm/Config/IDynamicWatcher.js +1 -1
- package/dist-esm/Config/_IDynamicConfigHandlerState.js +1 -1
- package/dist-esm/JavaScriptSDK/AggregationError.js +1 -1
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +93 -63
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +8 -0
- package/dist-esm/JavaScriptSDK/Constants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +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 +5 -5
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +5 -8
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +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 +1 -1
- 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/IDistributedTraceContext.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 +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-esm/__DynamicConstants.js +15 -17
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +98 -66
- package/src/JavaScriptSDK/Constants.ts +4 -0
- package/src/JavaScriptSDK/TelemetryHelpers.ts +5 -6
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +2 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +4 -4
- package/types/Config/IConfigDefaults.d.ts +3 -3
- package/types/Config/IDynamicWatcher.d.ts +1 -1
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +1 -1
- package/types/JavaScriptSDK/Constants.d.ts +1 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +1 -1
- package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +1 -1
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +2 -2
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +1 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +4 -4
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +1 -1
- package/types/__DynamicConstants.d.ts +2 -4
- package/dist-esm/JavaScriptSDK/ChannelController.js +0 -217
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +0 -1
- package/src/JavaScriptSDK/ChannelController.ts +0 -274
- package/types/JavaScriptSDK/ChannelController.d.ts +0 -19
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
6
6
|
import {
|
|
7
7
|
ITimerHandler, arrAppend, arrForEach, arrIndexOf, deepExtend, dumpObj, hasDocument, isFunction, isNullOrUndefined, isPlainObject,
|
|
8
|
-
objDeepFreeze, objDefineProp, objForEachKey, objFreeze, objHasOwn, scheduleInterval, throwError
|
|
8
|
+
objDeepFreeze, objDefineProp, objForEachKey, objFreeze, objHasOwn, scheduleInterval, scheduleTimeout, throwError
|
|
9
9
|
} from "@nevware21/ts-utils";
|
|
10
10
|
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
11
11
|
import { IConfigDefaults } from "../Config/IConfigDefaults";
|
|
@@ -33,10 +33,7 @@ import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPlu
|
|
|
33
33
|
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
34
34
|
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
35
35
|
import { ILegacyUnloadHook, IUnloadHook } from "../JavaScriptSDK.Interfaces/IUnloadHook";
|
|
36
|
-
import {
|
|
37
|
-
ChannelControllerPriority, IChannelController, IInternalChannelController, _IInternalChannels, createChannelControllerPlugin,
|
|
38
|
-
createChannelQueues
|
|
39
|
-
} from "./ChannelController";
|
|
36
|
+
import { ChannelControllerPriority } from "./Constants";
|
|
40
37
|
import { createCookieMgr } from "./CookieMgr";
|
|
41
38
|
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
42
39
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
@@ -84,9 +81,10 @@ function _createPerfManager (core: IAppInsightsCore, notificationMgr: INotificat
|
|
|
84
81
|
return new PerfManager(notificationMgr);
|
|
85
82
|
}
|
|
86
83
|
|
|
87
|
-
function _validateExtensions(logger: IDiagnosticLogger, channelPriority: number, allExtensions: IPlugin[]): {
|
|
84
|
+
function _validateExtensions(logger: IDiagnosticLogger, channelPriority: number, allExtensions: IPlugin[]): { core: IPlugin[], channels: IChannelControls[] } {
|
|
88
85
|
// Concat all available extensions
|
|
89
86
|
let coreExtensions: ITelemetryPlugin[] = [];
|
|
87
|
+
let channels: IChannelControls[] = [];
|
|
90
88
|
|
|
91
89
|
// Check if any two extensions have the same priority, then warn to console
|
|
92
90
|
// And extract the local extensions from the
|
|
@@ -111,16 +109,18 @@ function _validateExtensions(logger: IDiagnosticLogger, channelPriority: number,
|
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
|
|
114
|
-
// Split extensions to core and
|
|
112
|
+
// Split extensions to core and channels
|
|
115
113
|
if (!extPriority || extPriority < channelPriority) {
|
|
116
114
|
// Add to core extension that will be managed by AppInsightsCore
|
|
117
115
|
coreExtensions.push(ext);
|
|
116
|
+
} else {
|
|
117
|
+
channels.push(ext);
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
|
|
121
121
|
return {
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
core: coreExtensions,
|
|
123
|
+
channels: channels
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -239,10 +239,8 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
239
239
|
let _cookieManager: ICookieMgr | null;
|
|
240
240
|
let _pluginChain: ITelemetryPluginChain | null;
|
|
241
241
|
let _configExtensions: IPlugin[];
|
|
242
|
-
let _coreExtensions: ITelemetryPlugin[] | null;
|
|
243
|
-
let _channelControl: IChannelController | null;
|
|
244
242
|
let _channelConfig: IChannelControls[][] | null | undefined;
|
|
245
|
-
let
|
|
243
|
+
let _channels: IChannelControls[] | null;
|
|
246
244
|
let _isUnloading: boolean;
|
|
247
245
|
let _telemetryInitializerPlugin: TelemetryInitializerPlugin;
|
|
248
246
|
let _internalLogsEventName: string | null;
|
|
@@ -317,10 +315,17 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
317
315
|
|
|
318
316
|
_initPluginChain(null);
|
|
319
317
|
|
|
320
|
-
if (!
|
|
318
|
+
if (!_channels || _channels.length === 0) {
|
|
321
319
|
throwError("No " + STR_CHANNELS + " available");
|
|
322
320
|
}
|
|
323
321
|
|
|
322
|
+
if (_channels.length > 1) {
|
|
323
|
+
let teeController = _self.getPlugin("TeeChannelController");
|
|
324
|
+
if (!teeController || !teeController.plugin) {
|
|
325
|
+
_throwInternal(_self.logger, eLoggingSeverity.CRITICAL, _eInternalMessageId.SenderNotInitialized, "TeeChannel required");
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
324
329
|
_registerDelayedCfgListener(config, _cfgListeners, _self.logger);
|
|
325
330
|
_cfgListeners = null;
|
|
326
331
|
|
|
@@ -330,11 +335,11 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
330
335
|
_self.pollInternalLogs();
|
|
331
336
|
};
|
|
332
337
|
|
|
333
|
-
_self.
|
|
334
|
-
let controls: IChannelControls[]
|
|
335
|
-
if (
|
|
336
|
-
arrForEach(
|
|
337
|
-
controls.push(
|
|
338
|
+
_self.getChannels = (): IChannelControls[] => {
|
|
339
|
+
let controls: IChannelControls[] = [];
|
|
340
|
+
if (_channels) {
|
|
341
|
+
arrForEach(_channels, (channel) => {
|
|
342
|
+
controls.push(channel);
|
|
338
343
|
});
|
|
339
344
|
}
|
|
340
345
|
|
|
@@ -786,11 +791,9 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
786
791
|
_cfgPerfManager = null;
|
|
787
792
|
_cookieManager = null;
|
|
788
793
|
_pluginChain = null;
|
|
789
|
-
_coreExtensions = null;
|
|
790
794
|
_configExtensions = [];
|
|
791
|
-
_channelControl = null;
|
|
792
795
|
_channelConfig = null;
|
|
793
|
-
|
|
796
|
+
_channels = null;
|
|
794
797
|
_isUnloading = false;
|
|
795
798
|
_internalLogsEventName = null;
|
|
796
799
|
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
@@ -812,50 +815,31 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
812
815
|
// Extension validation
|
|
813
816
|
let theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
814
817
|
|
|
815
|
-
_coreExtensions = theExtensions.core;
|
|
816
818
|
_pluginChain = null;
|
|
817
819
|
_pluginVersionString = null;
|
|
818
820
|
_pluginVersionStringArr = null;
|
|
819
821
|
|
|
820
|
-
//
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
//
|
|
824
|
-
|
|
825
|
-
if (_channelControl) {
|
|
826
|
-
// During add / remove of a plugin this may get called again, so don't re-add if already present
|
|
827
|
-
// But we also want the controller as the last, so remove if already present
|
|
828
|
-
// And reusing the existing instance, just in case an installed plugin has a reference and
|
|
829
|
-
// is using it.
|
|
830
|
-
let idx = arrIndexOf(allExtensions, _channelControl);
|
|
831
|
-
if (idx !== -1) {
|
|
832
|
-
allExtensions.splice(idx, 1);
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
idx = arrIndexOf(_coreExtensions, _channelControl);
|
|
836
|
-
if (idx !== -1) {
|
|
837
|
-
_coreExtensions.splice(idx, 1);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
(_channelControl as IInternalChannelController)._setQueue(_channelQueue);
|
|
841
|
-
} else {
|
|
842
|
-
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
843
|
-
}
|
|
822
|
+
// Get the primary channel queue and include as part of the normal extensions
|
|
823
|
+
_channels = (_channelConfig || [])[0] ||[];
|
|
824
|
+
|
|
825
|
+
// Add any channels provided in the extensions and sort them
|
|
826
|
+
_channels = sortPlugins(arrAppend(_channels, theExtensions.channels));
|
|
844
827
|
|
|
845
|
-
//
|
|
846
|
-
allExtensions.
|
|
847
|
-
_coreExtensions.push(_channelControl);
|
|
828
|
+
// Create an array of all extensions, including the _channels
|
|
829
|
+
let allExtensions = arrAppend(sortPlugins(theExtensions.core), _channels);
|
|
848
830
|
|
|
849
831
|
// Required to allow plugins to call core.getPlugin() during their own initialization
|
|
850
|
-
_extensions =
|
|
832
|
+
_extensions = objFreeze(allExtensions);
|
|
851
833
|
|
|
852
|
-
|
|
853
|
-
_channelControl.initialize(_configHandler.cfg, _self, allExtensions);
|
|
834
|
+
let rootCtx = _createTelCtx();
|
|
854
835
|
|
|
855
|
-
|
|
836
|
+
// Initializing the channels first
|
|
837
|
+
if (_channels && _channels.length > 0) {
|
|
838
|
+
initializePlugins(rootCtx.createNew(_channels), allExtensions);
|
|
839
|
+
}
|
|
856
840
|
|
|
857
|
-
// Now
|
|
858
|
-
|
|
841
|
+
// Now initialize the normal extensions (explicitly not including the _channels as this can cause duplicate initialization)
|
|
842
|
+
initializePlugins(rootCtx, allExtensions);
|
|
859
843
|
|
|
860
844
|
if (updateState) {
|
|
861
845
|
_doUpdate(updateState);
|
|
@@ -867,16 +851,19 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
867
851
|
let thePlugin: IPlugin = null;
|
|
868
852
|
|
|
869
853
|
arrForEach(_extensions, (ext: any) => {
|
|
870
|
-
if (ext.identifier === pluginIdentifier && ext !==
|
|
854
|
+
if (ext.identifier === pluginIdentifier && ext !== _telemetryInitializerPlugin) {
|
|
871
855
|
thePlugin = ext;
|
|
872
856
|
return -1;
|
|
873
857
|
}
|
|
858
|
+
|
|
859
|
+
// TODO: Check if the extension is an extension "host" (like the TeeChannel)
|
|
860
|
+
// So that if the extension is not found we can ask the "host" plugins for the plugin
|
|
874
861
|
});
|
|
875
862
|
|
|
876
|
-
if (!thePlugin && _channelControl) {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
}
|
|
863
|
+
// if (!thePlugin && _channelControl) {
|
|
864
|
+
// // Check the channel Controller
|
|
865
|
+
// thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
866
|
+
// }
|
|
880
867
|
|
|
881
868
|
if (thePlugin) {
|
|
882
869
|
theExt = {
|
|
@@ -916,9 +903,9 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
916
903
|
function _getPluginChain() {
|
|
917
904
|
if (!_pluginChain) {
|
|
918
905
|
// copy the collection of extensions
|
|
919
|
-
let extensions = (
|
|
906
|
+
let extensions = (_extensions || []).slice();
|
|
920
907
|
|
|
921
|
-
// During add / remove this may get called again, so don't
|
|
908
|
+
// During add / remove this may get called again, so don't read if already present
|
|
922
909
|
if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) {
|
|
923
910
|
extensions.push(_telemetryInitializerPlugin);
|
|
924
911
|
}
|
|
@@ -999,11 +986,56 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
999
986
|
}
|
|
1000
987
|
|
|
1001
988
|
function _flushChannels(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number) {
|
|
1002
|
-
|
|
1003
|
-
|
|
989
|
+
// Setting waiting to one so that we don't call the callBack until we finish iterating
|
|
990
|
+
let waiting = 1;
|
|
991
|
+
let doneIterating = false;
|
|
992
|
+
let cbTimer: ITimerHandler = null;
|
|
993
|
+
cbTimeout = cbTimeout || 5000;
|
|
994
|
+
|
|
995
|
+
function doCallback() {
|
|
996
|
+
waiting--;
|
|
997
|
+
if (doneIterating && waiting === 0) {
|
|
998
|
+
cbTimer && cbTimer.cancel();
|
|
999
|
+
cbTimer = null;
|
|
1000
|
+
|
|
1001
|
+
callBack && callBack(doneIterating);
|
|
1002
|
+
callBack = null;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
if (_channels && _channels.length > 0) {
|
|
1007
|
+
let flushCtx = _createTelCtx().createNew(_channels);
|
|
1008
|
+
flushCtx.iterate<IChannelControls>((plugin) => {
|
|
1009
|
+
if (plugin.flush) {
|
|
1010
|
+
waiting ++;
|
|
1011
|
+
|
|
1012
|
+
let handled = false;
|
|
1013
|
+
// Not all channels will call this callback for every scenario
|
|
1014
|
+
if (!plugin.flush(isAsync, () => {
|
|
1015
|
+
handled = true;
|
|
1016
|
+
doCallback();
|
|
1017
|
+
}, sendReason)) {
|
|
1018
|
+
if (!handled) {
|
|
1019
|
+
// If any channel doesn't return true and it didn't call the callback, then we should assume that the callback
|
|
1020
|
+
// will never be called, so use a timeout to allow the channel(s) some time to "finish" before triggering any
|
|
1021
|
+
// followup function (such as unloading)
|
|
1022
|
+
if (isAsync && cbTimer == null) {
|
|
1023
|
+
cbTimer = scheduleTimeout(() => {
|
|
1024
|
+
cbTimer = null;
|
|
1025
|
+
doCallback();
|
|
1026
|
+
}, cbTimeout);
|
|
1027
|
+
} else {
|
|
1028
|
+
doCallback();
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1004
1034
|
}
|
|
1005
1035
|
|
|
1006
|
-
|
|
1036
|
+
doneIterating = true;
|
|
1037
|
+
doCallback();
|
|
1038
|
+
|
|
1007
1039
|
return true;
|
|
1008
1040
|
}
|
|
1009
1041
|
|
|
@@ -1082,7 +1114,7 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
1082
1114
|
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
1083
1115
|
}
|
|
1084
1116
|
|
|
1085
|
-
public
|
|
1117
|
+
public getChannels(): IChannelControls[] {
|
|
1086
1118
|
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
1087
1119
|
return null;
|
|
1088
1120
|
}
|
|
@@ -51,12 +51,11 @@ export function initializePlugins(processContext: IProcessTelemetryContext, exte
|
|
|
51
51
|
lastPlugin.setNextPlugin(thePlugin);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
pluginState = _getPluginState(thePlugin);
|
|
55
|
+
|
|
56
|
+
let isInitialized = !!pluginState.isInitialized;
|
|
57
|
+
if (thePlugin.isInitialized) {
|
|
56
58
|
isInitialized = thePlugin.isInitialized();
|
|
57
|
-
} else {
|
|
58
|
-
pluginState = _getPluginState(thePlugin);
|
|
59
|
-
isInitialized = pluginState.isInitialized;
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
if (!isInitialized) {
|
|
@@ -80,7 +79,7 @@ export function initializePlugins(processContext: IProcessTelemetryContext, exte
|
|
|
80
79
|
|
|
81
80
|
pluginState = _getPluginState(thePlugin);
|
|
82
81
|
|
|
83
|
-
// Only add the core to the state if the plugin didn't set it (doesn't
|
|
82
|
+
// Only add the core to the state if the plugin didn't set it (doesn't extend from BaseTelemetryPlugin)
|
|
84
83
|
if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {
|
|
85
84
|
pluginState[STR_CORE] = core;
|
|
86
85
|
}
|
|
@@ -70,9 +70,9 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
70
70
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
71
71
|
|
|
72
72
|
/*
|
|
73
|
-
* Get transmission
|
|
73
|
+
* Get transmission channels for controlling transmission behavior
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
getChannels(): IChannelControls[];
|
|
76
76
|
|
|
77
77
|
/*
|
|
78
78
|
* Core track API
|
|
@@ -15,12 +15,12 @@ export interface IChannelControls extends ITelemetryPlugin {
|
|
|
15
15
|
/**
|
|
16
16
|
* Pause sending data
|
|
17
17
|
*/
|
|
18
|
-
pause(): void;
|
|
18
|
+
pause?(): void;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Resume sending data
|
|
22
22
|
*/
|
|
23
|
-
resume(): void;
|
|
23
|
+
resume?(): void;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
@@ -30,7 +30,7 @@ export interface IChannelControls extends ITelemetryPlugin {
|
|
|
30
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
31
|
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
32
32
|
*/
|
|
33
|
-
teardown
|
|
33
|
+
teardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
@@ -40,7 +40,7 @@ export interface IChannelControls extends ITelemetryPlugin {
|
|
|
40
40
|
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
41
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
|
|
42
42
|
*/
|
|
43
|
-
flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
43
|
+
flush?(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export const MinChannelPriorty: number = 100;
|
|
@@ -2,11 +2,11 @@ import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
|
2
2
|
/**
|
|
3
3
|
* The type to identify whether the default value should be applied in preference to the provided value.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type IConfigCheckFn<V> = (value: V) => boolean;
|
|
6
6
|
/**
|
|
7
7
|
* The type which identifies the function use to validate the user supplied value
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type IConfigSetFn<T, V> = (value: any, defValue: V, theConfig: T) => V;
|
|
10
10
|
/**
|
|
11
11
|
* The default values with a check function
|
|
12
12
|
*/
|
|
@@ -37,6 +37,6 @@ export interface IConfigDefaultCheck<T, V, C extends IConfiguration = IConfigura
|
|
|
37
37
|
* The Type definition to define default values to be applied to the config
|
|
38
38
|
* The value may be either the direct value or a ConfigDefaultCheck definition
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export type IConfigDefaults<T, C extends IConfiguration = IConfiguration> = {
|
|
41
41
|
[key in keyof T]: T[key] | IConfigDefaultCheck<T, T[key], C>;
|
|
42
42
|
};
|
|
@@ -21,7 +21,7 @@ export interface IWatchDetails<T extends IConfiguration> {
|
|
|
21
21
|
*/
|
|
22
22
|
setDf: <C>(theConfig: C, defaultValues: IConfigDefaults<C>) => C;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type WatcherFunction<T extends IConfiguration> = (details: IWatchDetails<T>) => void;
|
|
25
25
|
/**
|
|
26
26
|
* @internal
|
|
27
27
|
*/
|
|
@@ -40,7 +40,7 @@ export declare class AppInsightsCore implements IAppInsightsCore {
|
|
|
40
40
|
getWParam: () => number;
|
|
41
41
|
constructor();
|
|
42
42
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
43
|
-
|
|
43
|
+
getChannels(): IChannelControls[];
|
|
44
44
|
track(telemetryItem: ITelemetryItem): void;
|
|
45
45
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
46
46
|
getNotifyMgr(): INotificationManager;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChannelControllerPriority = 500;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IProcessTelemetryUnloadContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
2
2
|
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
3
|
-
export
|
|
3
|
+
export type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
4
4
|
export interface IUnloadHandlerContainer {
|
|
5
5
|
add: (handler: UnloadHandler) => void;
|
|
6
6
|
run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
@@ -31,4 +31,4 @@ export declare const enum eEventsDiscardedReason {
|
|
|
31
31
|
* The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
|
|
32
32
|
*/
|
|
33
33
|
export declare const EventsDiscardedReason: import("../JavaScriptSDK.Enums/EnumHelperFuncs").EnumValue<typeof eEventsDiscardedReason>;
|
|
34
|
-
export
|
|
34
|
+
export type EventsDiscardedReason = number | eEventsDiscardedReason;
|
|
@@ -13,7 +13,7 @@ export declare const enum eLoggingSeverity {
|
|
|
13
13
|
WARNING = 2
|
|
14
14
|
}
|
|
15
15
|
export declare const LoggingSeverity: import("../JavaScriptSDK.Enums/EnumHelperFuncs").EnumValue<typeof eLoggingSeverity>;
|
|
16
|
-
export
|
|
16
|
+
export type LoggingSeverity = number | eLoggingSeverity;
|
|
17
17
|
export declare const enum _eInternalMessageId {
|
|
18
18
|
BrowserDoesNotSupportLocalStorage = 0,
|
|
19
19
|
BrowserCannotReadLocalStorage = 1,
|
|
@@ -101,4 +101,4 @@ export declare const enum _eInternalMessageId {
|
|
|
101
101
|
ConfigWatcherException = 107,
|
|
102
102
|
DynamicConfigException = 108
|
|
103
103
|
}
|
|
104
|
-
export
|
|
104
|
+
export type _InternalMessageId = number | _eInternalMessageId;
|
|
@@ -49,7 +49,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
49
49
|
*/
|
|
50
50
|
isInitialized?: () => boolean;
|
|
51
51
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
52
|
-
|
|
52
|
+
getChannels(): IChannelControls[];
|
|
53
53
|
track(telemetryItem: ITelemetryItem): void;
|
|
54
54
|
/**
|
|
55
55
|
* Get the current notification manager
|
|
@@ -9,11 +9,11 @@ export interface IChannelControls extends ITelemetryPlugin {
|
|
|
9
9
|
/**
|
|
10
10
|
* Pause sending data
|
|
11
11
|
*/
|
|
12
|
-
pause(): void;
|
|
12
|
+
pause?(): void;
|
|
13
13
|
/**
|
|
14
14
|
* Resume sending data
|
|
15
15
|
*/
|
|
16
|
-
resume(): void;
|
|
16
|
+
resume?(): void;
|
|
17
17
|
/**
|
|
18
18
|
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
19
19
|
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
@@ -22,7 +22,7 @@ export interface IChannelControls extends ITelemetryPlugin {
|
|
|
22
22
|
* @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.
|
|
23
23
|
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
24
24
|
*/
|
|
25
|
-
teardown
|
|
25
|
+
teardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
28
28
|
* @param async - send data asynchronously when true
|
|
@@ -31,6 +31,6 @@ export interface IChannelControls extends ITelemetryPlugin {
|
|
|
31
31
|
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
32
32
|
* @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
|
|
33
33
|
*/
|
|
34
|
-
flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
34
|
+
flush?(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
35
35
|
}
|
|
36
36
|
export declare const MinChannelPriorty: number;
|
|
@@ -3,7 +3,7 @@ import { IUnloadHook } from "./IUnloadHook";
|
|
|
3
3
|
* A callback function that will be called for the wrapped instrumentation function
|
|
4
4
|
* before the original function is executed.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetails, ...orgArgs: any[]) => void;
|
|
7
7
|
/**
|
|
8
8
|
* The callbacks to call for the instrumented function, you must provide at least the request and/or response callbacks, both are not required.
|
|
9
9
|
* You must always supply the error callback
|
|
@@ -13,6 +13,7 @@ export declare const _DYN_CANCEL = "cancel";
|
|
|
13
13
|
export declare const _DYN_INITIALIZE = "initialize";
|
|
14
14
|
export declare const _DYN_IDENTIFIER = "identifier";
|
|
15
15
|
export declare const _DYN_IS_INITIALIZED = "isInitialized";
|
|
16
|
+
export declare const _DYN_GET_PLUGIN = "getPlugin";
|
|
16
17
|
export declare const _DYN_POLL_INTERNAL_LOGS = "pollInternalLogs";
|
|
17
18
|
export declare const _DYN_NAME = "name";
|
|
18
19
|
export declare const _DYN_TIME = "time";
|
|
@@ -24,10 +25,9 @@ export declare const _DYN_REMOVE_NOTIFICATION_2 = "removeNotificationListener";
|
|
|
24
25
|
export declare const _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs";
|
|
25
26
|
export declare const _DYN_ON_COMPLETE = "onComplete";
|
|
26
27
|
export declare const _DYN_CALL = "call";
|
|
27
|
-
export declare const _DYN_GET_PLUGIN = "getPlugin";
|
|
28
|
-
export declare const _DYN_FLUSH = "flush";
|
|
29
28
|
export declare const _DYN_VERSION = "version";
|
|
30
29
|
export declare const _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
|
|
30
|
+
export declare const _DYN_CREATE_NEW = "createNew";
|
|
31
31
|
export declare const _DYN_TEARDOWN = "teardown";
|
|
32
32
|
export declare const _DYN_MESSAGE_ID = "messageId";
|
|
33
33
|
export declare const _DYN_MESSAGE = "message";
|
|
@@ -37,8 +37,6 @@ export declare const _DYN__DO_TEARDOWN = "_doTeardown";
|
|
|
37
37
|
export declare const _DYN_UPDATE = "update";
|
|
38
38
|
export declare const _DYN_GET_NEXT = "getNext";
|
|
39
39
|
export declare const _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
|
|
40
|
-
export declare const _DYN_CREATE_NEW = "createNew";
|
|
41
|
-
export declare const _DYN_CONFIG = "config";
|
|
42
40
|
export declare const _DYN_USER_AGENT = "userAgent";
|
|
43
41
|
export declare const _DYN_SPLIT = "split";
|
|
44
42
|
export declare const _DYN_NODE_TYPE = "nodeType";
|