@microsoft/sp-diagnostics 1.23.1 → 1.24.0-beta.2

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.
Files changed (223) hide show
  1. package/dist/78359e4b-07c2-43c6-8d0b-d060b4d577e8.manifest.json +6 -11
  2. package/dist/index-internal-beta.d.ts +20 -0
  3. package/dist/index-internal-public.d.ts +20 -0
  4. package/dist/index-internal.d.ts +20 -0
  5. package/dist/sp-diagnostics_none_1b5b73722b91f3231f63.js +1 -0
  6. package/dist/tsdoc-metadata.json +1 -1
  7. package/lib-commonjs/Api/Engagement/EngagementLogger.js +91 -96
  8. package/lib-commonjs/Api/Engagement/IEngagementHandler.js +9 -3
  9. package/lib-commonjs/Api/ExecutionQueue.js +73 -86
  10. package/lib-commonjs/Api/ILogData.js +6 -3
  11. package/lib-commonjs/Api/ILogEntry.js +5 -2
  12. package/lib-commonjs/Api/ILogErrorData.js +6 -3
  13. package/lib-commonjs/Api/ILogSource.js +10 -3
  14. package/lib-commonjs/Api/ILogVerboseData.js +6 -3
  15. package/lib-commonjs/Api/Log/LogHandler.js +27 -26
  16. package/lib-commonjs/Api/LogEntry.js +40 -39
  17. package/lib-commonjs/Api/LogFeature.js +14 -10
  18. package/lib-commonjs/Api/LogLevel.js +22 -19
  19. package/lib-commonjs/Api/LogManager/CircularBuffer.js +56 -64
  20. package/lib-commonjs/Api/LogManager/LogManager.js +61 -78
  21. package/lib-commonjs/Api/LogSource.js +37 -35
  22. package/lib-commonjs/Api/LogType.js +20 -15
  23. package/lib-commonjs/Api/Qos/AutoAlertableQosMonitor.js +68 -82
  24. package/lib-commonjs/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +5 -2
  25. package/lib-commonjs/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +5 -2
  26. package/lib-commonjs/Api/Qos/IQos.js +5 -2
  27. package/lib-commonjs/Api/Qos/IQosEndEvent.js +5 -2
  28. package/lib-commonjs/Api/Qos/IQosExtraData.js +15 -3
  29. package/lib-commonjs/Api/Qos/IQosStartEvent.js +9 -3
  30. package/lib-commonjs/Api/Qos/QosLogger.js +54 -60
  31. package/lib-commonjs/Api/Qos/QosMonitor.js +163 -209
  32. package/lib-commonjs/Api/Qos/QosMonitorShareFailureWithCP.js +72 -92
  33. package/lib-commonjs/Api/Qos/QosResultType.js +14 -7
  34. package/lib-commonjs/Api/Trace/DefaultTraceHandler.js +20 -22
  35. package/lib-commonjs/Api/Trace/ITraceHandler.js +9 -3
  36. package/lib-commonjs/Api/Trace/ITraceLogger.js +5 -2
  37. package/lib-commonjs/Api/Trace/LogEvent.js +86 -125
  38. package/lib-commonjs/Api/Trace/TraceLogger.js +149 -161
  39. package/lib-commonjs/Diagnostics.js +57 -72
  40. package/lib-commonjs/DiagnosticsSettingsManager.js +37 -43
  41. package/lib-commonjs/IDiagnosticsSettings.js +5 -2
  42. package/lib-commonjs/common/Killswitches.js +13 -9
  43. package/lib-commonjs/extraData/DisplayApp.js +13 -5
  44. package/lib-commonjs/extraData/IDiagnosticContextInfo.js +5 -2
  45. package/lib-commonjs/extraData/IPageExtraData.js +5 -2
  46. package/lib-commonjs/extraData/PageType.js +15 -8
  47. package/lib-commonjs/extraData/PromotedState.js +18 -13
  48. package/lib-commonjs/extraData/WebTemplateId.js +13 -5
  49. package/lib-commonjs/extraData/setPageExtraData.js +37 -37
  50. package/lib-commonjs/index.js +102 -50
  51. package/{lib → lib-dts}/Api/Engagement/IEngagementHandler.d.ts +2 -0
  52. package/lib-esm/Api/Engagement/EngagementLogger.js +137 -0
  53. package/lib-esm/Api/Engagement/IEngagementHandler.js +9 -0
  54. package/lib-esm/Api/ExecutionQueue.js +114 -0
  55. package/lib-esm/Api/ILogData.js +4 -0
  56. package/lib-esm/Api/ILogEntry.js +3 -0
  57. package/lib-esm/Api/ILogErrorData.js +4 -0
  58. package/lib-esm/Api/ILogSource.js +8 -0
  59. package/lib-esm/Api/ILogVerboseData.js +4 -0
  60. package/lib-esm/Api/Log/LogHandler.js +37 -0
  61. package/lib-esm/Api/LogEntry.js +44 -0
  62. package/lib-esm/Api/LogFeature.js +8 -0
  63. package/lib-esm/Api/LogLevel.js +20 -0
  64. package/lib-esm/Api/LogManager/CircularBuffer.js +83 -0
  65. package/lib-esm/Api/LogManager/LogManager.js +103 -0
  66. package/lib-esm/Api/LogSource.js +32 -0
  67. package/lib-esm/Api/LogType.js +20 -0
  68. package/lib-esm/Api/Qos/AutoAlertableQosMonitor.js +74 -0
  69. package/lib-esm/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +6 -0
  70. package/lib-esm/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +6 -0
  71. package/lib-esm/Api/Qos/IQos.js +6 -0
  72. package/lib-esm/Api/Qos/IQosEndEvent.js +6 -0
  73. package/lib-esm/Api/Qos/IQosExtraData.js +12 -0
  74. package/lib-esm/Api/Qos/IQosStartEvent.js +6 -0
  75. package/lib-esm/Api/Qos/QosLogger.js +64 -0
  76. package/lib-esm/Api/Qos/QosMonitor.js +258 -0
  77. package/lib-esm/Api/Qos/QosMonitorShareFailureWithCP.js +89 -0
  78. package/lib-esm/Api/Qos/QosResultType.js +11 -0
  79. package/lib-esm/Api/Trace/DefaultTraceHandler.js +23 -0
  80. package/lib-esm/Api/Trace/ITraceHandler.js +9 -0
  81. package/lib-esm/Api/Trace/ITraceLogger.js +3 -0
  82. package/lib-esm/Api/Trace/LogEvent.js +104 -0
  83. package/lib-esm/Api/Trace/TraceLogger.js +180 -0
  84. package/lib-esm/Diagnostics.js +67 -0
  85. package/lib-esm/DiagnosticsSettingsManager.js +54 -0
  86. package/lib-esm/IDiagnosticsSettings.js +3 -0
  87. package/{lib → lib-esm}/common/Killswitches.js +3 -4
  88. package/{lib → lib-esm}/extraData/DisplayApp.js +3 -2
  89. package/lib-esm/extraData/IDiagnosticContextInfo.js +7 -0
  90. package/lib-esm/extraData/IPageExtraData.js +3 -0
  91. package/{lib → lib-esm}/extraData/PageType.js +4 -4
  92. package/lib-esm/extraData/PromotedState.js +15 -0
  93. package/{lib → lib-esm}/extraData/WebTemplateId.js +3 -2
  94. package/{lib → lib-esm}/extraData/setPageExtraData.js +14 -20
  95. package/{lib → lib-esm}/index.js +3 -3
  96. package/package.json +33 -6
  97. package/dist/sp-diagnostics_none_e7447a590b1864b48fbc.js +0 -1
  98. package/lib/Api/Engagement/EngagementLogger.d.ts.map +0 -1
  99. package/lib/Api/Engagement/EngagementLogger.js +0 -143
  100. package/lib/Api/Engagement/IEngagementHandler.d.ts.map +0 -1
  101. package/lib/Api/Engagement/IEngagementHandler.js +0 -2
  102. package/lib/Api/ExecutionQueue.d.ts.map +0 -1
  103. package/lib/Api/ExecutionQueue.js +0 -131
  104. package/lib/Api/ILogData.d.ts.map +0 -1
  105. package/lib/Api/ILogData.js +0 -3
  106. package/lib/Api/ILogEntry.d.ts.map +0 -1
  107. package/lib/Api/ILogEntry.js +0 -2
  108. package/lib/Api/ILogErrorData.d.ts.map +0 -1
  109. package/lib/Api/ILogErrorData.js +0 -3
  110. package/lib/Api/ILogSource.d.ts.map +0 -1
  111. package/lib/Api/ILogSource.js +0 -3
  112. package/lib/Api/ILogVerboseData.d.ts.map +0 -1
  113. package/lib/Api/ILogVerboseData.js +0 -3
  114. package/lib/Api/Log/LogHandler.d.ts.map +0 -1
  115. package/lib/Api/Log/LogHandler.js +0 -40
  116. package/lib/Api/LogEntry.d.ts.map +0 -1
  117. package/lib/Api/LogEntry.js +0 -51
  118. package/lib/Api/LogFeature.d.ts.map +0 -1
  119. package/lib/Api/LogFeature.js +0 -11
  120. package/lib/Api/LogLevel.d.ts.map +0 -1
  121. package/lib/Api/LogLevel.js +0 -24
  122. package/lib/Api/LogManager/CircularBuffer.d.ts.map +0 -1
  123. package/lib/Api/LogManager/CircularBuffer.js +0 -98
  124. package/lib/Api/LogManager/LogManager.d.ts.map +0 -1
  125. package/lib/Api/LogManager/LogManager.js +0 -121
  126. package/lib/Api/LogSource.d.ts.map +0 -1
  127. package/lib/Api/LogSource.js +0 -40
  128. package/lib/Api/LogType.d.ts.map +0 -1
  129. package/lib/Api/LogType.js +0 -23
  130. package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts.map +0 -1
  131. package/lib/Api/Qos/AutoAlertableQosMonitor.js +0 -93
  132. package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts.map +0 -1
  133. package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +0 -2
  134. package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts.map +0 -1
  135. package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +0 -2
  136. package/lib/Api/Qos/IQos.d.ts.map +0 -1
  137. package/lib/Api/Qos/IQos.js +0 -2
  138. package/lib/Api/Qos/IQosEndEvent.d.ts.map +0 -1
  139. package/lib/Api/Qos/IQosEndEvent.js +0 -2
  140. package/lib/Api/Qos/IQosExtraData.d.ts.map +0 -1
  141. package/lib/Api/Qos/IQosExtraData.js +0 -2
  142. package/lib/Api/Qos/IQosStartEvent.d.ts.map +0 -1
  143. package/lib/Api/Qos/IQosStartEvent.js +0 -2
  144. package/lib/Api/Qos/QosLogger.d.ts.map +0 -1
  145. package/lib/Api/Qos/QosLogger.js +0 -74
  146. package/lib/Api/Qos/QosMonitor.d.ts.map +0 -1
  147. package/lib/Api/Qos/QosMonitor.js +0 -304
  148. package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts.map +0 -1
  149. package/lib/Api/Qos/QosMonitorShareFailureWithCP.js +0 -114
  150. package/lib/Api/Qos/QosResultType.d.ts.map +0 -1
  151. package/lib/Api/Qos/QosResultType.js +0 -11
  152. package/lib/Api/Trace/DefaultTraceHandler.d.ts.map +0 -1
  153. package/lib/Api/Trace/DefaultTraceHandler.js +0 -30
  154. package/lib/Api/Trace/ITraceHandler.d.ts.map +0 -1
  155. package/lib/Api/Trace/ITraceHandler.js +0 -2
  156. package/lib/Api/Trace/ITraceLogger.d.ts.map +0 -1
  157. package/lib/Api/Trace/ITraceLogger.js +0 -2
  158. package/lib/Api/Trace/LogEvent.d.ts.map +0 -1
  159. package/lib/Api/Trace/LogEvent.js +0 -147
  160. package/lib/Api/Trace/TraceLogger.d.ts.map +0 -1
  161. package/lib/Api/Trace/TraceLogger.js +0 -196
  162. package/lib/Diagnostics.d.ts.map +0 -1
  163. package/lib/Diagnostics.js +0 -82
  164. package/lib/DiagnosticsSettingsManager.d.ts.map +0 -1
  165. package/lib/DiagnosticsSettingsManager.js +0 -62
  166. package/lib/IDiagnosticsSettings.d.ts.map +0 -1
  167. package/lib/IDiagnosticsSettings.js +0 -2
  168. package/lib/common/Killswitches.d.ts.map +0 -1
  169. package/lib/extraData/DisplayApp.d.ts.map +0 -1
  170. package/lib/extraData/IDiagnosticContextInfo.d.ts.map +0 -1
  171. package/lib/extraData/IDiagnosticContextInfo.js +0 -2
  172. package/lib/extraData/IPageExtraData.d.ts.map +0 -1
  173. package/lib/extraData/IPageExtraData.js +0 -2
  174. package/lib/extraData/PageType.d.ts.map +0 -1
  175. package/lib/extraData/PromotedState.d.ts.map +0 -1
  176. package/lib/extraData/PromotedState.js +0 -17
  177. package/lib/extraData/WebTemplateId.d.ts.map +0 -1
  178. package/lib/extraData/setPageExtraData.d.ts.map +0 -1
  179. package/lib/index.d.ts.map +0 -1
  180. /package/{lib → lib-dts}/Api/Engagement/EngagementLogger.d.ts +0 -0
  181. /package/{lib → lib-dts}/Api/ExecutionQueue.d.ts +0 -0
  182. /package/{lib → lib-dts}/Api/ILogData.d.ts +0 -0
  183. /package/{lib → lib-dts}/Api/ILogEntry.d.ts +0 -0
  184. /package/{lib → lib-dts}/Api/ILogErrorData.d.ts +0 -0
  185. /package/{lib → lib-dts}/Api/ILogSource.d.ts +0 -0
  186. /package/{lib → lib-dts}/Api/ILogVerboseData.d.ts +0 -0
  187. /package/{lib → lib-dts}/Api/Log/LogHandler.d.ts +0 -0
  188. /package/{lib → lib-dts}/Api/LogEntry.d.ts +0 -0
  189. /package/{lib → lib-dts}/Api/LogFeature.d.ts +0 -0
  190. /package/{lib → lib-dts}/Api/LogLevel.d.ts +0 -0
  191. /package/{lib → lib-dts}/Api/LogManager/CircularBuffer.d.ts +0 -0
  192. /package/{lib → lib-dts}/Api/LogManager/LogManager.d.ts +0 -0
  193. /package/{lib → lib-dts}/Api/LogSource.d.ts +0 -0
  194. /package/{lib → lib-dts}/Api/LogType.d.ts +0 -0
  195. /package/{lib → lib-dts}/Api/Qos/AutoAlertableQosMonitor.d.ts +0 -0
  196. /package/{lib → lib-dts}/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts +0 -0
  197. /package/{lib → lib-dts}/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts +0 -0
  198. /package/{lib → lib-dts}/Api/Qos/IQos.d.ts +0 -0
  199. /package/{lib → lib-dts}/Api/Qos/IQosEndEvent.d.ts +0 -0
  200. /package/{lib → lib-dts}/Api/Qos/IQosExtraData.d.ts +0 -0
  201. /package/{lib → lib-dts}/Api/Qos/IQosStartEvent.d.ts +0 -0
  202. /package/{lib → lib-dts}/Api/Qos/QosLogger.d.ts +0 -0
  203. /package/{lib → lib-dts}/Api/Qos/QosMonitor.d.ts +0 -0
  204. /package/{lib → lib-dts}/Api/Qos/QosMonitorShareFailureWithCP.d.ts +0 -0
  205. /package/{lib → lib-dts}/Api/Qos/QosResultType.d.ts +0 -0
  206. /package/{lib → lib-dts}/Api/Trace/DefaultTraceHandler.d.ts +0 -0
  207. /package/{lib → lib-dts}/Api/Trace/ITraceHandler.d.ts +0 -0
  208. /package/{lib → lib-dts}/Api/Trace/ITraceLogger.d.ts +0 -0
  209. /package/{lib → lib-dts}/Api/Trace/LogEvent.d.ts +0 -0
  210. /package/{lib → lib-dts}/Api/Trace/TraceLogger.d.ts +0 -0
  211. /package/{lib → lib-dts}/Diagnostics.d.ts +0 -0
  212. /package/{lib → lib-dts}/DiagnosticsSettingsManager.d.ts +0 -0
  213. /package/{lib → lib-dts}/IDiagnosticsSettings.d.ts +0 -0
  214. /package/{lib → lib-dts}/common/Killswitches.d.ts +0 -0
  215. /package/{lib → lib-dts}/extraData/DisplayApp.d.ts +0 -0
  216. /package/{lib → lib-dts}/extraData/IDiagnosticContextInfo.d.ts +0 -0
  217. /package/{lib → lib-dts}/extraData/IPageExtraData.d.ts +0 -0
  218. /package/{lib → lib-dts}/extraData/PageType.d.ts +0 -0
  219. /package/{lib → lib-dts}/extraData/PromotedState.d.ts +0 -0
  220. /package/{lib → lib-dts}/extraData/WebTemplateId.d.ts +0 -0
  221. /package/{lib → lib-dts}/extraData/setPageExtraData.d.ts +0 -0
  222. /package/{lib → lib-dts}/index.d.ts +0 -0
  223. /package/{lib → lib-esm}/sp-diagnostics.manifest.json +0 -0
@@ -1,165 +1,87 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var sp_core_library_1 = require("@microsoft/sp-core-library");
5
- // Copyright (c) Microsoft. All rights reserved.
6
- var sp_core_library_2 = require("@microsoft/sp-core-library");
7
- var odsp_core_bundle_1 = require("@msinternal/odsp-core-bundle");
8
- var TraceLogger_1 = tslib_1.__importDefault(require("../Trace/TraceLogger"));
9
- var QosResultType_1 = require("./QosResultType");
10
- var QosLogger_1 = tslib_1.__importDefault(require("./QosLogger"));
11
- var EngagementLogger_1 = tslib_1.__importDefault(require("../Engagement/EngagementLogger"));
12
- var Diagnostics_1 = tslib_1.__importDefault(require("../../Diagnostics"));
13
- var DiagnosticsSettingsManager_1 = tslib_1.__importDefault(require("../../DiagnosticsSettingsManager"));
14
- var sp_lodash_subset_1 = require("@microsoft/sp-lodash-subset");
15
- var LOG_SOURCE = {
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return QosMonitor;
9
+ }
10
+ });
11
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
+ const _spcorelibrary = require("@microsoft/sp-core-library");
13
+ const _odspcorebundle = require("@msinternal/odsp-core-bundle");
14
+ const _TraceLogger = /*#__PURE__*/ _interop_require_default._(require("../Trace/TraceLogger"));
15
+ const _QosResultType = require("./QosResultType");
16
+ const _QosLogger = /*#__PURE__*/ _interop_require_default._(require("./QosLogger"));
17
+ const _EngagementLogger = /*#__PURE__*/ _interop_require_default._(require("../Engagement/EngagementLogger"));
18
+ const _Diagnostics = /*#__PURE__*/ _interop_require_default._(require("../../Diagnostics"));
19
+ const _DiagnosticsSettingsManager = /*#__PURE__*/ _interop_require_default._(require("../../DiagnosticsSettingsManager"));
20
+ const _splodashsubset = require("@microsoft/sp-lodash-subset");
21
+ const LOG_SOURCE = {
16
22
  id: 'QosMonitor'
17
23
  };
18
- var QOS_MONISTOR_HAS_ENDED_ERROR_STRING = "QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.";
19
- var AUTHORING_SESSION_ID_KEY = 'AuthoringSessionId';
20
- var AUTHORING_OP_SEQUENCE_ID_KEY = 'AuthoringOpSequenceId';
21
- var AUTHORING_SESSION_CLIENT_COUNT = 'AuthoringSessionClientCount';
22
- /**
23
- * Qos logger
24
- * This class represents the Qos monitor APIs
25
- *
26
- * @internal
27
- */
28
- var QosMonitor = /** @class */ (function () {
29
- /**
30
- * Creates a QoS monitor (initializes it and logs the start event)
31
- * @param scenarioName - Unique name of the QoS scenario
32
- * You will see start tag: SPPages.ScenarioName.Start
33
- * @param copyToCosmos - Indicate whether this data should be used as Engagement as well, and sent to COSMOS.
34
- * @param copyToInterana - Indicate whether this data should be used as Engagement as well, and sent to Interana.
35
- */
36
- function QosMonitor(scenarioName, copyToCosmos, copyToInterana) {
37
- var _a;
38
- if (copyToCosmos === void 0) { copyToCosmos = false; }
39
- if (copyToInterana === void 0) { copyToInterana = false; }
40
- var _this = this;
41
- this._qosResultTypeValue = (_a = {},
42
- _a[QosResultType_1.QosResultType.Success] = 'Success',
43
- _a[QosResultType_1.QosResultType.Failure] = 'Failure',
44
- _a[QosResultType_1.QosResultType.ExpectedFailure] = 'ExpectedFailure',
45
- _a);
46
- this._ensureAuthoringSessionId = function () {
47
- var _a, _b, _c, _d;
48
- var authoringSessionId = (_b = (_a = DiagnosticsSettingsManager_1.default.settings) === null || _a === void 0 ? void 0 : _a.extraDiagnosticInfo) === null || _b === void 0 ? void 0 : _b.authoringSessionId;
49
- if (authoringSessionId) {
50
- _this._ensureEndExtraData();
51
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
52
- _this._endExtraData[AUTHORING_SESSION_ID_KEY] = authoringSessionId;
53
- var authoringOpSequenceId = (_d = (_c = DiagnosticsSettingsManager_1.default.settings) === null || _c === void 0 ? void 0 : _c.extraDiagnosticInfo) === null || _d === void 0 ? void 0 : _d.authoringOpSequenceId;
54
- if (authoringOpSequenceId) {
55
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
56
- _this._endExtraData[AUTHORING_OP_SEQUENCE_ID_KEY] = authoringOpSequenceId;
57
- }
58
- var authoringSessionClientCount = Diagnostics_1.default.getAuthoringSessionClientCountInfo();
59
- if (authoringSessionClientCount && _this._endExtraData) {
60
- _this._endExtraData[AUTHORING_SESSION_CLIENT_COUNT] = authoringSessionClientCount;
61
- }
62
- }
63
- };
64
- sp_core_library_2.Validate.isNonemptyString(scenarioName, 'scenarioName');
65
- this._id = sp_core_library_2.Guid.newGuid().toString();
66
- if (!this._isDebugSession()) {
67
- QosLogger_1.default.instance.startQosMonitor(this._id, { name: scenarioName });
68
- }
69
- this._scenarioName = scenarioName;
70
- this._hasEnded = false;
71
- this._copyToCosmos = copyToCosmos;
72
- this._copyToInterana = copyToInterana;
73
- }
74
- QosMonitor.startRealTimeProcessing = function () {
75
- if (!QosLogger_1.default.instance.shouldProcessInRealTime) {
24
+ const QOS_MONISTOR_HAS_ENDED_ERROR_STRING = "QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.";
25
+ const AUTHORING_SESSION_ID_KEY = 'AuthoringSessionId';
26
+ const AUTHORING_OP_SEQUENCE_ID_KEY = 'AuthoringOpSequenceId';
27
+ const AUTHORING_SESSION_CLIENT_COUNT = 'AuthoringSessionClientCount';
28
+ class QosMonitor {
29
+ static startRealTimeProcessing() {
30
+ if (!_QosLogger.default.instance.shouldProcessInRealTime) {
76
31
  this._shouldProcessInRealTime(true);
77
32
  }
78
- };
33
+ }
79
34
  /**
80
- * Only used in unit tests
81
- * @internal
82
- */
83
- QosMonitor._shouldProcessInRealTime = function (processInRealTime) {
84
- QosLogger_1.default.instance.shouldProcessInRealTime = processInRealTime;
85
- };
86
- Object.defineProperty(QosMonitor.prototype, "name", {
87
- get: function () {
88
- return this._scenarioName;
89
- },
90
- enumerable: false,
91
- configurable: true
92
- });
93
- Object.defineProperty(QosMonitor.prototype, "shortEventName", {
94
- get: function () {
95
- return 'Qos';
96
- },
97
- enumerable: false,
98
- configurable: true
99
- });
100
- Object.defineProperty(QosMonitor.prototype, "resultCode", {
101
- get: function () {
102
- return this._endResultCode;
103
- },
104
- enumerable: false,
105
- configurable: true
106
- });
107
- Object.defineProperty(QosMonitor.prototype, "resultType", {
108
- get: function () {
109
- return this._endResult;
110
- },
111
- enumerable: false,
112
- configurable: true
113
- });
114
- Object.defineProperty(QosMonitor.prototype, "extraData", {
115
- get: function () {
116
- return this._endExtraData;
117
- },
118
- set: function (value) {
119
- this._endExtraData = value;
120
- },
121
- enumerable: false,
122
- configurable: true
123
- });
124
- Object.defineProperty(QosMonitor.prototype, "hasEnded", {
125
- get: function () {
126
- return this._hasEnded;
127
- },
128
- enumerable: false,
129
- configurable: true
130
- });
35
+ * Only used in unit tests
36
+ * @internal
37
+ */ static _shouldProcessInRealTime(processInRealTime) {
38
+ _QosLogger.default.instance.shouldProcessInRealTime = processInRealTime;
39
+ }
40
+ get name() {
41
+ return this._scenarioName;
42
+ }
43
+ get shortEventName() {
44
+ return 'Qos';
45
+ }
46
+ get resultCode() {
47
+ return this._endResultCode;
48
+ }
49
+ get resultType() {
50
+ return this._endResult;
51
+ }
52
+ get extraData() {
53
+ return this._endExtraData;
54
+ }
55
+ set extraData(value) {
56
+ this._endExtraData = value;
57
+ }
58
+ get hasEnded() {
59
+ return this._hasEnded;
60
+ }
131
61
  /**
132
- * QoS monitor ends with success
133
- * You will see success tag: SPPages.ScenarioName.Success
134
- */
135
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
- QosMonitor.prototype.writeSuccess = function (extraData) {
137
- this._writeQosEnd(QosResultType_1.QosResultType.Success, undefined, undefined, extraData);
138
- };
62
+ * QoS monitor ends with success
63
+ * You will see success tag: SPPages.ScenarioName.Success
64
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
+ writeSuccess(extraData) {
66
+ this._writeQosEnd(_QosResultType.QosResultType.Success, undefined, undefined, extraData);
67
+ }
139
68
  /**
140
- * QoS monitor ends with failure
141
- * You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
142
- * <failuretag> will be filled with param tagName
143
- */
144
- QosMonitor.prototype.writeUnexpectedFailure = function (tagNameSuffix, ex,
145
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ * QoS monitor ends with failure
70
+ * You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
71
+ * <failuretag> will be filled with param tagName
72
+ */ writeUnexpectedFailure(tagNameSuffix = 'DefaultUnexpected', ex, // eslint-disable-next-line @typescript-eslint/no-explicit-any
146
73
  extraData) {
147
- if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultUnexpected'; }
148
- this._writeQosEnd(QosResultType_1.QosResultType.Failure, tagNameSuffix, ex, extraData);
149
- };
74
+ this._writeQosEnd(_QosResultType.QosResultType.Failure, tagNameSuffix, ex, extraData);
75
+ }
150
76
  /*
151
- * QoS monitor ends with expected failure
152
- * You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
153
- * <failuretag> will be filled with param tagName
154
- */
155
- QosMonitor.prototype.writeExpectedFailure = function (tagNameSuffix, ex,
156
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ * QoS monitor ends with expected failure
78
+ * You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
79
+ * <failuretag> will be filled with param tagName
80
+ */ writeExpectedFailure(tagNameSuffix = 'DefaultExpected', ex, // eslint-disable-next-line @typescript-eslint/no-explicit-any
157
81
  extraData) {
158
- if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultExpected'; }
159
- this._writeQosEnd(QosResultType_1.QosResultType.ExpectedFailure, tagNameSuffix, ex, extraData);
160
- };
161
- QosMonitor.prototype._writeQosEnd = function (resultType, tagNameSuffix, ex,
162
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
+ this._writeQosEnd(_QosResultType.QosResultType.ExpectedFailure, tagNameSuffix, ex, extraData);
83
+ }
84
+ _writeQosEnd(resultType, tagNameSuffix, ex, // eslint-disable-next-line @typescript-eslint/no-explicit-any
163
85
  extraData) {
164
86
  if (this._shouldSkip(resultType)) {
165
87
  return;
@@ -167,44 +89,40 @@ var QosMonitor = /** @class */ (function () {
167
89
  this._ensureCorrelationId(resultType, extraData);
168
90
  this._endResultCode = tagNameSuffix;
169
91
  this._endResult = resultType;
170
- var errorString = !ex ? undefined : (0, odsp_core_bundle_1.getErrorMessage)(ex);
171
- if (ex instanceof odsp_core_bundle_1.CustomError) {
172
- var endSchema = (0, odsp_core_bundle_1.getQosEndSchemaFromError)(ex);
92
+ const errorString = !ex ? undefined : (0, _odspcorebundle.getErrorMessage)(ex);
93
+ if (ex instanceof _odspcorebundle.CustomError) {
94
+ const endSchema = (0, _odspcorebundle.getQosEndSchemaFromError)(ex);
173
95
  if (endSchema) {
174
96
  endSchema.resultType = this._endResult;
175
97
  // Make sure the extraData from `endSchema` takes priority so that
176
98
  // extra data like correlation id from the error object is logged
177
99
  // instead of the generic extra data from `_endExtraData`.
178
- endSchema.extraData = (0, sp_lodash_subset_1.merge)({}, this._endExtraData, endSchema.extraData);
100
+ endSchema.extraData = (0, _splodashsubset.merge)({}, this._endExtraData, endSchema.extraData);
179
101
  }
180
- QosLogger_1.default.instance.writeQosEndResult(this._id, endSchema);
181
- }
182
- else {
183
- var endData = {
102
+ _QosLogger.default.instance.writeQosEndResult(this._id, endSchema);
103
+ } else {
104
+ const endData = {
184
105
  resultCode: this._endResultCode,
185
106
  resultType: this._endResult,
186
107
  error: errorString,
187
108
  extraData: this._endExtraData
188
109
  };
189
- QosLogger_1.default.instance.writeQosEndResult(this._id, endData);
110
+ _QosLogger.default.instance.writeQosEndResult(this._id, endData);
190
111
  }
191
112
  this._writeToEngagement();
192
- };
113
+ }
193
114
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
194
- QosMonitor.prototype._ensureCorrelationId = function (resultType, extraData) {
195
- var _this = this;
115
+ _ensureCorrelationId(resultType, extraData) {
196
116
  if (extraData) {
197
117
  this._ensureEndExtraData();
198
118
  // Instead of slower ...[spread], copy over the incoming values manually
199
119
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
200
- Object.keys(extraData).forEach(function (k) { return (_this._endExtraData[k] = extraData[k]); });
120
+ Object.keys(extraData).forEach((k)=>this._endExtraData[k] = extraData[k]);
201
121
  }
202
- if (DiagnosticsSettingsManager_1.default.isInitialized && resultType !== QosResultType_1.QosResultType.Success) {
203
- var capitalKey = 'CorrelationId';
204
- var lowerKey = 'correlationId';
205
- var correlationId = ((this._endExtraData &&
206
- (this._endExtraData[capitalKey] || this._endExtraData[lowerKey])) ||
207
- DiagnosticsSettingsManager_1.default.settings.correlationId);
122
+ if (_DiagnosticsSettingsManager.default.isInitialized && resultType !== _QosResultType.QosResultType.Success) {
123
+ const capitalKey = 'CorrelationId';
124
+ const lowerKey = 'correlationId';
125
+ const correlationId = this._endExtraData && (this._endExtraData[capitalKey] || this._endExtraData[lowerKey]) || _DiagnosticsSettingsManager.default.settings.correlationId;
208
126
  if (correlationId) {
209
127
  if (!this._endExtraData) {
210
128
  this._endExtraData = {};
@@ -214,27 +132,26 @@ var QosMonitor = /** @class */ (function () {
214
132
  }
215
133
  this._logHostType();
216
134
  this._ensureAuthoringSessionId();
217
- };
218
- QosMonitor.prototype._ensureEndExtraData = function () {
135
+ }
136
+ _ensureEndExtraData() {
219
137
  if (!this._endExtraData) {
220
138
  this._endExtraData = {};
221
139
  }
222
- };
140
+ }
223
141
  /**
224
- * Logs the application hosted in Teams in combination with which Teams application it was hosted on.
225
- * Viva1p-TeamsNative: Viva home app loaded through Teams Desktop application, not including mobile
226
- * Viva1p-TeamsWeb: Viva home app loaded through Teams Web browser, not including mobile
227
- * MEEBridge-TeamsNative: VivaConnections MEEBridge app loaded through Teams mobile client.
228
- * ClassHome-TeamsNative: ClassHome app loaded through Teams Desktop application, not including mobile
229
- * ClassHome-TeamsWeb: ClassHome app loaded through Teams Web browser, not including mobile
230
- */
231
- QosMonitor.prototype._logHostType = function () {
232
- if (DiagnosticsSettingsManager_1.default.isInitialized) {
233
- var appHostType = sp_core_library_1._BrowserUtilities.getTeamsAppType();
142
+ * Logs the application hosted in Teams in combination with which Teams application it was hosted on.
143
+ * Viva1p-TeamsNative: Viva home app loaded through Teams Desktop application, not including mobile
144
+ * Viva1p-TeamsWeb: Viva home app loaded through Teams Web browser, not including mobile
145
+ * MEEBridge-TeamsNative: VivaConnections MEEBridge app loaded through Teams mobile client.
146
+ * ClassHome-TeamsNative: ClassHome app loaded through Teams Desktop application, not including mobile
147
+ * ClassHome-TeamsWeb: ClassHome app loaded through Teams Web browser, not including mobile
148
+ */ _logHostType() {
149
+ if (_DiagnosticsSettingsManager.default.isInitialized) {
150
+ const appHostType = _spcorelibrary._BrowserUtilities.getTeamsAppType();
234
151
  // Skip logging for default SPO path for now to limit quota impact
235
152
  if (appHostType) {
236
153
  this._ensureEndExtraData();
237
- var hostKey = 'appHostType';
154
+ const hostKey = 'appHostType';
238
155
  // Unlikely, but avoid overwriting matching key value
239
156
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
240
157
  if (!this._endExtraData[hostKey]) {
@@ -243,41 +160,38 @@ var QosMonitor = /** @class */ (function () {
243
160
  }
244
161
  }
245
162
  }
246
- };
247
- QosMonitor.prototype._isDebugSession = function () {
163
+ }
164
+ _isDebugSession() {
248
165
  try {
249
- if (!sp_core_library_1._SPKillSwitch.isActivated('761ccb86-4fa0-4f56-a05b-477bcc09bd9f' /* '08/01/2024', 'finnnavin: Let QoSMonitor run in debug, uploading is blocked at SDK-level.' */)) {
166
+ if (!_spcorelibrary._SPKillSwitch.isActivated('761ccb86-4fa0-4f56-a05b-477bcc09bd9f' /* '08/01/2024', 'finnnavin: Let QoSMonitor run in debug, uploading is blocked at SDK-level.' */ )) {
250
167
  return false;
168
+ } else {
169
+ return !!_spcorelibrary._BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
251
170
  }
252
- else {
253
- return !!sp_core_library_1._BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
254
- }
255
- }
256
- catch (_a) {
171
+ } catch {
257
172
  // KillSwitches throw exceptions when not initialized.
258
173
  // Currently this only happens when spfx-debug is present, so telemetry isn't being logged by the handler, and we can return false.
259
174
  return false;
260
175
  }
261
- };
262
- QosMonitor.prototype._shouldSkip = function (result) {
176
+ }
177
+ _shouldSkip(result) {
263
178
  if (this._hasEnded && this._endResult !== undefined) {
264
- var message = sp_core_library_2.Text.format(QOS_MONISTOR_HAS_ENDED_ERROR_STRING, this.name, this._qosResultTypeValue[this._endResult], this._qosResultTypeValue[result]);
179
+ const message = _spcorelibrary.Text.format(QOS_MONISTOR_HAS_ENDED_ERROR_STRING, this.name, this._qosResultTypeValue[this._endResult], this._qosResultTypeValue[result]);
265
180
  if (this._endResult !== result) {
266
- TraceLogger_1.default.logError(LOG_SOURCE, new Error(message));
181
+ _TraceLogger.default.logError(LOG_SOURCE, new Error(message));
267
182
  }
268
183
  if (DEBUG) {
269
- TraceLogger_1.default.logVerbose(LOG_SOURCE, message, 'skipEnd');
184
+ _TraceLogger.default.logVerbose(LOG_SOURCE, message, 'skipEnd');
270
185
  }
271
186
  return true;
272
- }
273
- else {
187
+ } else {
274
188
  this._hasEnded = true;
275
189
  return this._isDebugSession();
276
190
  }
277
- };
278
- QosMonitor.prototype._writeToEngagement = function () {
191
+ }
192
+ _writeToEngagement() {
279
193
  if (this._copyToInterana) {
280
- EngagementLogger_1.default.log({
194
+ _EngagementLogger.default.log({
281
195
  name: this.name,
282
196
  isIntentional: !!(this.extraData || {}).isIntentional,
283
197
  extraData: this.extraData || {}
@@ -287,7 +201,7 @@ var QosMonitor = /** @class */ (function () {
287
201
  // Engagement name requires certain format. Cannot just use QOS name.
288
202
  // Record Qos name in extra data 'qosName'
289
203
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
290
- var engagementData = {
204
+ const engagementData = {
291
205
  name: 'Spfx.Qos.ToEngagement',
292
206
  extraData: this.extraData || {}
293
207
  };
@@ -298,10 +212,50 @@ var QosMonitor = /** @class */ (function () {
298
212
  if (this.resultCode) {
299
213
  engagementData.extraData.qosResultCode = this.resultCode;
300
214
  }
301
- EngagementLogger_1.default.log(engagementData);
215
+ _EngagementLogger.default.log(engagementData);
302
216
  }
303
- };
304
- return QosMonitor;
305
- }());
306
- exports.default = QosMonitor;
307
- //# sourceMappingURL=QosMonitor.js.map
217
+ }
218
+ /**
219
+ * Creates a QoS monitor (initializes it and logs the start event)
220
+ * @param scenarioName - Unique name of the QoS scenario
221
+ * You will see start tag: SPPages.ScenarioName.Start
222
+ * @param copyToCosmos - Indicate whether this data should be used as Engagement as well, and sent to COSMOS.
223
+ * @param copyToInterana - Indicate whether this data should be used as Engagement as well, and sent to Interana.
224
+ */ constructor(scenarioName, copyToCosmos = false, copyToInterana = false){
225
+ this._qosResultTypeValue = {
226
+ [_QosResultType.QosResultType.Success]: 'Success',
227
+ [_QosResultType.QosResultType.Failure]: 'Failure',
228
+ [_QosResultType.QosResultType.ExpectedFailure]: 'ExpectedFailure'
229
+ };
230
+ this._ensureAuthoringSessionId = ()=>{
231
+ const authoringSessionId = _DiagnosticsSettingsManager.default.settings?.extraDiagnosticInfo?.authoringSessionId;
232
+ if (authoringSessionId) {
233
+ this._ensureEndExtraData();
234
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
235
+ this._endExtraData[AUTHORING_SESSION_ID_KEY] = authoringSessionId;
236
+ const authoringOpSequenceId = _DiagnosticsSettingsManager.default.settings?.extraDiagnosticInfo?.authoringOpSequenceId;
237
+ if (authoringOpSequenceId) {
238
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
239
+ this._endExtraData[AUTHORING_OP_SEQUENCE_ID_KEY] = authoringOpSequenceId;
240
+ }
241
+ const authoringSessionClientCount = _Diagnostics.default.getAuthoringSessionClientCountInfo();
242
+ if (authoringSessionClientCount && this._endExtraData) {
243
+ this._endExtraData[AUTHORING_SESSION_CLIENT_COUNT] = authoringSessionClientCount;
244
+ }
245
+ }
246
+ };
247
+ _spcorelibrary.Validate.isNonemptyString(scenarioName, 'scenarioName');
248
+ this._id = _spcorelibrary.Guid.newGuid().toString();
249
+ if (!this._isDebugSession()) {
250
+ _QosLogger.default.instance.startQosMonitor(this._id, {
251
+ name: scenarioName
252
+ });
253
+ }
254
+ this._scenarioName = scenarioName;
255
+ this._hasEnded = false;
256
+ this._copyToCosmos = copyToCosmos;
257
+ this._copyToInterana = copyToInterana;
258
+ }
259
+ }
260
+
261
+ //# sourceMappingURL=./QosMonitor.js.map