@microsoft/applicationinsights-core-js 2.8.5-nightly.2206-04 → 2.8.5-nightly.2207-02
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 +807 -711
- 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 +400 -336
- package/dist/applicationinsights-core-js.d.ts +1 -1
- package/dist/applicationinsights-core-js.js +807 -711
- 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 +1 -1
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +14 -10
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +158 -139
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +39 -36
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +60 -61
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +46 -43
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +16 -15
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +7 -5
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +4 -3
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +56 -56
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +21 -20
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +45 -39
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +49 -40
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +18 -16
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +19 -21
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +26 -23
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +41 -35
- package/dist-esm/JavaScriptSDK/PerfManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +54 -53
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +5 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +34 -34
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +11 -10
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +4 -3
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +26 -23
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +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 +103 -86
- 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 +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/IUnloadableComponent.js +1 -1
- package/dist-esm/__DynamicConstants.js +70 -0
- package/dist-esm/__DynamicConstants.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +1 -1
- package/package.json +5 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +17 -17
- package/src/JavaScriptSDK/BaseCore.ts +112 -97
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +36 -32
- package/src/JavaScriptSDK/ChannelController.ts +39 -37
- package/src/JavaScriptSDK/CookieMgr.ts +27 -27
- package/src/JavaScriptSDK/CoreUtils.ts +19 -20
- package/src/JavaScriptSDK/DataCacheHelper.ts +12 -11
- package/src/JavaScriptSDK/DbgExtensionUtils.ts +9 -9
- package/src/JavaScriptSDK/DiagnosticLogger.ts +49 -50
- package/src/JavaScriptSDK/EnvUtils.ts +15 -17
- package/src/JavaScriptSDK/EventHelpers.ts +15 -14
- package/src/JavaScriptSDK/HelperFuncs.ts +20 -11
- package/src/JavaScriptSDK/InstrumentHooks.ts +11 -13
- package/src/JavaScriptSDK/InternalConstants.ts +20 -20
- package/src/JavaScriptSDK/NotificationManager.ts +27 -27
- package/src/JavaScriptSDK/PerfManager.ts +21 -19
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +38 -34
- package/src/JavaScriptSDK/RandomHelper.ts +8 -9
- package/src/JavaScriptSDK/TelemetryHelpers.ts +33 -34
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +17 -16
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +11 -11
- package/src/JavaScriptSDK/W3cTraceParent.ts +6 -6
- package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +1 -1
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +72 -56
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +1 -1
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +2 -2
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +4 -4
- package/types/JavaScriptSDK/BaseCore.d.ts +11 -11
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +4 -4
- package/types/JavaScriptSDK/ChannelController.d.ts +1 -2
- package/types/JavaScriptSDK/CookieMgr.d.ts +3 -3
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +2 -2
- package/types/JavaScriptSDK/HelperFuncs.d.ts +6 -0
- package/types/JavaScriptSDK/InstrumentHooks.d.ts +1 -1
- package/types/JavaScriptSDK/InternalConstants.d.ts +16 -20
- package/types/JavaScriptSDK/NotificationManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +2 -2
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +4 -4
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +2 -2
- package/types/__DynamicConstants.d.ts +56 -0
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +0 -9
- package/dist-esm/JavaScriptSDK/Constants.js.map +0 -1
- package/src/JavaScriptSDK/Constants.ts +0 -5
- package/types/JavaScriptSDK/Constants.d.ts +0 -2
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.8.5-nightly.
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.8.5-nightly.2207-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
8
|
import { __spreadArrayFn as __spreadArray } from "@microsoft/applicationinsights-shims";
|
|
9
|
-
import { objCreateFn } from "@microsoft/applicationinsights-shims";
|
|
10
9
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { objCreateFn } from "@microsoft/applicationinsights-shims";
|
|
11
|
+
import { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CONFIG, _DYN_FLUSH, _DYN_GET_NOTIFY_MGR, _DYN_GET_PLUGIN, _DYN_GET_PROCESS_TEL_CONT0, _DYN_IDENTIFIER, _DYN_INITIALIZE, _DYN_INSTRUMENTATION_KEY, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_NAME, _DYN_ON_COMPLETE, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_2, _DYN_SET_ENABLED, _DYN_SPLICE, _DYN_STOP_POLLING_INTERNA3, _DYN_TEARDOWN, _DYN_TIME, _DYN__EXTENSIONS } from "../__DynamicConstants";
|
|
12
|
+
import { ChannelControllerPriority, createChannelControllerPlugin, createChannelQueues } from "./ChannelController";
|
|
14
13
|
import { createCookieMgr } from "./CookieMgr";
|
|
15
|
-
import {
|
|
16
|
-
import { strExtensionConfig, strIKey } from "./Constants";
|
|
17
|
-
import { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from "./DiagnosticLogger";
|
|
14
|
+
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
18
15
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
19
|
-
import {
|
|
16
|
+
import { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from "./DiagnosticLogger";
|
|
17
|
+
import { arrForEach, arrIndexOf, getCfgValue, getSetValue, isFunction, isNullOrUndefined, objExtend, objFreeze, proxyFunctionAs, proxyFunctions, throwError, toISOString } from "./HelperFuncs";
|
|
18
|
+
import { STR_CHANNELS, STR_CORE, STR_CREATE_PERF_MGR, STR_DISABLED, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_EVENTS_SENT, STR_EXTENSIONS, STR_EXTENSION_CONFIG, STR_GET_PERF_MGR, STR_PRIORITY } from "./InternalConstants";
|
|
19
|
+
import { PerfManager, getGblPerfMgr } from "./PerfManager";
|
|
20
|
+
import { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext, createTelemetryProxyChain } from "./ProcessTelemetryContext";
|
|
21
|
+
import { _getPluginState, createDistributedTraceContext, initializePlugins, sortPlugins } from "./TelemetryHelpers";
|
|
20
22
|
import { TelemetryInitializerPlugin } from "./TelemetryInitializerPlugin";
|
|
21
|
-
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
22
23
|
import { createUnloadHandlerContainer } from "./UnloadHandlerContainer";
|
|
23
|
-
import { strAddNotificationListener, strDisabled, strEventsDiscarded, strEventsSendRequest, strEventsSent, strRemoveNotificationListener, strTeardown } from "./InternalConstants";
|
|
24
24
|
var strValidationError = "Plugins must provide initialize method";
|
|
25
25
|
var strNotificationManager = "_notificationManager";
|
|
26
26
|
var strSdkUnloadingError = "SDK is still unloading...";
|
|
@@ -39,6 +39,7 @@ function _createPerfManager(core, notificationMgr) {
|
|
|
39
39
|
return new PerfManager(notificationMgr);
|
|
40
40
|
}
|
|
41
41
|
function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
42
|
+
var _a;
|
|
42
43
|
// Concat all available extensions
|
|
43
44
|
var coreExtensions = [];
|
|
44
45
|
// Check if any two extensions have the same priority, then warn to console
|
|
@@ -46,11 +47,12 @@ function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
|
46
47
|
var extPriorities = {};
|
|
47
48
|
// Extension validation
|
|
48
49
|
arrForEach(allExtensions, function (ext) {
|
|
49
|
-
|
|
50
|
+
// Check for ext.initialize
|
|
51
|
+
if (isNullOrUndefined(ext) || isNullOrUndefined(ext[_DYN_INITIALIZE /* @min:%2einitialize */])) {
|
|
50
52
|
throwError(strValidationError);
|
|
51
53
|
}
|
|
52
|
-
var extPriority = ext
|
|
53
|
-
var identifier = ext
|
|
54
|
+
var extPriority = ext[STR_PRIORITY /* @min:%2epriority */];
|
|
55
|
+
var identifier = ext[_DYN_IDENTIFIER /* @min:%2eidentifier */];
|
|
54
56
|
if (ext && extPriority) {
|
|
55
57
|
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
56
58
|
_warnToConsole(logger, "Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
@@ -63,13 +65,14 @@ function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
|
63
65
|
// Split extensions to core and channelController
|
|
64
66
|
if (!extPriority || extPriority < channelPriority) {
|
|
65
67
|
// Add to core extension that will be managed by BaseCore
|
|
66
|
-
coreExtensions
|
|
68
|
+
coreExtensions[_DYN_PUSH /* @min:%2epush */](ext);
|
|
67
69
|
}
|
|
68
70
|
});
|
|
69
|
-
return {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
return _a = {
|
|
72
|
+
all: allExtensions
|
|
73
|
+
},
|
|
74
|
+
_a[STR_CORE /* @min:core */] = coreExtensions,
|
|
75
|
+
_a;
|
|
73
76
|
}
|
|
74
77
|
function _isPluginPresent(thePlugin, plugins) {
|
|
75
78
|
var exists = false;
|
|
@@ -84,16 +87,17 @@ function _isPluginPresent(thePlugin, plugins) {
|
|
|
84
87
|
function _createDummyNotificationManager() {
|
|
85
88
|
var _a;
|
|
86
89
|
return objCreateFn((_a = {},
|
|
87
|
-
_a[
|
|
88
|
-
_a[
|
|
89
|
-
_a[
|
|
90
|
-
_a[
|
|
91
|
-
_a[
|
|
90
|
+
_a[_DYN_ADD_NOTIFICATION_LIS1 /* @min:addNotificationListener */] = function (listener) { },
|
|
91
|
+
_a[_DYN_REMOVE_NOTIFICATION_2 /* @min:removeNotificationListener */] = function (listener) { },
|
|
92
|
+
_a[STR_EVENTS_SENT /* @min:eventsSent */] = function (events) { },
|
|
93
|
+
_a[STR_EVENTS_DISCARDED /* @min:eventsDiscarded */] = function (events, reason) { },
|
|
94
|
+
_a[STR_EVENTS_SEND_REQUEST /* @min:eventsSendRequest */] = function (sendReason, isAsync) { },
|
|
92
95
|
_a));
|
|
93
96
|
}
|
|
94
97
|
var BaseCore = /** @class */ (function () {
|
|
95
98
|
function BaseCore() {
|
|
96
99
|
// NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()
|
|
100
|
+
var _config;
|
|
97
101
|
var _isInitialized;
|
|
98
102
|
var _eventQueue;
|
|
99
103
|
var _notificationManager;
|
|
@@ -120,37 +124,39 @@ var BaseCore = /** @class */ (function () {
|
|
|
120
124
|
dynamicProto(BaseCore, this, function (_self) {
|
|
121
125
|
// Set the default values (also called during teardown)
|
|
122
126
|
_initDefaults();
|
|
123
|
-
_self
|
|
124
|
-
|
|
127
|
+
_self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () { return _isInitialized; };
|
|
128
|
+
// Creating the self.initialize = ()
|
|
129
|
+
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {
|
|
125
130
|
if (_isUnloading) {
|
|
126
131
|
throwError(strSdkUnloadingError);
|
|
127
132
|
}
|
|
128
133
|
// Make sure core is only initialized once
|
|
129
|
-
if (_self
|
|
134
|
+
if (_self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {
|
|
130
135
|
throwError("Core should not be initialized more than once");
|
|
131
136
|
}
|
|
132
|
-
|
|
137
|
+
_config = config || {};
|
|
138
|
+
_self[_DYN_CONFIG /* @min:%2econfig */] = _config;
|
|
139
|
+
if (isNullOrUndefined(config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */])) {
|
|
133
140
|
throwError("Please provide instrumentation key");
|
|
134
141
|
}
|
|
135
142
|
_notificationManager = notificationManager;
|
|
136
143
|
// For backward compatibility only
|
|
137
144
|
_self[strNotificationManager] = notificationManager;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
_initPerfManager(config);
|
|
141
|
-
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
145
|
+
_initDebugListener();
|
|
146
|
+
_initPerfManager();
|
|
142
147
|
// add notification to the extensions in the config so other plugins can access it
|
|
143
|
-
_initExtConfig(
|
|
148
|
+
_initExtConfig();
|
|
144
149
|
if (logger) {
|
|
145
|
-
_self
|
|
150
|
+
_self[_DYN_LOGGER /* @min:%2elogger */] = logger;
|
|
146
151
|
}
|
|
152
|
+
var cfgExtensions = getSetValue(_config, STR_EXTENSIONS, []);
|
|
147
153
|
// Extension validation
|
|
148
154
|
_configExtensions = [];
|
|
149
|
-
_configExtensions.
|
|
150
|
-
_channelConfig = (
|
|
151
|
-
_initPluginChain(
|
|
152
|
-
if (!_channelQueue || _channelQueue
|
|
153
|
-
throwError("No
|
|
155
|
+
_configExtensions[_DYN_PUSH /* @min:%2epush */].apply(_configExtensions, __spreadArray(__spreadArray([], extensions, false), cfgExtensions, false));
|
|
156
|
+
_channelConfig = getSetValue(_config, STR_CHANNELS, []);
|
|
157
|
+
_initPluginChain(null);
|
|
158
|
+
if (!_channelQueue || _channelQueue[_DYN_LENGTH /* @min:%2elength */] === 0) {
|
|
159
|
+
throwError("No " + STR_CHANNELS + " available");
|
|
154
160
|
}
|
|
155
161
|
_isInitialized = true;
|
|
156
162
|
_self.releaseQueue();
|
|
@@ -159,29 +165,29 @@ var BaseCore = /** @class */ (function () {
|
|
|
159
165
|
var controls = [];
|
|
160
166
|
if (_channelQueue) {
|
|
161
167
|
arrForEach(_channelQueue, function (channels) {
|
|
162
|
-
controls
|
|
168
|
+
controls[_DYN_PUSH /* @min:%2epush */](channels.queue);
|
|
163
169
|
});
|
|
164
170
|
}
|
|
165
171
|
return objFreeze(controls);
|
|
166
172
|
};
|
|
167
173
|
_self.track = function (telemetryItem) {
|
|
168
174
|
// setup default iKey if not passed in
|
|
169
|
-
|
|
175
|
+
telemetryItem.iKey = telemetryItem.iKey || _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];
|
|
170
176
|
// add default timestamp if not passed in
|
|
171
|
-
|
|
177
|
+
telemetryItem[_DYN_TIME /* @min:%2etime */] = telemetryItem[_DYN_TIME /* @min:%2etime */] || toISOString(new Date());
|
|
172
178
|
// Common Schema 4.0
|
|
173
|
-
|
|
174
|
-
if (!_isUnloading && _self
|
|
179
|
+
telemetryItem.ver = telemetryItem.ver || "4.0";
|
|
180
|
+
if (!_isUnloading && _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {
|
|
175
181
|
// Process the telemetry plugin chain
|
|
176
|
-
_createTelCtx()
|
|
182
|
+
_createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](telemetryItem);
|
|
177
183
|
}
|
|
178
184
|
else {
|
|
179
185
|
// Queue events until all extensions are initialized
|
|
180
|
-
_eventQueue
|
|
186
|
+
_eventQueue[_DYN_PUSH /* @min:%2epush */](telemetryItem);
|
|
181
187
|
}
|
|
182
188
|
};
|
|
183
|
-
_self
|
|
184
|
-
_self
|
|
189
|
+
_self[_DYN_GET_PROCESS_TEL_CONT0 /* @min:%2egetProcessTelContext */] = _createTelCtx;
|
|
190
|
+
_self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */] = function () {
|
|
185
191
|
if (!_notificationManager) {
|
|
186
192
|
// Create Dummy notification manager
|
|
187
193
|
_notificationManager = _createDummyNotificationManager();
|
|
@@ -196,33 +202,36 @@ var BaseCore = /** @class */ (function () {
|
|
|
196
202
|
* called.
|
|
197
203
|
* @param {INotificationListener} listener - An INotificationListener object.
|
|
198
204
|
*/
|
|
199
|
-
_self[
|
|
205
|
+
_self[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */] = function (listener) {
|
|
200
206
|
if (_notificationManager) {
|
|
201
|
-
_notificationManager[
|
|
207
|
+
_notificationManager[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */](listener);
|
|
202
208
|
}
|
|
203
209
|
};
|
|
204
210
|
/**
|
|
205
211
|
* Removes all instances of the listener.
|
|
206
212
|
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
207
213
|
*/
|
|
208
|
-
_self[
|
|
214
|
+
_self[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */] = function (listener) {
|
|
209
215
|
if (_notificationManager) {
|
|
210
|
-
_notificationManager[
|
|
216
|
+
_notificationManager[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */](listener);
|
|
211
217
|
}
|
|
212
218
|
};
|
|
213
219
|
_self.getCookieMgr = function () {
|
|
214
220
|
if (!_cookieManager) {
|
|
215
|
-
_cookieManager = createCookieMgr(
|
|
221
|
+
_cookieManager = createCookieMgr(_config, _self[_DYN_LOGGER /* @min:%2elogger */]);
|
|
216
222
|
}
|
|
217
223
|
return _cookieManager;
|
|
218
224
|
};
|
|
219
225
|
_self.setCookieMgr = function (cookieMgr) {
|
|
220
226
|
_cookieManager = cookieMgr;
|
|
221
227
|
};
|
|
222
|
-
_self
|
|
228
|
+
_self[STR_GET_PERF_MGR /* @min:%2egetPerfMgr */] = function () {
|
|
223
229
|
if (!_perfManager && !_cfgPerfManager) {
|
|
224
|
-
if (
|
|
225
|
-
|
|
230
|
+
if (getCfgValue(_config.enablePerfMgr)) {
|
|
231
|
+
var createPerfMgr = getCfgValue(_config[STR_CREATE_PERF_MGR /* @min:%2ecreatePerfMgr */]);
|
|
232
|
+
if (isFunction(createPerfMgr)) {
|
|
233
|
+
_cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */]());
|
|
234
|
+
}
|
|
226
235
|
}
|
|
227
236
|
}
|
|
228
237
|
return _perfManager || _cfgPerfManager || getGblPerfMgr();
|
|
@@ -231,14 +240,14 @@ var BaseCore = /** @class */ (function () {
|
|
|
231
240
|
_perfManager = perfMgr;
|
|
232
241
|
};
|
|
233
242
|
_self.eventCnt = function () {
|
|
234
|
-
return _eventQueue
|
|
243
|
+
return _eventQueue[_DYN_LENGTH /* @min:%2elength */];
|
|
235
244
|
};
|
|
236
245
|
_self.releaseQueue = function () {
|
|
237
|
-
if (_isInitialized && _eventQueue
|
|
246
|
+
if (_isInitialized && _eventQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
238
247
|
var eventQueue = _eventQueue;
|
|
239
248
|
_eventQueue = [];
|
|
240
249
|
arrForEach(eventQueue, function (event) {
|
|
241
|
-
_createTelCtx()
|
|
250
|
+
_createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](event);
|
|
242
251
|
});
|
|
243
252
|
}
|
|
244
253
|
};
|
|
@@ -247,7 +256,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
247
256
|
*/
|
|
248
257
|
_self.pollInternalLogs = function (eventName) {
|
|
249
258
|
_internalLogsEventName = eventName || null;
|
|
250
|
-
var interval =
|
|
259
|
+
var interval = getCfgValue(_config.diagnosticLogInterval);
|
|
251
260
|
if (!interval || !(interval > 0)) {
|
|
252
261
|
interval = 10000;
|
|
253
262
|
}
|
|
@@ -262,7 +271,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
262
271
|
/**
|
|
263
272
|
* Stop polling log messages from logger.queue
|
|
264
273
|
*/
|
|
265
|
-
_self
|
|
274
|
+
_self[_DYN_STOP_POLLING_INTERNA3 /* @min:%2estopPollingInternalLogs */] = function () {
|
|
266
275
|
if (_internalLogPoller) {
|
|
267
276
|
clearInterval(_internalLogPoller);
|
|
268
277
|
_internalLogPoller = 0;
|
|
@@ -272,6 +281,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
272
281
|
// Add addTelemetryInitializer
|
|
273
282
|
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
274
283
|
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
284
|
+
var _a;
|
|
275
285
|
if (isAsync === void 0) { isAsync = true; }
|
|
276
286
|
if (!_isInitialized) {
|
|
277
287
|
// The SDK is not initialized
|
|
@@ -282,13 +292,14 @@ var BaseCore = /** @class */ (function () {
|
|
|
282
292
|
// The SDK is already unloading
|
|
283
293
|
throwError(strSdkUnloadingError);
|
|
284
294
|
}
|
|
285
|
-
var unloadState = {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
295
|
+
var unloadState = (_a = {
|
|
296
|
+
reason: 50 /* TelemetryUnloadReason.SdkUnload */
|
|
297
|
+
},
|
|
298
|
+
_a[_DYN_IS_ASYNC /* @min:isAsync */] = isAsync,
|
|
299
|
+
_a.flushComplete = false,
|
|
300
|
+
_a);
|
|
290
301
|
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);
|
|
291
|
-
processUnloadCtx
|
|
302
|
+
processUnloadCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](function () {
|
|
292
303
|
_initDefaults();
|
|
293
304
|
unloadComplete && unloadComplete(unloadState);
|
|
294
305
|
}, _self);
|
|
@@ -298,35 +309,35 @@ var BaseCore = /** @class */ (function () {
|
|
|
298
309
|
// Run all of the unload handlers first (before unloading the plugins)
|
|
299
310
|
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
300
311
|
// Stop polling the internal logs
|
|
301
|
-
_self
|
|
312
|
+
_self[_DYN_STOP_POLLING_INTERNA3 /* @min:%2estopPollingInternalLogs */]();
|
|
302
313
|
// Start unloading the components, from this point onwards the SDK should be considered to be in an unstable state
|
|
303
|
-
processUnloadCtx
|
|
314
|
+
processUnloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);
|
|
304
315
|
}
|
|
305
316
|
if (!_flushChannels(isAsync, _doUnload, 6 /* SendRequestReason.SdkUnload */, cbTimeout)) {
|
|
306
317
|
_doUnload(false);
|
|
307
318
|
}
|
|
308
319
|
};
|
|
309
|
-
_self
|
|
320
|
+
_self[_DYN_GET_PLUGIN /* @min:%2egetPlugin */] = _getPlugin;
|
|
310
321
|
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
311
322
|
if (!plugin) {
|
|
312
323
|
addCb && addCb(false);
|
|
313
324
|
_logOrThrowError(strValidationError);
|
|
314
325
|
return;
|
|
315
326
|
}
|
|
316
|
-
var existingPlugin = _getPlugin(plugin
|
|
327
|
+
var existingPlugin = _getPlugin(plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */]);
|
|
317
328
|
if (existingPlugin && !replaceExisting) {
|
|
318
329
|
addCb && addCb(false);
|
|
319
|
-
_logOrThrowError("Plugin [" + plugin
|
|
330
|
+
_logOrThrowError("Plugin [" + plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + "] is already loaded!");
|
|
320
331
|
return;
|
|
321
332
|
}
|
|
322
333
|
var updateState = {
|
|
323
334
|
reason: 16 /* TelemetryUpdateReason.PluginAdded */
|
|
324
335
|
};
|
|
325
336
|
function _addPlugin(removed) {
|
|
326
|
-
_configExtensions
|
|
337
|
+
_configExtensions[_DYN_PUSH /* @min:%2epush */](plugin);
|
|
327
338
|
updateState.added = [plugin];
|
|
328
339
|
// Re-Initialize the plugin chain
|
|
329
|
-
_initPluginChain(
|
|
340
|
+
_initPluginChain(updateState);
|
|
330
341
|
addCb && addCb(true);
|
|
331
342
|
}
|
|
332
343
|
if (existingPlugin) {
|
|
@@ -354,7 +365,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
354
365
|
_self.evtNamespace = function () {
|
|
355
366
|
return _evtNamespace;
|
|
356
367
|
};
|
|
357
|
-
_self
|
|
368
|
+
_self[_DYN_FLUSH /* @min:%2eflush */] = _flushChannels;
|
|
358
369
|
_self.getTraceCtx = function (createNew) {
|
|
359
370
|
if (!_traceCtx) {
|
|
360
371
|
_traceCtx = createDistributedTraceContext();
|
|
@@ -369,9 +380,10 @@ var BaseCore = /** @class */ (function () {
|
|
|
369
380
|
function _initDefaults() {
|
|
370
381
|
_isInitialized = false;
|
|
371
382
|
// Use a default logger so initialization errors are not dropped on the floor with full logging
|
|
372
|
-
|
|
373
|
-
_self
|
|
374
|
-
_self
|
|
383
|
+
_config = objExtend(true, {}, defaultInitConfig);
|
|
384
|
+
_self[_DYN_CONFIG /* @min:%2econfig */] = _config;
|
|
385
|
+
_self[_DYN_LOGGER /* @min:%2elogger */] = new DiagnosticLogger(_config);
|
|
386
|
+
_self[_DYN__EXTENSIONS /* @min:%2e_extensions */] = [];
|
|
375
387
|
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
376
388
|
_eventQueue = [];
|
|
377
389
|
_notificationManager = null;
|
|
@@ -391,18 +403,18 @@ var BaseCore = /** @class */ (function () {
|
|
|
391
403
|
_traceCtx = null;
|
|
392
404
|
}
|
|
393
405
|
function _createTelCtx() {
|
|
394
|
-
return createProcessTelemetryContext(_getPluginChain(),
|
|
406
|
+
return createProcessTelemetryContext(_getPluginChain(), _config, _self);
|
|
395
407
|
}
|
|
396
408
|
// Initialize or Re-initialize the plugins
|
|
397
|
-
function _initPluginChain(
|
|
409
|
+
function _initPluginChain(updateState) {
|
|
398
410
|
// Extension validation
|
|
399
|
-
var theExtensions = _validateExtensions(_self
|
|
400
|
-
_coreExtensions = theExtensions
|
|
411
|
+
var theExtensions = _validateExtensions(_self[_DYN_LOGGER /* @min:%2elogger */], ChannelControllerPriority, _configExtensions);
|
|
412
|
+
_coreExtensions = theExtensions[STR_CORE /* @min:%2ecore */];
|
|
401
413
|
_pluginChain = null;
|
|
402
414
|
// Sort the complete set of extensions by priority
|
|
403
415
|
var allExtensions = theExtensions.all;
|
|
404
416
|
// Initialize the Channel Queues and the channel plugins first
|
|
405
|
-
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions,
|
|
417
|
+
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, _self));
|
|
406
418
|
if (_channelControl) {
|
|
407
419
|
// During add / remove of a plugin this may get called again, so don't re-add if already present
|
|
408
420
|
// But we also want the controller as the last, so remove if already present
|
|
@@ -410,11 +422,11 @@ var BaseCore = /** @class */ (function () {
|
|
|
410
422
|
// is using it.
|
|
411
423
|
var idx = arrIndexOf(allExtensions, _channelControl);
|
|
412
424
|
if (idx !== -1) {
|
|
413
|
-
allExtensions
|
|
425
|
+
allExtensions[_DYN_SPLICE /* @min:%2esplice */](idx, 1);
|
|
414
426
|
}
|
|
415
427
|
idx = arrIndexOf(_coreExtensions, _channelControl);
|
|
416
428
|
if (idx !== -1) {
|
|
417
|
-
_coreExtensions
|
|
429
|
+
_coreExtensions[_DYN_SPLICE /* @min:%2esplice */](idx, 1);
|
|
418
430
|
}
|
|
419
431
|
_channelControl._setQueue(_channelQueue);
|
|
420
432
|
}
|
|
@@ -422,24 +434,25 @@ var BaseCore = /** @class */ (function () {
|
|
|
422
434
|
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
423
435
|
}
|
|
424
436
|
// Add on "channelController" as the last "plugin"
|
|
425
|
-
allExtensions
|
|
426
|
-
_coreExtensions
|
|
437
|
+
allExtensions[_DYN_PUSH /* @min:%2epush */](_channelControl);
|
|
438
|
+
_coreExtensions[_DYN_PUSH /* @min:%2epush */](_channelControl);
|
|
427
439
|
// Required to allow plugins to call core.getPlugin() during their own initialization
|
|
428
|
-
_self
|
|
440
|
+
_self[_DYN__EXTENSIONS /* @min:%2e_extensions */] = sortPlugins(allExtensions);
|
|
429
441
|
// Initialize the controls
|
|
430
|
-
_channelControl
|
|
442
|
+
_channelControl[_DYN_INITIALIZE /* @min:%2einitialize */](_config, _self, allExtensions);
|
|
431
443
|
initializePlugins(_createTelCtx(), allExtensions);
|
|
432
444
|
// Now reset the extensions to just those being managed by Basecore
|
|
433
|
-
_self
|
|
445
|
+
_self[_DYN__EXTENSIONS /* @min:%2e_extensions */] = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
434
446
|
if (updateState) {
|
|
435
447
|
_doUpdate(updateState);
|
|
436
448
|
}
|
|
437
449
|
}
|
|
438
450
|
function _getPlugin(pluginIdentifier) {
|
|
451
|
+
var _a;
|
|
439
452
|
var theExt = null;
|
|
440
453
|
var thePlugin = null;
|
|
441
|
-
arrForEach(_self
|
|
442
|
-
if (ext
|
|
454
|
+
arrForEach(_self[_DYN__EXTENSIONS /* @min:%2e_extensions */], function (ext) {
|
|
455
|
+
if (ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
443
456
|
thePlugin = ext;
|
|
444
457
|
return -1;
|
|
445
458
|
}
|
|
@@ -449,34 +462,37 @@ var BaseCore = /** @class */ (function () {
|
|
|
449
462
|
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
450
463
|
}
|
|
451
464
|
if (thePlugin) {
|
|
452
|
-
theExt = {
|
|
453
|
-
|
|
454
|
-
setEnabled: function (enabled) {
|
|
455
|
-
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
465
|
+
theExt = (_a = {
|
|
466
|
+
plugin: thePlugin
|
|
456
467
|
},
|
|
457
|
-
|
|
468
|
+
_a[_DYN_SET_ENABLED /* @min:setEnabled */] = function (enabled) {
|
|
469
|
+
_getPluginState(thePlugin)[STR_DISABLED] = !enabled;
|
|
470
|
+
},
|
|
471
|
+
_a.isEnabled = function () {
|
|
458
472
|
var pluginState = _getPluginState(thePlugin);
|
|
459
|
-
return !pluginState[
|
|
473
|
+
return !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] && !pluginState[STR_DISABLED];
|
|
460
474
|
},
|
|
461
|
-
remove
|
|
475
|
+
_a.remove = function (isAsync, removeCb) {
|
|
476
|
+
var _a;
|
|
462
477
|
if (isAsync === void 0) { isAsync = true; }
|
|
463
478
|
var pluginsToRemove = [thePlugin];
|
|
464
|
-
var unloadState = {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
479
|
+
var unloadState = (_a = {
|
|
480
|
+
reason: 1 /* TelemetryUnloadReason.PluginUnload */
|
|
481
|
+
},
|
|
482
|
+
_a[_DYN_IS_ASYNC /* @min:isAsync */] = isAsync,
|
|
483
|
+
_a);
|
|
468
484
|
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
469
485
|
if (removed) {
|
|
470
486
|
// Re-Initialize the plugin chain
|
|
471
|
-
_initPluginChain(
|
|
487
|
+
_initPluginChain({
|
|
472
488
|
reason: 32 /* TelemetryUpdateReason.PluginRemoved */,
|
|
473
489
|
removed: pluginsToRemove
|
|
474
490
|
});
|
|
475
491
|
}
|
|
476
492
|
removeCb && removeCb(removed);
|
|
477
493
|
});
|
|
478
|
-
}
|
|
479
|
-
|
|
494
|
+
},
|
|
495
|
+
_a);
|
|
480
496
|
}
|
|
481
497
|
return theExt;
|
|
482
498
|
}
|
|
@@ -486,23 +502,23 @@ var BaseCore = /** @class */ (function () {
|
|
|
486
502
|
var extensions = (_coreExtensions || []).slice();
|
|
487
503
|
// During add / remove this may get called again, so don't readd if already present
|
|
488
504
|
if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) {
|
|
489
|
-
extensions
|
|
505
|
+
extensions[_DYN_PUSH /* @min:%2epush */](_telemetryInitializerPlugin);
|
|
490
506
|
}
|
|
491
|
-
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions),
|
|
507
|
+
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _config, _self);
|
|
492
508
|
}
|
|
493
509
|
return _pluginChain;
|
|
494
510
|
}
|
|
495
511
|
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
496
|
-
if (thePlugins && thePlugins
|
|
497
|
-
var unloadChain = createTelemetryProxyChain(thePlugins,
|
|
512
|
+
if (thePlugins && thePlugins[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
513
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _config, _self);
|
|
498
514
|
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self);
|
|
499
|
-
unloadCtx
|
|
515
|
+
unloadCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](function () {
|
|
500
516
|
var removed = false;
|
|
501
517
|
// Remove the listed config extensions
|
|
502
518
|
var newConfigExtensions = [];
|
|
503
519
|
arrForEach(_configExtensions, function (plugin, idx) {
|
|
504
520
|
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
505
|
-
newConfigExtensions
|
|
521
|
+
newConfigExtensions[_DYN_PUSH /* @min:%2epush */](plugin);
|
|
506
522
|
}
|
|
507
523
|
else {
|
|
508
524
|
removed = true;
|
|
@@ -516,80 +532,83 @@ var BaseCore = /** @class */ (function () {
|
|
|
516
532
|
var newQueue = [];
|
|
517
533
|
arrForEach(queue, function (channel) {
|
|
518
534
|
if (!_isPluginPresent(channel, thePlugins)) {
|
|
519
|
-
newQueue
|
|
535
|
+
newQueue[_DYN_PUSH /* @min:%2epush */](channel);
|
|
520
536
|
}
|
|
521
537
|
else {
|
|
522
538
|
removed = true;
|
|
523
539
|
}
|
|
524
540
|
});
|
|
525
|
-
newChannelConfig
|
|
541
|
+
newChannelConfig[_DYN_PUSH /* @min:%2epush */](newQueue);
|
|
526
542
|
});
|
|
527
543
|
_channelConfig = newChannelConfig;
|
|
528
544
|
}
|
|
529
545
|
removeComplete && removeComplete(removed);
|
|
530
546
|
});
|
|
531
|
-
unloadCtx
|
|
547
|
+
unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);
|
|
532
548
|
}
|
|
533
549
|
else {
|
|
534
550
|
removeComplete(false);
|
|
535
551
|
}
|
|
536
552
|
}
|
|
537
553
|
function _flushInternalLogs() {
|
|
538
|
-
var queue = _self
|
|
554
|
+
var queue = _self[_DYN_LOGGER /* @min:%2elogger */] ? _self[_DYN_LOGGER /* @min:%2elogger */].queue : [];
|
|
539
555
|
if (queue) {
|
|
540
556
|
arrForEach(queue, function (logMessage) {
|
|
541
|
-
var
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
557
|
+
var _a;
|
|
558
|
+
var item = (_a = {},
|
|
559
|
+
_a[_DYN_NAME /* @min:name */] = _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage[_DYN_MESSAGE_ID /* @min:%2emessageId */],
|
|
560
|
+
_a.iKey = getCfgValue(_config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */]),
|
|
561
|
+
_a.time = toISOString(new Date()),
|
|
562
|
+
_a.baseType = _InternalLogMessage.dataType,
|
|
563
|
+
_a.baseData = { message: logMessage[_DYN_MESSAGE /* @min:%2emessage */] },
|
|
564
|
+
_a);
|
|
548
565
|
_self.track(item);
|
|
549
566
|
});
|
|
550
|
-
queue
|
|
567
|
+
queue[_DYN_LENGTH /* @min:%2elength */] = 0;
|
|
551
568
|
}
|
|
552
569
|
}
|
|
553
570
|
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
554
571
|
if (_channelControl) {
|
|
555
|
-
return _channelControl
|
|
572
|
+
return _channelControl[_DYN_FLUSH /* @min:%2eflush */](isAsync, callBack, sendReason || 6 /* SendRequestReason.SdkUnload */, cbTimeout);
|
|
556
573
|
}
|
|
557
574
|
callBack && callBack(false);
|
|
558
575
|
return true;
|
|
559
576
|
}
|
|
560
|
-
function _initDebugListener(
|
|
561
|
-
|
|
577
|
+
function _initDebugListener() {
|
|
578
|
+
var disableDbgExt = getCfgValue(_config.disableDbgExt);
|
|
579
|
+
if (disableDbgExt === true && _debugListener) {
|
|
562
580
|
// Remove any previously loaded debug listener
|
|
563
|
-
_notificationManager[
|
|
581
|
+
_notificationManager[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */](_debugListener);
|
|
564
582
|
_debugListener = null;
|
|
565
583
|
}
|
|
566
|
-
if (_notificationManager && !_debugListener &&
|
|
567
|
-
_debugListener = getDebugListener(
|
|
568
|
-
_notificationManager[
|
|
584
|
+
if (_notificationManager && !_debugListener && disableDbgExt !== true) {
|
|
585
|
+
_debugListener = getDebugListener(_config);
|
|
586
|
+
_notificationManager[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */](_debugListener);
|
|
569
587
|
}
|
|
570
588
|
}
|
|
571
|
-
function _initPerfManager(
|
|
572
|
-
|
|
589
|
+
function _initPerfManager() {
|
|
590
|
+
var enablePerfMgr = getCfgValue(_config.enablePerfMgr);
|
|
591
|
+
if (!enablePerfMgr && _cfgPerfManager) {
|
|
573
592
|
// Remove any existing config based performance manager
|
|
574
593
|
_cfgPerfManager = null;
|
|
575
594
|
}
|
|
576
|
-
if (
|
|
595
|
+
if (enablePerfMgr) {
|
|
577
596
|
// Set the performance manager creation function if not defined
|
|
578
|
-
|
|
597
|
+
getSetValue(_config, STR_CREATE_PERF_MGR, _createPerfManager);
|
|
579
598
|
}
|
|
580
599
|
}
|
|
581
|
-
function _initExtConfig(
|
|
582
|
-
var extConfig = getSetValue(
|
|
600
|
+
function _initExtConfig() {
|
|
601
|
+
var extConfig = getSetValue(_config, STR_EXTENSION_CONFIG, {});
|
|
583
602
|
extConfig.NotificationManager = _notificationManager;
|
|
584
603
|
}
|
|
585
604
|
function _doUpdate(updateState) {
|
|
586
605
|
var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);
|
|
587
606
|
if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
|
|
588
|
-
updateCtx
|
|
607
|
+
updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](updateState);
|
|
589
608
|
}
|
|
590
609
|
}
|
|
591
610
|
function _logOrThrowError(message) {
|
|
592
|
-
var logger = _self
|
|
611
|
+
var logger = _self[_DYN_LOGGER /* @min:%2elogger */];
|
|
593
612
|
if (logger) {
|
|
594
613
|
// there should always be a logger
|
|
595
614
|
_throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, message);
|