@microsoft/sp-diagnostics 1.22.0-beta.2 → 1.22.0-beta.4
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/dist/78359e4b-07c2-43c6-8d0b-d060b4d577e8.manifest.json +3 -3
- package/dist/{sp-diagnostics_none_a5c0c2a17bce8b457f0d.js → sp-diagnostics_none_f723633aa801623e45a1.js} +1 -1
- package/lib/Api/Engagement/EngagementLogger.d.ts +75 -0
- package/lib/Api/Engagement/EngagementLogger.d.ts.map +1 -0
- package/lib/Api/Engagement/EngagementLogger.js +143 -0
- package/lib/Api/Engagement/IEngagementHandler.d.ts +87 -0
- package/lib/Api/Engagement/IEngagementHandler.d.ts.map +1 -0
- package/lib/Api/Engagement/IEngagementHandler.js +2 -0
- package/lib/Api/ExecutionQueue.d.ts +55 -0
- package/lib/Api/ExecutionQueue.d.ts.map +1 -0
- package/lib/Api/ExecutionQueue.js +133 -0
- package/lib/Api/ILogData.d.ts +36 -0
- package/lib/Api/ILogData.d.ts.map +1 -0
- package/lib/Api/ILogData.js +3 -0
- package/lib/Api/ILogEntry.d.ts +29 -0
- package/lib/Api/ILogEntry.d.ts.map +1 -0
- package/lib/Api/ILogEntry.js +2 -0
- package/lib/Api/ILogErrorData.d.ts +21 -0
- package/lib/Api/ILogErrorData.d.ts.map +1 -0
- package/lib/Api/ILogErrorData.js +3 -0
- package/lib/Api/ILogSource.d.ts +10 -0
- package/lib/Api/ILogSource.d.ts.map +1 -0
- package/lib/Api/ILogSource.js +3 -0
- package/lib/Api/ILogVerboseData.d.ts +12 -0
- package/lib/Api/ILogVerboseData.d.ts.map +1 -0
- package/lib/Api/ILogVerboseData.js +3 -0
- package/lib/Api/Log/LogHandler.d.ts +12 -0
- package/lib/Api/Log/LogHandler.d.ts.map +1 -0
- package/lib/Api/Log/LogHandler.js +41 -0
- package/lib/Api/LogEntry.d.ts +29 -0
- package/lib/Api/LogEntry.d.ts.map +1 -0
- package/lib/Api/LogEntry.js +51 -0
- package/lib/Api/LogFeature.d.ts +7 -0
- package/lib/Api/LogFeature.d.ts.map +1 -0
- package/lib/Api/LogFeature.js +11 -0
- package/lib/Api/LogLevel.d.ts +23 -0
- package/lib/Api/LogLevel.d.ts.map +1 -0
- package/lib/Api/LogLevel.js +24 -0
- package/lib/Api/LogManager/CircularBuffer.d.ts +36 -0
- package/lib/Api/LogManager/CircularBuffer.d.ts.map +1 -0
- package/lib/Api/LogManager/CircularBuffer.js +98 -0
- package/lib/Api/LogManager/LogManager.d.ts +47 -0
- package/lib/Api/LogManager/LogManager.d.ts.map +1 -0
- package/lib/Api/LogManager/LogManager.js +121 -0
- package/lib/Api/LogSource.d.ts +24 -0
- package/lib/Api/LogSource.d.ts.map +1 -0
- package/lib/Api/LogSource.js +40 -0
- package/lib/Api/LogType.d.ts +21 -0
- package/lib/Api/LogType.d.ts.map +1 -0
- package/lib/Api/LogType.js +23 -0
- package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts +72 -0
- package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts.map +1 -0
- package/lib/Api/Qos/AutoAlertableQosMonitor.js +93 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts +39 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts.map +1 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +2 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts +12 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts.map +1 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +2 -0
- package/lib/Api/Qos/IQos.d.ts +17 -0
- package/lib/Api/Qos/IQos.d.ts.map +1 -0
- package/lib/Api/Qos/IQos.js +2 -0
- package/lib/Api/Qos/IQosEndEvent.d.ts +13 -0
- package/lib/Api/Qos/IQosEndEvent.d.ts.map +1 -0
- package/lib/Api/Qos/IQosEndEvent.js +2 -0
- package/lib/Api/Qos/IQosExtraData.d.ts +50 -0
- package/lib/Api/Qos/IQosExtraData.d.ts.map +1 -0
- package/lib/Api/Qos/IQosExtraData.js +2 -0
- package/lib/Api/Qos/IQosStartEvent.d.ts +8 -0
- package/lib/Api/Qos/IQosStartEvent.d.ts.map +1 -0
- package/lib/Api/Qos/IQosStartEvent.js +2 -0
- package/lib/Api/Qos/QosLogger.d.ts +27 -0
- package/lib/Api/Qos/QosLogger.d.ts.map +1 -0
- package/lib/Api/Qos/QosLogger.js +74 -0
- package/lib/Api/Qos/QosMonitor.d.ts +74 -0
- package/lib/Api/Qos/QosMonitor.d.ts.map +1 -0
- package/lib/Api/Qos/QosMonitor.js +304 -0
- package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts +50 -0
- package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts.map +1 -0
- package/lib/Api/Qos/QosMonitorShareFailureWithCP.js +114 -0
- package/lib/Api/Qos/QosResultType.d.ts +15 -0
- package/lib/Api/Qos/QosResultType.d.ts.map +1 -0
- package/lib/Api/Qos/QosResultType.js +11 -0
- package/lib/Api/Trace/DefaultTraceHandler.d.ts +15 -0
- package/lib/Api/Trace/DefaultTraceHandler.d.ts.map +1 -0
- package/lib/Api/Trace/DefaultTraceHandler.js +30 -0
- package/lib/Api/Trace/ITraceHandler.d.ts +29 -0
- package/lib/Api/Trace/ITraceHandler.d.ts.map +1 -0
- package/lib/Api/Trace/ITraceHandler.js +2 -0
- package/lib/Api/Trace/ITraceLogger.d.ts +13 -0
- package/lib/Api/Trace/ITraceLogger.d.ts.map +1 -0
- package/lib/Api/Trace/ITraceLogger.js +2 -0
- package/lib/Api/Trace/LogEvent.d.ts +49 -0
- package/lib/Api/Trace/LogEvent.d.ts.map +1 -0
- package/lib/Api/Trace/LogEvent.js +147 -0
- package/lib/Api/Trace/TraceLogger.d.ts +102 -0
- package/lib/Api/Trace/TraceLogger.d.ts.map +1 -0
- package/lib/Api/Trace/TraceLogger.js +197 -0
- package/lib/Diagnostics.d.ts +47 -0
- package/lib/Diagnostics.d.ts.map +1 -0
- package/lib/Diagnostics.js +82 -0
- package/lib/DiagnosticsSettingsManager.d.ts +19 -0
- package/lib/DiagnosticsSettingsManager.d.ts.map +1 -0
- package/lib/DiagnosticsSettingsManager.js +62 -0
- package/lib/IDiagnosticsSettings.d.ts +87 -0
- package/lib/IDiagnosticsSettings.d.ts.map +1 -0
- package/lib/IDiagnosticsSettings.js +2 -0
- package/lib/common/Killswitches.d.ts +3 -0
- package/lib/common/Killswitches.d.ts.map +1 -0
- package/lib/common/Killswitches.js +14 -0
- package/lib/extraData/DisplayApp.d.ts +6 -0
- package/lib/extraData/DisplayApp.d.ts.map +1 -0
- package/lib/extraData/DisplayApp.js +6 -0
- package/lib/extraData/IDiagnosticContextInfo.d.ts +18 -0
- package/lib/extraData/IDiagnosticContextInfo.d.ts.map +1 -0
- package/lib/extraData/IDiagnosticContextInfo.js +2 -0
- package/lib/extraData/IPageExtraData.d.ts +16 -0
- package/lib/extraData/IPageExtraData.d.ts.map +1 -0
- package/lib/extraData/IPageExtraData.js +2 -0
- package/lib/extraData/PageType.d.ts +13 -0
- package/lib/extraData/PageType.d.ts.map +1 -0
- package/lib/extraData/PageType.js +16 -0
- package/lib/extraData/PromotedState.d.ts +16 -0
- package/lib/extraData/PromotedState.d.ts.map +1 -0
- package/lib/extraData/PromotedState.js +17 -0
- package/lib/extraData/WebTemplateId.d.ts +8 -0
- package/lib/extraData/WebTemplateId.d.ts.map +1 -0
- package/lib/extraData/WebTemplateId.js +10 -0
- package/lib/extraData/setPageExtraData.d.ts +5 -0
- package/lib/extraData/setPageExtraData.d.ts.map +1 -0
- package/lib/extraData/setPageExtraData.js +66 -0
- package/lib/index.d.ts +42 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +27 -0
- package/lib/sp-diagnostics.manifest.json +8 -0
- package/lib-commonjs/common/Killswitches.js +8 -1
- package/lib-commonjs/extraData/setPageExtraData.js +4 -0
- package/package.json +6 -6
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IQos } from './IQos';
|
|
2
|
+
import type { IQosStartEvent } from './IQosStartEvent';
|
|
3
|
+
import type { IQosEndSchema } from '@msinternal/odsp-core-bundle';
|
|
4
|
+
export type QosConstructor = new (event: IQosStartEvent) => IQos;
|
|
5
|
+
/**
|
|
6
|
+
* QosLogger allows multiple QosMonitors to be deferred processed.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export default class QosLogger {
|
|
10
|
+
private static _instance;
|
|
11
|
+
private _qosEvents;
|
|
12
|
+
private _deferExecutor;
|
|
13
|
+
private _shouldProcessInRealTime;
|
|
14
|
+
private _qosLogger;
|
|
15
|
+
static get instance(): QosLogger;
|
|
16
|
+
constructor();
|
|
17
|
+
get shouldProcessInRealTime(): boolean;
|
|
18
|
+
set shouldProcessInRealTime(processInRealTime: boolean);
|
|
19
|
+
setLogger(qosLogger: new (event: IQosStartEvent) => IQos): void;
|
|
20
|
+
getQosEvent(key: string): IQos | undefined;
|
|
21
|
+
startQosMonitor(key: string, startData: IQosStartEvent): void;
|
|
22
|
+
writeQosEndResult(key: string, endData: IQosEndSchema): void;
|
|
23
|
+
private _startMonitor;
|
|
24
|
+
private _endMonitor;
|
|
25
|
+
private _initializeLogger;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=QosLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QosLogger.d.ts","sourceRoot":"","sources":["../../../src/Api/Qos/QosLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,KAAK,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAY;IAEpC,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,cAAc,CAAwC;IAC9D,OAAO,CAAC,wBAAwB,CAAkB;IAClD,OAAO,CAAC,UAAU,CAA6B;IAE/C,WAAkB,QAAQ,IAAI,SAAS,CAMtC;;IAMD,IAAW,uBAAuB,IAAI,OAAO,CAE5C;IAED,IAAW,uBAAuB,CAAC,iBAAiB,EAAE,OAAO,EAG5D;IAEM,SAAS,CAAC,SAAS,EAAE,KAAK,KAAK,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;IAI/D,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAI1C,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,IAAI;IAM7D,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAInE,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,iBAAiB;CAU1B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import ExecutionQueue from '../ExecutionQueue';
|
|
2
|
+
/**
|
|
3
|
+
* QosLogger allows multiple QosMonitors to be deferred processed.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
var QosLogger = /** @class */ (function () {
|
|
7
|
+
function QosLogger() {
|
|
8
|
+
this._qosEvents = new Map();
|
|
9
|
+
this._deferExecutor = new ExecutionQueue();
|
|
10
|
+
this._shouldProcessInRealTime = false;
|
|
11
|
+
this._initializeLogger();
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(QosLogger, "instance", {
|
|
14
|
+
get: function () {
|
|
15
|
+
if (!this._instance) {
|
|
16
|
+
this._instance = new QosLogger();
|
|
17
|
+
}
|
|
18
|
+
return this._instance;
|
|
19
|
+
},
|
|
20
|
+
enumerable: false,
|
|
21
|
+
configurable: true
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(QosLogger.prototype, "shouldProcessInRealTime", {
|
|
24
|
+
get: function () {
|
|
25
|
+
return this._shouldProcessInRealTime;
|
|
26
|
+
},
|
|
27
|
+
set: function (processInRealTime) {
|
|
28
|
+
this._shouldProcessInRealTime = processInRealTime;
|
|
29
|
+
this._deferExecutor.shouldExecuteInRealTime = processInRealTime;
|
|
30
|
+
},
|
|
31
|
+
enumerable: false,
|
|
32
|
+
configurable: true
|
|
33
|
+
});
|
|
34
|
+
QosLogger.prototype.setLogger = function (qosLogger) {
|
|
35
|
+
this._qosLogger = qosLogger;
|
|
36
|
+
};
|
|
37
|
+
QosLogger.prototype.getQosEvent = function (key) {
|
|
38
|
+
return this._qosEvents.get(key);
|
|
39
|
+
};
|
|
40
|
+
QosLogger.prototype.startQosMonitor = function (key, startData) {
|
|
41
|
+
if (!this._qosEvents.has(key)) {
|
|
42
|
+
this._deferExecutor.addExecutionEntry('start', key, startData);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
QosLogger.prototype.writeQosEndResult = function (key, endData) {
|
|
46
|
+
this._deferExecutor.addExecutionEntry('end', key, endData);
|
|
47
|
+
};
|
|
48
|
+
QosLogger.prototype._startMonitor = function (key, event) {
|
|
49
|
+
if (this._qosLogger) {
|
|
50
|
+
this._qosEvents.set(key, new this._qosLogger(event));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
QosLogger.prototype._endMonitor = function (key, event) {
|
|
54
|
+
var qosEvent = this._qosEvents.get(key);
|
|
55
|
+
if (qosEvent) {
|
|
56
|
+
qosEvent.end(event);
|
|
57
|
+
this._qosEvents.delete(key);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
QosLogger.prototype._initializeLogger = function () {
|
|
61
|
+
var _this = this;
|
|
62
|
+
var startHandler = (function (key, e) {
|
|
63
|
+
_this._startMonitor(key, e);
|
|
64
|
+
});
|
|
65
|
+
var endHandler = (function (key, e) {
|
|
66
|
+
_this._endMonitor(key, e);
|
|
67
|
+
});
|
|
68
|
+
this._deferExecutor.addHandler('start', startHandler);
|
|
69
|
+
this._deferExecutor.addHandler('end', endHandler);
|
|
70
|
+
};
|
|
71
|
+
return QosLogger;
|
|
72
|
+
}());
|
|
73
|
+
export default QosLogger;
|
|
74
|
+
//# sourceMappingURL=QosLogger.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { QosResultType } from './QosResultType';
|
|
2
|
+
/**
|
|
3
|
+
* Qos logger
|
|
4
|
+
* This class represents the Qos monitor APIs
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export default class QosMonitor {
|
|
9
|
+
private _id;
|
|
10
|
+
private _hasEnded;
|
|
11
|
+
private _endExtraData;
|
|
12
|
+
private _scenarioName;
|
|
13
|
+
private _endResultCode;
|
|
14
|
+
private _endResult;
|
|
15
|
+
private _copyToCosmos;
|
|
16
|
+
private _copyToInterana;
|
|
17
|
+
private _qosResultTypeValue;
|
|
18
|
+
static startRealTimeProcessing(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Only used in unit tests
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
static _shouldProcessInRealTime(processInRealTime: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a QoS monitor (initializes it and logs the start event)
|
|
26
|
+
* @param scenarioName - Unique name of the QoS scenario
|
|
27
|
+
* You will see start tag: SPPages.ScenarioName.Start
|
|
28
|
+
* @param copyToCosmos - Indicate whether this data should be used as Engagement as well, and sent to COSMOS.
|
|
29
|
+
* @param copyToInterana - Indicate whether this data should be used as Engagement as well, and sent to Interana.
|
|
30
|
+
*/
|
|
31
|
+
constructor(scenarioName: string, copyToCosmos?: boolean, copyToInterana?: boolean);
|
|
32
|
+
get name(): string;
|
|
33
|
+
get shortEventName(): string;
|
|
34
|
+
get resultCode(): string | undefined;
|
|
35
|
+
get resultType(): QosResultType | undefined;
|
|
36
|
+
get extraData(): Record<string, unknown> | undefined;
|
|
37
|
+
set extraData(value: Record<string, unknown> | undefined);
|
|
38
|
+
get hasEnded(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* QoS monitor ends with success
|
|
41
|
+
* You will see success tag: SPPages.ScenarioName.Success
|
|
42
|
+
*/
|
|
43
|
+
writeSuccess(extraData?: {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}): void;
|
|
46
|
+
/**
|
|
47
|
+
* QoS monitor ends with failure
|
|
48
|
+
* You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
|
|
49
|
+
* <failuretag> will be filled with param tagName
|
|
50
|
+
*/
|
|
51
|
+
writeUnexpectedFailure(tagNameSuffix?: string, ex?: Error, extraData?: {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
}): void;
|
|
54
|
+
writeExpectedFailure(tagNameSuffix?: string, ex?: Error, extraData?: {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}): void;
|
|
57
|
+
private _writeQosEnd;
|
|
58
|
+
private _ensureCorrelationId;
|
|
59
|
+
private _ensureAuthoringSessionId;
|
|
60
|
+
private _ensureEndExtraData;
|
|
61
|
+
/**
|
|
62
|
+
* Logs the application hosted in Teams in combination with which Teams application it was hosted on.
|
|
63
|
+
* Viva1p-TeamsNative: Viva home app loaded through Teams Desktop application, not including mobile
|
|
64
|
+
* Viva1p-TeamsWeb: Viva home app loaded through Teams Web browser, not including mobile
|
|
65
|
+
* MEEBridge-TeamsNative: VivaConnections MEEBridge app loaded through Teams mobile client.
|
|
66
|
+
* ClassHome-TeamsNative: ClassHome app loaded through Teams Desktop application, not including mobile
|
|
67
|
+
* ClassHome-TeamsWeb: ClassHome app loaded through Teams Web browser, not including mobile
|
|
68
|
+
*/
|
|
69
|
+
private _logHostType;
|
|
70
|
+
private _isDebugSession;
|
|
71
|
+
private _shouldSkip;
|
|
72
|
+
private _writeToEngagement;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=QosMonitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QosMonitor.d.ts","sourceRoot":"","sources":["../../../src/Api/Qos/QosMonitor.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAkBhD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,aAAa,CAAsC;IAC3D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,mBAAmB,CAIzB;WAEY,uBAAuB,IAAI,IAAI;IAM7C;;;OAGG;WACW,wBAAwB,CAAC,iBAAiB,EAAE,OAAO,GAAG,IAAI;IAIxE;;;;;;OAMG;gBACgB,YAAY,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe,EAAE,cAAc,GAAE,OAAe;IAevG,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,cAAc,IAAI,MAAM,CAElC;IAED,IAAW,UAAU,IAAI,MAAM,GAAG,SAAS,CAE1C;IAED,IAAW,UAAU,IAAI,aAAa,GAAG,SAAS,CAEjD;IAED,IAAW,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAE1D;IAED,IAAW,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAE9D;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED;;;OAGG;IAEI,YAAY,CAAC,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,IAAI;IAI7D;;;;OAIG;IACI,sBAAsB,CAC3B,aAAa,GAAE,MAA4B,EAC3C,EAAE,CAAC,EAAE,KAAK,EAEV,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GACjC,IAAI;IASA,oBAAoB,CACzB,aAAa,GAAE,MAA0B,EACzC,EAAE,CAAC,EAAE,KAAK,EAEV,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GACjC,IAAI;IAIP,OAAO,CAAC,YAAY;IAyCpB,OAAO,CAAC,oBAAoB;IA4B5B,OAAO,CAAC,yBAAyB,CAuB/B;IAEF,OAAO,CAAC,mBAAmB;IAM3B;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,kBAAkB;CA4B3B"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { _BrowserUtilities, _SPKillSwitch } from '@microsoft/sp-core-library';
|
|
2
|
+
// Copyright (c) Microsoft. All rights reserved.
|
|
3
|
+
import { Guid, Text, Validate } from '@microsoft/sp-core-library';
|
|
4
|
+
import { getErrorMessage, getQosEndSchemaFromError, CustomError } from '@msinternal/odsp-core-bundle';
|
|
5
|
+
import TraceLogger from '../Trace/TraceLogger';
|
|
6
|
+
import { QosResultType } from './QosResultType';
|
|
7
|
+
import QosLogger from './QosLogger';
|
|
8
|
+
import EngagementLogger from '../Engagement/EngagementLogger';
|
|
9
|
+
import Diagnostics from '../../Diagnostics';
|
|
10
|
+
import DiagnosticsSettingsManager from '../../DiagnosticsSettingsManager';
|
|
11
|
+
import { merge } from '@microsoft/sp-lodash-subset';
|
|
12
|
+
var LOG_SOURCE = {
|
|
13
|
+
id: 'QosMonitor'
|
|
14
|
+
};
|
|
15
|
+
var QOS_MONISTOR_HAS_ENDED_ERROR_STRING = "QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.";
|
|
16
|
+
var AUTHORING_SESSION_ID_KEY = 'AuthoringSessionId';
|
|
17
|
+
var AUTHORING_OP_SEQUENCE_ID_KEY = 'AuthoringOpSequenceId';
|
|
18
|
+
var AUTHORING_SESSION_CLIENT_COUNT = 'AuthoringSessionClientCount';
|
|
19
|
+
/**
|
|
20
|
+
* Qos logger
|
|
21
|
+
* This class represents the Qos monitor APIs
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
var QosMonitor = /** @class */ (function () {
|
|
26
|
+
/**
|
|
27
|
+
* Creates a QoS monitor (initializes it and logs the start event)
|
|
28
|
+
* @param scenarioName - Unique name of the QoS scenario
|
|
29
|
+
* You will see start tag: SPPages.ScenarioName.Start
|
|
30
|
+
* @param copyToCosmos - Indicate whether this data should be used as Engagement as well, and sent to COSMOS.
|
|
31
|
+
* @param copyToInterana - Indicate whether this data should be used as Engagement as well, and sent to Interana.
|
|
32
|
+
*/
|
|
33
|
+
function QosMonitor(scenarioName, copyToCosmos, copyToInterana) {
|
|
34
|
+
var _a;
|
|
35
|
+
if (copyToCosmos === void 0) { copyToCosmos = false; }
|
|
36
|
+
if (copyToInterana === void 0) { copyToInterana = false; }
|
|
37
|
+
var _this = this;
|
|
38
|
+
this._qosResultTypeValue = (_a = {},
|
|
39
|
+
_a[QosResultType.Success] = 'Success',
|
|
40
|
+
_a[QosResultType.Failure] = 'Failure',
|
|
41
|
+
_a[QosResultType.ExpectedFailure] = 'ExpectedFailure',
|
|
42
|
+
_a);
|
|
43
|
+
this._ensureAuthoringSessionId = function () {
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
|
+
var authoringSessionId = (_b = (_a = DiagnosticsSettingsManager.settings) === null || _a === void 0 ? void 0 : _a.extraDiagnosticInfo) === null || _b === void 0 ? void 0 : _b.authoringSessionId;
|
|
46
|
+
if (authoringSessionId) {
|
|
47
|
+
_this._ensureEndExtraData();
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
|
+
_this._endExtraData[AUTHORING_SESSION_ID_KEY] = authoringSessionId;
|
|
50
|
+
var authoringOpSequenceId = (_d = (_c = DiagnosticsSettingsManager.settings) === null || _c === void 0 ? void 0 : _c.extraDiagnosticInfo) === null || _d === void 0 ? void 0 : _d.authoringOpSequenceId;
|
|
51
|
+
if (authoringOpSequenceId) {
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
53
|
+
_this._endExtraData[AUTHORING_OP_SEQUENCE_ID_KEY] = authoringOpSequenceId;
|
|
54
|
+
}
|
|
55
|
+
var authoringSessionClientCount = Diagnostics.getAuthoringSessionClientCountInfo();
|
|
56
|
+
if (authoringSessionClientCount && _this._endExtraData) {
|
|
57
|
+
_this._endExtraData[AUTHORING_SESSION_CLIENT_COUNT] = authoringSessionClientCount;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Validate.isNonemptyString(scenarioName, 'scenarioName');
|
|
62
|
+
this._id = Guid.newGuid().toString();
|
|
63
|
+
if (!this._isDebugSession()) {
|
|
64
|
+
QosLogger.instance.startQosMonitor(this._id, { name: scenarioName });
|
|
65
|
+
}
|
|
66
|
+
this._scenarioName = scenarioName;
|
|
67
|
+
this._hasEnded = false;
|
|
68
|
+
this._copyToCosmos = copyToCosmos;
|
|
69
|
+
this._copyToInterana = copyToInterana;
|
|
70
|
+
}
|
|
71
|
+
QosMonitor.startRealTimeProcessing = function () {
|
|
72
|
+
if (!QosLogger.instance.shouldProcessInRealTime) {
|
|
73
|
+
this._shouldProcessInRealTime(true);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Only used in unit tests
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
QosMonitor._shouldProcessInRealTime = function (processInRealTime) {
|
|
81
|
+
QosLogger.instance.shouldProcessInRealTime = processInRealTime;
|
|
82
|
+
};
|
|
83
|
+
Object.defineProperty(QosMonitor.prototype, "name", {
|
|
84
|
+
get: function () {
|
|
85
|
+
return this._scenarioName;
|
|
86
|
+
},
|
|
87
|
+
enumerable: false,
|
|
88
|
+
configurable: true
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(QosMonitor.prototype, "shortEventName", {
|
|
91
|
+
get: function () {
|
|
92
|
+
return 'Qos';
|
|
93
|
+
},
|
|
94
|
+
enumerable: false,
|
|
95
|
+
configurable: true
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(QosMonitor.prototype, "resultCode", {
|
|
98
|
+
get: function () {
|
|
99
|
+
return this._endResultCode;
|
|
100
|
+
},
|
|
101
|
+
enumerable: false,
|
|
102
|
+
configurable: true
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(QosMonitor.prototype, "resultType", {
|
|
105
|
+
get: function () {
|
|
106
|
+
return this._endResult;
|
|
107
|
+
},
|
|
108
|
+
enumerable: false,
|
|
109
|
+
configurable: true
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(QosMonitor.prototype, "extraData", {
|
|
112
|
+
get: function () {
|
|
113
|
+
return this._endExtraData;
|
|
114
|
+
},
|
|
115
|
+
set: function (value) {
|
|
116
|
+
this._endExtraData = value;
|
|
117
|
+
},
|
|
118
|
+
enumerable: false,
|
|
119
|
+
configurable: true
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(QosMonitor.prototype, "hasEnded", {
|
|
122
|
+
get: function () {
|
|
123
|
+
return this._hasEnded;
|
|
124
|
+
},
|
|
125
|
+
enumerable: false,
|
|
126
|
+
configurable: true
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* QoS monitor ends with success
|
|
130
|
+
* You will see success tag: SPPages.ScenarioName.Success
|
|
131
|
+
*/
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
133
|
+
QosMonitor.prototype.writeSuccess = function (extraData) {
|
|
134
|
+
this._writeQosEnd(QosResultType.Success, undefined, undefined, extraData);
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* QoS monitor ends with failure
|
|
138
|
+
* You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
|
|
139
|
+
* <failuretag> will be filled with param tagName
|
|
140
|
+
*/
|
|
141
|
+
QosMonitor.prototype.writeUnexpectedFailure = function (tagNameSuffix, ex,
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
+
extraData) {
|
|
144
|
+
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultUnexpected'; }
|
|
145
|
+
this._writeQosEnd(QosResultType.Failure, tagNameSuffix, ex, extraData);
|
|
146
|
+
};
|
|
147
|
+
/*
|
|
148
|
+
* QoS monitor ends with expected failure
|
|
149
|
+
* You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
|
|
150
|
+
* <failuretag> will be filled with param tagName
|
|
151
|
+
*/
|
|
152
|
+
QosMonitor.prototype.writeExpectedFailure = function (tagNameSuffix, ex,
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
|
+
extraData) {
|
|
155
|
+
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultExpected'; }
|
|
156
|
+
this._writeQosEnd(QosResultType.ExpectedFailure, tagNameSuffix, ex, extraData);
|
|
157
|
+
};
|
|
158
|
+
QosMonitor.prototype._writeQosEnd = function (resultType, tagNameSuffix, ex,
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
160
|
+
extraData) {
|
|
161
|
+
if (this._shouldSkip(resultType)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this._ensureCorrelationId(resultType, extraData);
|
|
165
|
+
this._endResultCode = tagNameSuffix;
|
|
166
|
+
this._endResult = resultType;
|
|
167
|
+
var errorString = !ex ? undefined : getErrorMessage(ex);
|
|
168
|
+
if (ex instanceof CustomError) {
|
|
169
|
+
var endSchema = getQosEndSchemaFromError(ex);
|
|
170
|
+
if (endSchema) {
|
|
171
|
+
endSchema.resultType = this._endResult;
|
|
172
|
+
// Make sure the extraData from `endSchema` takes priority so that
|
|
173
|
+
// extra data like correlation id from the error object is logged
|
|
174
|
+
// instead of the generic extra data from `_endExtraData`.
|
|
175
|
+
endSchema.extraData = merge({}, this._endExtraData, endSchema.extraData);
|
|
176
|
+
}
|
|
177
|
+
QosLogger.instance.writeQosEndResult(this._id, endSchema);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
var endData = {
|
|
181
|
+
resultCode: this._endResultCode,
|
|
182
|
+
resultType: this._endResult,
|
|
183
|
+
error: errorString,
|
|
184
|
+
extraData: this._endExtraData
|
|
185
|
+
};
|
|
186
|
+
QosLogger.instance.writeQosEndResult(this._id, endData);
|
|
187
|
+
}
|
|
188
|
+
this._writeToEngagement();
|
|
189
|
+
};
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
191
|
+
QosMonitor.prototype._ensureCorrelationId = function (resultType, extraData) {
|
|
192
|
+
var _this = this;
|
|
193
|
+
if (extraData) {
|
|
194
|
+
this._ensureEndExtraData();
|
|
195
|
+
// Instead of slower ...[spread], copy over the incoming values manually
|
|
196
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
197
|
+
Object.keys(extraData).forEach(function (k) { return (_this._endExtraData[k] = extraData[k]); });
|
|
198
|
+
}
|
|
199
|
+
if (DiagnosticsSettingsManager.isInitialized && resultType !== QosResultType.Success) {
|
|
200
|
+
var capitalKey = 'CorrelationId';
|
|
201
|
+
var lowerKey = 'correlationId';
|
|
202
|
+
var correlationId = ((this._endExtraData &&
|
|
203
|
+
(this._endExtraData[capitalKey] || this._endExtraData[lowerKey])) ||
|
|
204
|
+
DiagnosticsSettingsManager.settings.correlationId);
|
|
205
|
+
if (correlationId) {
|
|
206
|
+
if (!this._endExtraData) {
|
|
207
|
+
this._endExtraData = {};
|
|
208
|
+
}
|
|
209
|
+
this._endExtraData[capitalKey] = correlationId;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
this._logHostType();
|
|
213
|
+
this._ensureAuthoringSessionId();
|
|
214
|
+
};
|
|
215
|
+
QosMonitor.prototype._ensureEndExtraData = function () {
|
|
216
|
+
if (!this._endExtraData) {
|
|
217
|
+
this._endExtraData = {};
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Logs the application hosted in Teams in combination with which Teams application it was hosted on.
|
|
222
|
+
* Viva1p-TeamsNative: Viva home app loaded through Teams Desktop application, not including mobile
|
|
223
|
+
* Viva1p-TeamsWeb: Viva home app loaded through Teams Web browser, not including mobile
|
|
224
|
+
* MEEBridge-TeamsNative: VivaConnections MEEBridge app loaded through Teams mobile client.
|
|
225
|
+
* ClassHome-TeamsNative: ClassHome app loaded through Teams Desktop application, not including mobile
|
|
226
|
+
* ClassHome-TeamsWeb: ClassHome app loaded through Teams Web browser, not including mobile
|
|
227
|
+
*/
|
|
228
|
+
QosMonitor.prototype._logHostType = function () {
|
|
229
|
+
if (DiagnosticsSettingsManager.isInitialized) {
|
|
230
|
+
var appHostType = _BrowserUtilities.getTeamsAppType();
|
|
231
|
+
// Skip logging for default SPO path for now to limit quota impact
|
|
232
|
+
if (appHostType) {
|
|
233
|
+
this._ensureEndExtraData();
|
|
234
|
+
var hostKey = 'appHostType';
|
|
235
|
+
// Unlikely, but avoid overwriting matching key value
|
|
236
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
237
|
+
if (!this._endExtraData[hostKey]) {
|
|
238
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
239
|
+
this._endExtraData[hostKey] = appHostType;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
QosMonitor.prototype._isDebugSession = function () {
|
|
245
|
+
try {
|
|
246
|
+
if (!_SPKillSwitch.isActivated('761ccb86-4fa0-4f56-a05b-477bcc09bd9f' /* '08/01/2024', 'finnnavin: Let QoSMonitor run in debug, uploading is blocked at SDK-level.' */)) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
return !!_BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch (_a) {
|
|
254
|
+
// KillSwitches throw exceptions when not initialized.
|
|
255
|
+
// Currently this only happens when spfx-debug is present, so telemetry isn't being logged by the handler, and we can return false.
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
QosMonitor.prototype._shouldSkip = function (result) {
|
|
260
|
+
if (this._hasEnded && this._endResult !== undefined) {
|
|
261
|
+
var message = Text.format(QOS_MONISTOR_HAS_ENDED_ERROR_STRING, this.name, this._qosResultTypeValue[this._endResult], this._qosResultTypeValue[result]);
|
|
262
|
+
if (this._endResult !== result) {
|
|
263
|
+
TraceLogger.logError(LOG_SOURCE, new Error(message));
|
|
264
|
+
}
|
|
265
|
+
if (DEBUG) {
|
|
266
|
+
TraceLogger.logVerbose(LOG_SOURCE, message, 'skipEnd');
|
|
267
|
+
}
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
this._hasEnded = true;
|
|
272
|
+
return this._isDebugSession();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
QosMonitor.prototype._writeToEngagement = function () {
|
|
276
|
+
if (this._copyToInterana) {
|
|
277
|
+
EngagementLogger.log({
|
|
278
|
+
name: this.name,
|
|
279
|
+
isIntentional: !!(this.extraData || {}).isIntentional,
|
|
280
|
+
extraData: this.extraData || {}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
if (this._copyToCosmos) {
|
|
284
|
+
// Engagement name requires certain format. Cannot just use QOS name.
|
|
285
|
+
// Record Qos name in extra data 'qosName'
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287
|
+
var engagementData = {
|
|
288
|
+
name: 'Spfx.Qos.ToEngagement',
|
|
289
|
+
extraData: this.extraData || {}
|
|
290
|
+
};
|
|
291
|
+
engagementData.extraData.qosName = this.name;
|
|
292
|
+
if (this.resultType) {
|
|
293
|
+
engagementData.extraData.qosResultType = this._qosResultTypeValue[this.resultType];
|
|
294
|
+
}
|
|
295
|
+
if (this.resultCode) {
|
|
296
|
+
engagementData.extraData.qosResultCode = this.resultCode;
|
|
297
|
+
}
|
|
298
|
+
EngagementLogger.log(engagementData);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
return QosMonitor;
|
|
302
|
+
}());
|
|
303
|
+
export default QosMonitor;
|
|
304
|
+
//# sourceMappingURL=QosMonitor.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { IExtraDataForCustomerPromise } from './CustomerPromiseInterfaces/IExtraDataForCustomerPromise';
|
|
2
|
+
import QosMonitor from './QosMonitor';
|
|
3
|
+
/**
|
|
4
|
+
* Monitor which handles failures for QosMonitor and also invokes Customer Promise Handlers to record failure
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class QosMonitorShareFailureWithCP extends QosMonitor {
|
|
8
|
+
private _extraDataForCustomerPromise;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a QoS monitor and also registers the Customer promise handlers to notify in case of failures
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* @param scenarioName - Unique name of the QoS scenario
|
|
14
|
+
* @param copyToEngagement - indicate whether this data should be used as Engagement as well.
|
|
15
|
+
* @param extraDataForCustomerPromise - Holds extra information about Customer Promise handlers to invoke
|
|
16
|
+
* and error information where failures are logged
|
|
17
|
+
*/
|
|
18
|
+
constructor(scenarioName: string, copyToEngagement: boolean | undefined, extraDataForCustomerPromise: IExtraDataForCustomerPromise[], copyToCosmos?: boolean);
|
|
19
|
+
/**
|
|
20
|
+
* QoS monitor ends with failure and invokes the Customer Promise handlers
|
|
21
|
+
* to log a failure
|
|
22
|
+
* @internal
|
|
23
|
+
*
|
|
24
|
+
* You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
|
|
25
|
+
* <failuretag> will be filled with param tagName
|
|
26
|
+
*/
|
|
27
|
+
writeUnexpectedFailure(tagNameSuffix?: string, ex?: Error, extraData?: {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}): void;
|
|
30
|
+
/**
|
|
31
|
+
* QoS monitor ends with expected failure and invokes the Customer Promise handlers
|
|
32
|
+
* to log an expected failure
|
|
33
|
+
* @internal
|
|
34
|
+
*
|
|
35
|
+
* You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
|
|
36
|
+
* <failuretag> will be filled with param tagName
|
|
37
|
+
*/
|
|
38
|
+
writeExpectedFailure(tagNameSuffix?: string, ex?: Error, extraData?: {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}, skipLoggingCustomerPromiseFailure?: boolean): void;
|
|
41
|
+
/**
|
|
42
|
+
* Invokes the registered Customer Promise Handlers by using the passed in serviceKey
|
|
43
|
+
* @param errorMessage - Information to indicate which scenario failed.
|
|
44
|
+
* @param errorScenario -Additional error details describing the failure from the module.
|
|
45
|
+
* @param resultType - ResultTypeEnum used to indicate expected or unexpected failure.
|
|
46
|
+
* @param extraData - Additional information to be logged, which might include pageType and/or errorStack
|
|
47
|
+
*/
|
|
48
|
+
private _logCustomerPromiseFailure;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=QosMonitorShareFailureWithCP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QosMonitorShareFailureWithCP.d.ts","sourceRoot":"","sources":["../../../src/Api/Qos/QosMonitorShareFailureWithCP.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAC7G,OAAO,UAAU,MAAM,cAAc,CAAC;AAItC;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,UAAU;IAC1D,OAAO,CAAC,4BAA4B,CAAiC;IACrE;;;;;;;;OAQG;gBAED,YAAY,EAAE,MAAM,EACpB,gBAAgB,qBAAiB,EACjC,2BAA2B,EAAE,4BAA4B,EAAE,EAC3D,YAAY,GAAE,OAAe;IAK/B;;;;;;;OAOG;IACI,sBAAsB,CAC3B,aAAa,GAAE,MAA4B,EAC3C,EAAE,CAAC,EAAE,KAAK,EAEV,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GACjC,IAAI;IASP;;;;;;;OAOG;IACI,oBAAoB,CACzB,aAAa,GAAE,MAA0B,EACzC,EAAE,CAAC,EAAE,KAAK,EAEV,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAClC,iCAAiC,GAAE,OAAe,GACjD,IAAI;IAaP;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;CA2BnC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import QosMonitor from './QosMonitor';
|
|
3
|
+
import { QosResultType } from './QosResultType';
|
|
4
|
+
import { _Diagnostics } from '../../index';
|
|
5
|
+
import { isAppendSuffixIfBrowserIsOfflineAtLoggingTimeKsActive } from '../../common/Killswitches';
|
|
6
|
+
/**
|
|
7
|
+
* Monitor which handles failures for QosMonitor and also invokes Customer Promise Handlers to record failure
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
var QosMonitorShareFailureWithCP = /** @class */ (function (_super) {
|
|
11
|
+
__extends(QosMonitorShareFailureWithCP, _super);
|
|
12
|
+
/**
|
|
13
|
+
* Creates a QoS monitor and also registers the Customer promise handlers to notify in case of failures
|
|
14
|
+
* @internal
|
|
15
|
+
*
|
|
16
|
+
* @param scenarioName - Unique name of the QoS scenario
|
|
17
|
+
* @param copyToEngagement - indicate whether this data should be used as Engagement as well.
|
|
18
|
+
* @param extraDataForCustomerPromise - Holds extra information about Customer Promise handlers to invoke
|
|
19
|
+
* and error information where failures are logged
|
|
20
|
+
*/
|
|
21
|
+
function QosMonitorShareFailureWithCP(scenarioName, copyToEngagement, extraDataForCustomerPromise, copyToCosmos) {
|
|
22
|
+
if (copyToEngagement === void 0) { copyToEngagement = false; }
|
|
23
|
+
if (copyToCosmos === void 0) { copyToCosmos = false; }
|
|
24
|
+
var _this = _super.call(this, scenarioName, /* copyToCosmos */ copyToCosmos, /* copyToInterana */ copyToEngagement) || this;
|
|
25
|
+
_this._extraDataForCustomerPromise = extraDataForCustomerPromise;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* QoS monitor ends with failure and invokes the Customer Promise handlers
|
|
30
|
+
* to log a failure
|
|
31
|
+
* @internal
|
|
32
|
+
*
|
|
33
|
+
* You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
|
|
34
|
+
* <failuretag> will be filled with param tagName
|
|
35
|
+
*/
|
|
36
|
+
QosMonitorShareFailureWithCP.prototype.writeUnexpectedFailure = function (tagNameSuffix, ex,
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
extraData) {
|
|
39
|
+
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultUnexpected'; }
|
|
40
|
+
_super.prototype.writeUnexpectedFailure.call(this, tagNameSuffix, ex, extraData);
|
|
41
|
+
this._logCustomerPromiseFailure((ex === null || ex === void 0 ? void 0 : ex.message) || 'DefaultErrorMessage', tagNameSuffix, QosResultType.Failure, extraData);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* QoS monitor ends with expected failure and invokes the Customer Promise handlers
|
|
45
|
+
* to log an expected failure
|
|
46
|
+
* @internal
|
|
47
|
+
*
|
|
48
|
+
* You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
|
|
49
|
+
* <failuretag> will be filled with param tagName
|
|
50
|
+
*/
|
|
51
|
+
QosMonitorShareFailureWithCP.prototype.writeExpectedFailure = function (tagNameSuffix, ex,
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
+
extraData, skipLoggingCustomerPromiseFailure) {
|
|
54
|
+
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultExpected'; }
|
|
55
|
+
if (skipLoggingCustomerPromiseFailure === void 0) { skipLoggingCustomerPromiseFailure = false; }
|
|
56
|
+
_super.prototype.writeExpectedFailure.call(this, tagNameSuffix, ex, extraData);
|
|
57
|
+
if (!skipLoggingCustomerPromiseFailure) {
|
|
58
|
+
this._logCustomerPromiseFailure((ex === null || ex === void 0 ? void 0 : ex.message) || 'DefaultErrorMessage', tagNameSuffix, QosResultType.ExpectedFailure, extraData);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Invokes the registered Customer Promise Handlers by using the passed in serviceKey
|
|
63
|
+
* @param errorMessage - Information to indicate which scenario failed.
|
|
64
|
+
* @param errorScenario -Additional error details describing the failure from the module.
|
|
65
|
+
* @param resultType - ResultTypeEnum used to indicate expected or unexpected failure.
|
|
66
|
+
* @param extraData - Additional information to be logged, which might include pageType and/or errorStack
|
|
67
|
+
*/
|
|
68
|
+
QosMonitorShareFailureWithCP.prototype._logCustomerPromiseFailure = function (errorMessage, errorScenario, resultType,
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
extraData) {
|
|
71
|
+
if (resultType === void 0) { resultType = QosResultType.Failure; }
|
|
72
|
+
if (this._extraDataForCustomerPromise) {
|
|
73
|
+
this._extraDataForCustomerPromise.forEach(function (extraHandlerInfo) {
|
|
74
|
+
var logFailure = extraHandlerInfo.logFailure, veto = extraHandlerInfo.veto;
|
|
75
|
+
var errorModuleName = extraHandlerInfo.errorModuleName +
|
|
76
|
+
getAuthoringSuffix() +
|
|
77
|
+
(!isAppendSuffixIfBrowserIsOfflineAtLoggingTimeKsActive() ? getOfflineSuffix() : '');
|
|
78
|
+
var errorDetailsForCP = {
|
|
79
|
+
errorCode: errorModuleName,
|
|
80
|
+
errorScenario: errorScenario,
|
|
81
|
+
errorMessage: errorMessage,
|
|
82
|
+
resultType: resultType,
|
|
83
|
+
pageType: extraData === null || extraData === void 0 ? void 0 : extraData.pageType,
|
|
84
|
+
errorStack: extraData === null || extraData === void 0 ? void 0 : extraData.errorStack,
|
|
85
|
+
veto: veto
|
|
86
|
+
};
|
|
87
|
+
logFailure(errorDetailsForCP);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return QosMonitorShareFailureWithCP;
|
|
92
|
+
}(QosMonitor));
|
|
93
|
+
export { QosMonitorShareFailureWithCP };
|
|
94
|
+
function getAuthoringSuffix() {
|
|
95
|
+
var extraDiagnosticInfo = _Diagnostics._getExtraDiagnosticInfo();
|
|
96
|
+
if (!extraDiagnosticInfo || !extraDiagnosticInfo.hasAuthoringStarted) {
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
else if (!extraDiagnosticInfo.authoringSessionClientCount) {
|
|
100
|
+
return extraDiagnosticInfo.isAuthoringUsingDDS
|
|
101
|
+
? " in Legacy Authoring (DDS)"
|
|
102
|
+
: ' in Legacy Authoring (no DDS)';
|
|
103
|
+
}
|
|
104
|
+
else if (extraDiagnosticInfo.authoringSessionClientCount > 1) {
|
|
105
|
+
return ' with Multiple Users';
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return '';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function getOfflineSuffix() {
|
|
112
|
+
return window.navigator.onLine ? '' : ' (offline)';
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=QosMonitorShareFailureWithCP.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Qos Result Type const object.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const QosResultType: {
|
|
6
|
+
readonly Success: 0;
|
|
7
|
+
readonly Failure: 1;
|
|
8
|
+
readonly ExpectedFailure: 2;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Qos Result Type type.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export type QosResultType = typeof QosResultType[keyof typeof QosResultType];
|
|
15
|
+
//# sourceMappingURL=QosResultType.d.ts.map
|