@microsoft/applicationinsights-core-js 3.3.0-nightly3.2406-07 → 3.3.0-nightly3.2406-08
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/es5/applicationinsights-core-js.cjs.js +199 -20
- package/browser/es5/applicationinsights-core-js.cjs.js.map +1 -1
- package/browser/es5/applicationinsights-core-js.cjs.min.js +2 -2
- package/browser/es5/applicationinsights-core-js.cjs.min.js.map +1 -1
- package/browser/es5/applicationinsights-core-js.gbl.js +201 -22
- package/browser/es5/applicationinsights-core-js.gbl.js.map +1 -1
- package/browser/es5/applicationinsights-core-js.gbl.min.js +2 -2
- package/browser/es5/applicationinsights-core-js.gbl.min.js.map +1 -1
- package/browser/es5/applicationinsights-core-js.integrity.json +25 -25
- package/browser/es5/applicationinsights-core-js.js +201 -22
- package/browser/es5/applicationinsights-core-js.js.map +1 -1
- package/browser/es5/applicationinsights-core-js.min.js +2 -2
- package/browser/es5/applicationinsights-core-js.min.js.map +1 -1
- package/dist/es5/applicationinsights-core-js.js +199 -20
- package/dist/es5/applicationinsights-core-js.js.map +1 -1
- package/dist/es5/applicationinsights-core-js.min.js +2 -2
- package/dist/es5/applicationinsights-core-js.min.js.map +1 -1
- package/dist-es5/Config/ConfigDefaultHelpers.js +1 -1
- package/dist-es5/Config/ConfigDefaults.js +1 -1
- package/dist-es5/Config/DynamicConfig.js +1 -1
- package/dist-es5/Config/DynamicProperty.js +1 -1
- package/dist-es5/Config/DynamicState.js +1 -1
- package/dist-es5/Config/DynamicSupport.js +1 -1
- package/dist-es5/Config/IConfigDefaults.js +1 -1
- package/dist-es5/Config/IDynamicConfigHandler.js +1 -1
- package/dist-es5/Config/IDynamicPropertyHandler.js +1 -1
- package/dist-es5/Config/IDynamicWatcher.js +1 -1
- package/dist-es5/Config/_IDynamicConfigHandlerState.js +1 -1
- package/dist-es5/JavaScriptSDK/AggregationError.js +1 -1
- package/dist-es5/JavaScriptSDK/AppInsightsCore.js +166 -20
- package/dist-es5/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-es5/JavaScriptSDK/AsyncUtils.js +1 -1
- package/dist-es5/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-es5/JavaScriptSDK/Constants.js +1 -1
- package/dist-es5/JavaScriptSDK/CookieMgr.js +1 -1
- package/dist-es5/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-es5/JavaScriptSDK/DataCacheHelper.js +2 -2
- package/dist-es5/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-es5/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-es5/JavaScriptSDK/DiagnosticLogger.js +1 -1
- package/dist-es5/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-es5/JavaScriptSDK/EventHelpers.js +1 -1
- package/dist-es5/JavaScriptSDK/HelperFuncs.js +1 -1
- package/dist-es5/JavaScriptSDK/InstrumentHooks.js +1 -1
- package/dist-es5/JavaScriptSDK/InternalConstants.js +1 -1
- package/dist-es5/JavaScriptSDK/NotificationManager.js +1 -1
- package/dist-es5/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-es5/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
- package/dist-es5/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-es5/JavaScriptSDK/ResponseHelpers.js +1 -1
- package/dist-es5/JavaScriptSDK/SenderPostManager.js +4 -4
- package/dist-es5/JavaScriptSDK/SenderPostManager.js.map +1 -1
- package/dist-es5/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-es5/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-es5/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-es5/JavaScriptSDK/UnloadHookContainer.js +1 -1
- package/dist-es5/JavaScriptSDK/W3cTraceParent.js +1 -1
- package/dist-es5/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
- package/dist-es5/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-es5/JavaScriptSDK.Enums/FeatureOptInEnums.js +1 -1
- package/dist-es5/JavaScriptSDK.Enums/InitActiveStatusEnum.js +12 -0
- package/dist-es5/JavaScriptSDK.Enums/InitActiveStatusEnum.js.map +1 -0
- package/dist-es5/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-es5/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-es5/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-es5/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IChannelControlsHost.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IFeatureOptIn.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ISenderPostManager.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IXDomainRequest.js +1 -1
- package/dist-es5/JavaScriptSDK.Interfaces/IXHROverride.js +1 -1
- package/dist-es5/__DynamicConstants.js +8 -4
- package/dist-es5/__DynamicConstants.js.map +1 -1
- package/dist-es5/applicationinsights-core-js.js +2 -1
- package/dist-es5/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/types/applicationinsights-core-js.d.ts +71 -5
- package/types/applicationinsights-core-js.namespaced.d.ts +71 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.3.0-nightly3.2406-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.3.0-nightly3.2406-08
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,17 +8,18 @@
|
|
|
8
8
|
var _a;
|
|
9
9
|
import { __spreadArrayFn as __spreadArray } from "@microsoft/applicationinsights-shims";
|
|
10
10
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
11
|
-
import { createPromise } from "@nevware21/ts-async";
|
|
12
|
-
import { arrAppend, arrForEach, arrIndexOf, createTimeout, deepExtend, hasDocument, isFunction, isNullOrUndefined, isPlainObject, objDeepFreeze, objDefine, objForEachKey, objFreeze, objHasOwn, scheduleTimeout, throwError } from "@nevware21/ts-utils";
|
|
11
|
+
import { createAllSettledPromise, createPromise, doAwaitResponse } from "@nevware21/ts-async";
|
|
12
|
+
import { arrAppend, arrForEach, arrIndexOf, createTimeout, deepExtend, hasDocument, isFunction, isNullOrUndefined, isPlainObject, isPromiseLike, objDeepFreeze, objDefine, objForEachKey, objFreeze, objHasOwn, scheduleTimeout, throwError } from "@nevware21/ts-utils";
|
|
13
13
|
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
14
|
-
import {
|
|
14
|
+
import { ActiveStatus } from "../JavaScriptSDK.Enums/InitActiveStatusEnum";
|
|
15
|
+
import { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CANCEL, _DYN_CREATE_NEW, _DYN_ENABLED, _DYN_GET_NOTIFY_MGR, _DYN_GET_PLUGIN, _DYN_GET_PROCESS_TEL_CONT2, _DYN_IDENTIFIER, _DYN_INITIALIZE, _DYN_INSTRUMENTATION_KEY, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_I_KEY, _DYN_LENGTH, _DYN_LOGGER, _DYN_LOGGING_LEVEL_CONSOL4, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_NAME, _DYN_NOTIFY, _DYN_ON_COMPLETE, _DYN_POLL_INTERNAL_LOGS, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_0, _DYN_SET_DF, _DYN_SPLICE, _DYN_STOP_POLLING_INTERNA3, _DYN_TEARDOWN, _DYN_TIME, _DYN_UNLOAD, _DYN_VALUE, _DYN_VERSION, _DYN_WATCH, _DYN__INACTIVE } from "../__DynamicConstants";
|
|
15
16
|
import { doUnloadAll, runTargetUnload } from "./AsyncUtils";
|
|
16
17
|
import { ChannelControllerPriority } from "./Constants";
|
|
17
18
|
import { createCookieMgr } from "./CookieMgr";
|
|
18
19
|
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
19
20
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
20
21
|
import { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from "./DiagnosticLogger";
|
|
21
|
-
import { getSetValue, proxyFunctionAs, proxyFunctions, toISOString } from "./HelperFuncs";
|
|
22
|
+
import { getSetValue, isNotNullOrUndefined, proxyFunctionAs, proxyFunctions, toISOString } from "./HelperFuncs";
|
|
22
23
|
import { STR_CHANNELS, STR_CORE, STR_CREATE_PERF_MGR, STR_DISABLED, STR_EMPTY, STR_EVENTS_DISCARDED, STR_EXTENSIONS, STR_EXTENSION_CONFIG, STR_GET_PERF_MGR, STR_PRIORITY, UNDEFINED_VALUE } from "./InternalConstants";
|
|
23
24
|
import { NotificationManager } from "./NotificationManager";
|
|
24
25
|
import { PerfManager, doPerf, getGblPerfMgr } from "./PerfManager";
|
|
@@ -31,6 +32,8 @@ var strValidationError = "Plugins must provide initialize method";
|
|
|
31
32
|
var strNotificationManager = "_notificationManager";
|
|
32
33
|
var strSdkUnloadingError = "SDK is still unloading...";
|
|
33
34
|
var strSdkNotInitialized = "SDK is not initialized";
|
|
35
|
+
var maxInitQueueSize = 100;
|
|
36
|
+
var maxInitTimeout = 50000;
|
|
34
37
|
// const strPluginUnloadFailed = "Failed to unload plugin";
|
|
35
38
|
/**
|
|
36
39
|
* The default settings for the config.
|
|
@@ -220,6 +223,11 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
220
223
|
var _extensions;
|
|
221
224
|
var _pluginVersionStringArr;
|
|
222
225
|
var _pluginVersionString;
|
|
226
|
+
var _activeStatus; // to indicate if ikey or endpoint url promised is resolved or not
|
|
227
|
+
var _endpoint;
|
|
228
|
+
var _initInMemoMaxSize; // max event count limit during wait for init promises to be resolved
|
|
229
|
+
var _isStatusSet; // track if active status is set in case of init timeout and init promises setting the status twice
|
|
230
|
+
var _initTimer;
|
|
223
231
|
/**
|
|
224
232
|
* Internal log poller
|
|
225
233
|
*/
|
|
@@ -231,9 +239,16 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
231
239
|
_initDefaults();
|
|
232
240
|
// Special internal method to allow the unit tests and DebugPlugin to hook embedded objects
|
|
233
241
|
_self["_getDbgPlgTargets"] = function () {
|
|
234
|
-
return [_extensions];
|
|
242
|
+
return [_extensions, _eventQueue];
|
|
235
243
|
};
|
|
236
244
|
_self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () { return _isInitialized; };
|
|
245
|
+
// since version 3.3.0
|
|
246
|
+
_self.activeStatus = function () { return _activeStatus; };
|
|
247
|
+
// since version 3.3.0
|
|
248
|
+
// internal
|
|
249
|
+
_self._setPendingStatus = function () {
|
|
250
|
+
_activeStatus = 3 /* eActiveStatus.PENDING */;
|
|
251
|
+
};
|
|
237
252
|
// Creating the self.initialize = ()
|
|
238
253
|
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {
|
|
239
254
|
if (_isUnloading) {
|
|
@@ -248,7 +263,106 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
248
263
|
config = _configHandler.cfg;
|
|
249
264
|
// This will be "re-run" if the referenced config properties are changed
|
|
250
265
|
_addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {
|
|
251
|
-
|
|
266
|
+
var rootCfg = details.cfg;
|
|
267
|
+
var isPending = _activeStatus === 3 /* eActiveStatus.PENDING */;
|
|
268
|
+
if (isPending) {
|
|
269
|
+
// means waiting for previous promises to be resolved, won't apply new changes
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
_initInMemoMaxSize = rootCfg.initInMemoMaxSize || maxInitQueueSize;
|
|
273
|
+
// app Insights core only handle ikey and endpointurl, aisku will handle cs
|
|
274
|
+
var ikey = rootCfg[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];
|
|
275
|
+
var endpointUrl = rootCfg.endpointUrl; // do not need to validate endpoint url, if it is null, default one will be set by sender
|
|
276
|
+
if (isNullOrUndefined(ikey)) {
|
|
277
|
+
_instrumentationKey = null;
|
|
278
|
+
// if new ikey is null, set status to be inactive, all new events will be saved in memory or dropped
|
|
279
|
+
_activeStatus = ActiveStatus[_DYN__INACTIVE /* @min:%2eINACTIVE */];
|
|
280
|
+
var msg = "Please provide instrumentation key";
|
|
281
|
+
if (!_isInitialized) {
|
|
282
|
+
// only throw error during initialization
|
|
283
|
+
throwError(msg);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
_throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 100 /* _eInternalMessageId.InvalidInstrumentationKey */, msg);
|
|
287
|
+
_releaseQueues();
|
|
288
|
+
}
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
var promises = [];
|
|
292
|
+
if (isPromiseLike(ikey)) {
|
|
293
|
+
promises[_DYN_PUSH /* @min:%2epush */](ikey);
|
|
294
|
+
_instrumentationKey = null; // reset current local ikey variable (otherwise it will always be the previous ikeys if timeout is called before promise cb)
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
// string
|
|
298
|
+
_instrumentationKey = ikey;
|
|
299
|
+
}
|
|
300
|
+
if (isPromiseLike(endpointUrl)) {
|
|
301
|
+
promises[_DYN_PUSH /* @min:%2epush */](endpointUrl);
|
|
302
|
+
_endpoint = null; // reset current local endpoint variable (otherwise it will always be the previous urls if timeout is called before promise cb)
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
// string or null
|
|
306
|
+
_endpoint = endpointUrl;
|
|
307
|
+
}
|
|
308
|
+
// at least have one promise
|
|
309
|
+
if (promises[_DYN_LENGTH /* @min:%2elength */]) {
|
|
310
|
+
// reset to false for new dynamic changes
|
|
311
|
+
_isStatusSet = false;
|
|
312
|
+
_activeStatus = 3 /* eActiveStatus.PENDING */;
|
|
313
|
+
var initTimeout = isNotNullOrUndefined(rootCfg.initTimeOut) ? rootCfg.initTimeOut : maxInitTimeout; // rootCfg.initTimeOut could be 0
|
|
314
|
+
var allPromises = createAllSettledPromise(promises);
|
|
315
|
+
_initTimer = scheduleTimeout(function () {
|
|
316
|
+
// set _isStatusSet to true
|
|
317
|
+
// set active status
|
|
318
|
+
// release queues
|
|
319
|
+
_initTimer = null;
|
|
320
|
+
if (!_isStatusSet) {
|
|
321
|
+
_setStatus();
|
|
322
|
+
}
|
|
323
|
+
}, initTimeout);
|
|
324
|
+
doAwaitResponse(allPromises, function (response) {
|
|
325
|
+
try {
|
|
326
|
+
if (_isStatusSet) {
|
|
327
|
+
// promises take too long to resolve, ignore them
|
|
328
|
+
// active status should be set by timeout already
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (!response.rejected) {
|
|
332
|
+
var values = response[_DYN_VALUE /* @min:%2evalue */];
|
|
333
|
+
if (values && values[_DYN_LENGTH /* @min:%2elength */]) {
|
|
334
|
+
// ikey
|
|
335
|
+
var ikeyRes = values[0];
|
|
336
|
+
_instrumentationKey = ikeyRes && ikeyRes[_DYN_VALUE /* @min:%2evalue */];
|
|
337
|
+
// endpoint
|
|
338
|
+
if (values[_DYN_LENGTH /* @min:%2elength */] > 1) {
|
|
339
|
+
var endpointRes = values[1];
|
|
340
|
+
_endpoint = endpointRes && endpointRes[_DYN_VALUE /* @min:%2evalue */];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (_instrumentationKey) {
|
|
344
|
+
// if ikey is null, no need to trigger extra dynamic changes for extensions
|
|
345
|
+
config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = _instrumentationKey; // set config.instrumentationKey for extensions to consume
|
|
346
|
+
config.endpointUrl = _endpoint; // set config.endpointUrl for extensions to consume
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// set _isStatusSet to true
|
|
350
|
+
// set active status
|
|
351
|
+
// release queues
|
|
352
|
+
_setStatus();
|
|
353
|
+
}
|
|
354
|
+
catch (e) {
|
|
355
|
+
if (!_isStatusSet) {
|
|
356
|
+
_setStatus();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
// means no promises
|
|
363
|
+
_setStatus();
|
|
364
|
+
}
|
|
365
|
+
//_instrumentationKey = details.cfg.instrumentationKey;
|
|
252
366
|
// Mark the extensionConfig and all first level keys as referenced
|
|
253
367
|
// This is so that calls to getExtCfg() will always return the same object
|
|
254
368
|
// Even when a user may "re-assign" the plugin properties (or it's unloaded/reloaded)
|
|
@@ -256,9 +370,6 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
256
370
|
objForEachKey(extCfg, function (key) {
|
|
257
371
|
details.ref(extCfg, key);
|
|
258
372
|
});
|
|
259
|
-
if (isNullOrUndefined(_instrumentationKey)) {
|
|
260
|
-
throwError("Please provide instrumentation key");
|
|
261
|
-
}
|
|
262
373
|
}));
|
|
263
374
|
_notificationManager = notificationManager;
|
|
264
375
|
// Initialize the debug listener outside of the closure to reduce the retained memory footprint
|
|
@@ -283,8 +394,9 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
283
394
|
_registerDelayedCfgListener(config, _cfgListeners, _logger);
|
|
284
395
|
_cfgListeners = null;
|
|
285
396
|
_isInitialized = true;
|
|
286
|
-
|
|
287
|
-
|
|
397
|
+
if (_activeStatus === ActiveStatus.ACTIVE) {
|
|
398
|
+
_releaseQueues();
|
|
399
|
+
}
|
|
288
400
|
};
|
|
289
401
|
_self.getChannels = function () {
|
|
290
402
|
var controls = [];
|
|
@@ -308,18 +420,21 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
308
420
|
throwError("telemetry name required");
|
|
309
421
|
}
|
|
310
422
|
// setup default iKey if not passed in
|
|
311
|
-
telemetryItem
|
|
423
|
+
telemetryItem[_DYN_I_KEY /* @min:%2eiKey */] = telemetryItem[_DYN_I_KEY /* @min:%2eiKey */] || _instrumentationKey;
|
|
312
424
|
// add default timestamp if not passed in
|
|
313
425
|
telemetryItem[_DYN_TIME /* @min:%2etime */] = telemetryItem[_DYN_TIME /* @min:%2etime */] || toISOString(new Date());
|
|
314
426
|
// Common Schema 4.0
|
|
315
427
|
telemetryItem.ver = telemetryItem.ver || "4.0";
|
|
316
|
-
if (!_isUnloading && _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {
|
|
428
|
+
if (!_isUnloading && _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]() && _activeStatus === ActiveStatus.ACTIVE) {
|
|
317
429
|
// Process the telemetry plugin chain
|
|
318
430
|
_createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](telemetryItem);
|
|
319
431
|
}
|
|
320
|
-
else {
|
|
432
|
+
else if (_activeStatus !== ActiveStatus[_DYN__INACTIVE /* @min:%2eINACTIVE */]) {
|
|
321
433
|
// Queue events until all extensions are initialized
|
|
322
|
-
_eventQueue[
|
|
434
|
+
if (_eventQueue[_DYN_LENGTH /* @min:%2elength */] <= _initInMemoMaxSize) {
|
|
435
|
+
// set limit, if full, stop adding new events
|
|
436
|
+
_eventQueue[_DYN_PUSH /* @min:%2epush */](telemetryItem);
|
|
437
|
+
}
|
|
323
438
|
}
|
|
324
439
|
}, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
|
|
325
440
|
};
|
|
@@ -375,9 +490,16 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
375
490
|
if (_isInitialized && _eventQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
376
491
|
var eventQueue = _eventQueue;
|
|
377
492
|
_eventQueue = [];
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
493
|
+
if (_activeStatus === 2 /* eActiveStatus.ACTIVE */) {
|
|
494
|
+
arrForEach(eventQueue, function (event) {
|
|
495
|
+
event[_DYN_I_KEY /* @min:%2eiKey */] = event[_DYN_I_KEY /* @min:%2eiKey */] || _instrumentationKey;
|
|
496
|
+
_createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](event);
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
// new one for msg ikey
|
|
501
|
+
_throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 20 /* _eInternalMessageId.FailedToSendQueuedTelemetry */, "core init status is not active");
|
|
502
|
+
}
|
|
381
503
|
}
|
|
382
504
|
};
|
|
383
505
|
_self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {
|
|
@@ -386,6 +508,23 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
386
508
|
_internalLogPoller && _internalLogPoller[_DYN_CANCEL /* @min:%2ecancel */]();
|
|
387
509
|
return _startLogPoller(true);
|
|
388
510
|
};
|
|
511
|
+
function _setStatus() {
|
|
512
|
+
_isStatusSet = true;
|
|
513
|
+
if (isNullOrUndefined(_instrumentationKey)) {
|
|
514
|
+
_activeStatus = ActiveStatus[_DYN__INACTIVE /* @min:%2eINACTIVE */];
|
|
515
|
+
_throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 112 /* _eInternalMessageId.InitPromiseException */, "ikey can't be resolved from promises");
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
_activeStatus = ActiveStatus.ACTIVE;
|
|
519
|
+
}
|
|
520
|
+
_releaseQueues();
|
|
521
|
+
}
|
|
522
|
+
function _releaseQueues() {
|
|
523
|
+
if (_isInitialized) {
|
|
524
|
+
_self.releaseQueue();
|
|
525
|
+
_self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */]();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
389
528
|
function _startLogPoller(alwaysStart) {
|
|
390
529
|
if ((!_internalLogPoller || !_internalLogPoller[_DYN_ENABLED /* @min:%2eenabled */]) && !_forceStopInternalLogPoller) {
|
|
391
530
|
var shouldStart = alwaysStart || (_logger && _logger.queue[_DYN_LENGTH /* @min:%2elength */] > 0);
|
|
@@ -691,6 +830,11 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
691
830
|
_forceStopInternalLogPoller = false;
|
|
692
831
|
_internalLogPoller = null;
|
|
693
832
|
_internalLogPollerListening = false;
|
|
833
|
+
_activeStatus = 0 /* eActiveStatus.NONE */; // default is None
|
|
834
|
+
_endpoint = null;
|
|
835
|
+
_initInMemoMaxSize = null;
|
|
836
|
+
_isStatusSet = false;
|
|
837
|
+
_initTimer = null;
|
|
694
838
|
}
|
|
695
839
|
function _createTelCtx() {
|
|
696
840
|
var theCtx = createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self);
|
|
@@ -849,7 +993,7 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
849
993
|
var _a;
|
|
850
994
|
var item = (_a = {},
|
|
851
995
|
_a[_DYN_NAME /* @min:name */] = _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage[_DYN_MESSAGE_ID /* @min:%2emessageId */],
|
|
852
|
-
_a
|
|
996
|
+
_a[_DYN_I_KEY /* @min:iKey */] = _instrumentationKey,
|
|
853
997
|
_a[_DYN_TIME /* @min:time */] = toISOString(new Date()),
|
|
854
998
|
_a.baseType = _InternalLogMessage.dataType,
|
|
855
999
|
_a.baseData = { message: logMessage[_DYN_MESSAGE /* @min:%2emessage */] },
|
|
@@ -993,6 +1137,8 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
993
1137
|
// Removed Stub for AppInsightsCore.prototype.setTraceCtx.
|
|
994
1138
|
// Removed Stub for AppInsightsCore.prototype.addUnloadHook.
|
|
995
1139
|
// Removed Stub for AppInsightsCore.prototype.onCfgChange.
|
|
1140
|
+
// Removed Stub for AppInsightsCore.prototype.activeStatus.
|
|
1141
|
+
// Removed Stub for AppInsightsCore.prototype._setPendingStatus.
|
|
996
1142
|
// Removed Stub for AppInsightsCore.prototype.releaseQueue.
|
|
997
1143
|
// Removed Stub for AppInsightsCore.prototype._updateHook.
|
|
998
1144
|
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|