@webex/internal-plugin-metrics 3.8.0 → 3.8.1-next.10
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/call-diagnostic/call-diagnostic-metrics-latencies.js +49 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +301 -81
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js +6 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
- package/dist/call-diagnostic/config.js +32 -3
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/metrics.types.js.map +1 -1
- package/dist/new-metrics.js +58 -5
- package/dist/new-metrics.js.map +1 -1
- package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +15 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +154 -24
- package/dist/types/call-diagnostic/config.d.ts +14 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/metrics.types.d.ts +28 -7
- package/dist/types/new-metrics.d.ts +28 -4
- package/package.json +12 -12
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +58 -0
- package/src/call-diagnostic/call-diagnostic-metrics.ts +294 -66
- package/src/call-diagnostic/call-diagnostic-metrics.util.ts +6 -0
- package/src/call-diagnostic/config.ts +31 -0
- package/src/index.ts +4 -0
- package/src/metrics.types.ts +36 -6
- package/src/new-metrics.ts +73 -5
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +20 -1
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +167 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +1054 -153
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +6 -0
- package/test/unit/spec/new-metrics.ts +94 -5
- package/test/unit/spec/prelogin-metrics-batcher.ts +1 -0
- package/dist/call-diagnostic-events-batcher.js +0 -59
- package/dist/call-diagnostic-events-batcher.js.map +0 -1
|
@@ -327,6 +327,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
327
327
|
{
|
|
328
328
|
joinTimes: {
|
|
329
329
|
downloadTime: undefined,
|
|
330
|
+
pageJmt: undefined,
|
|
330
331
|
},
|
|
331
332
|
},
|
|
332
333
|
],
|
|
@@ -338,6 +339,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
338
339
|
meetingInfoReqResp: undefined,
|
|
339
340
|
refreshCaptchaServiceReqResp: undefined,
|
|
340
341
|
downloadIntelligenceModelsReqResp: undefined,
|
|
342
|
+
clickToInterstitialWithUserDelay: undefined,
|
|
341
343
|
},
|
|
342
344
|
},
|
|
343
345
|
],
|
|
@@ -366,6 +368,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
366
368
|
totalJmt: undefined,
|
|
367
369
|
clientJmt: undefined,
|
|
368
370
|
downloadTime: undefined,
|
|
371
|
+
clickToInterstitialWithUserDelay: undefined,
|
|
372
|
+
totalJMTWithUserDelay: undefined,
|
|
369
373
|
},
|
|
370
374
|
},
|
|
371
375
|
],
|
|
@@ -402,6 +406,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
402
406
|
interstitialToMediaOKJMT: undefined,
|
|
403
407
|
callInitMediaEngineReady: undefined,
|
|
404
408
|
stayLobbyTime: undefined,
|
|
409
|
+
totalMediaJMTWithUserDelay: undefined,
|
|
410
|
+
totalJMTWithUserDelay: undefined,
|
|
405
411
|
},
|
|
406
412
|
},
|
|
407
413
|
],
|
|
@@ -19,7 +19,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
describe('check submitClientEvent when webex is not ready', () => {
|
|
22
|
+
describe('check submitClientEvent, submitFeatureEvent when webex is not ready', () => {
|
|
23
23
|
let webex;
|
|
24
24
|
//@ts-ignore
|
|
25
25
|
webex = mockWebex();
|
|
@@ -36,6 +36,30 @@ describe('internal-plugin-metrics', () => {
|
|
|
36
36
|
'NewMetrics: @submitClientEvent. Attempted to submit before webex.ready. Event name: client.alert.displayed'
|
|
37
37
|
);
|
|
38
38
|
});
|
|
39
|
+
|
|
40
|
+
it('checks the log', () => {
|
|
41
|
+
webex.internal.newMetrics.submitFeatureEvent({
|
|
42
|
+
name: 'client.feature.meeting.summary',
|
|
43
|
+
options: {
|
|
44
|
+
meetingId: '123',
|
|
45
|
+
},
|
|
46
|
+
payload: {
|
|
47
|
+
meetingSummaryInfo: {
|
|
48
|
+
featureName: 'syncSystemMuteStatus',
|
|
49
|
+
featureActions: [{
|
|
50
|
+
actionName: 'syncMeetingMicUnmuteStatusToSystem',
|
|
51
|
+
actionId: '14200',
|
|
52
|
+
isInitialValue: false,
|
|
53
|
+
clickCount: '1'
|
|
54
|
+
}]
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
assert.calledWith(
|
|
59
|
+
webex.logger.log,
|
|
60
|
+
'NewMetrics: @submitFeatureEvent. Attempted to submit before webex.ready. Event name: client.feature.meeting.summary'
|
|
61
|
+
);
|
|
62
|
+
});
|
|
39
63
|
});
|
|
40
64
|
|
|
41
65
|
describe('new-metrics contstructor', () => {
|
|
@@ -65,6 +89,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
65
89
|
webex.internal.newMetrics.callDiagnosticMetrics.buildClientEventFetchRequestOptions =
|
|
66
90
|
sinon.stub();
|
|
67
91
|
webex.setTimingsAndFetch = sinon.stub();
|
|
92
|
+
webex.internal.newMetrics.callDiagnosticMetrics.submitFeatureEvent = sinon.stub();
|
|
68
93
|
});
|
|
69
94
|
|
|
70
95
|
afterEach(() => {
|
|
@@ -104,7 +129,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
104
129
|
metadata: { foo: 'bar' },
|
|
105
130
|
});
|
|
106
131
|
});
|
|
107
|
-
|
|
132
|
+
|
|
108
133
|
it('submits Client Event successfully', () => {
|
|
109
134
|
webex.internal.newMetrics.submitClientEvent({
|
|
110
135
|
name: 'client.alert.displayed',
|
|
@@ -125,6 +150,46 @@ describe('internal-plugin-metrics', () => {
|
|
|
125
150
|
});
|
|
126
151
|
});
|
|
127
152
|
|
|
153
|
+
it('submits feature Event successfully', () => {
|
|
154
|
+
webex.internal.newMetrics.submitFeatureEvent({
|
|
155
|
+
name: 'client.feature.meeting.summary',
|
|
156
|
+
options: {
|
|
157
|
+
meetingId: '123',
|
|
158
|
+
},
|
|
159
|
+
payload: {
|
|
160
|
+
meetingSummaryInfo: {
|
|
161
|
+
featureName: 'syncSystemMuteStatus',
|
|
162
|
+
featureActions: [{
|
|
163
|
+
actionName: 'syncMeetingMicUnmuteStatusToSystem',
|
|
164
|
+
actionId: '14200',
|
|
165
|
+
isInitialValue: false,
|
|
166
|
+
clickCount: '1'
|
|
167
|
+
}]
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
assert.calledWith(webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp, {
|
|
173
|
+
key: 'client.feature.meeting.summary',
|
|
174
|
+
options: {meetingId: '123'},
|
|
175
|
+
});
|
|
176
|
+
assert.calledWith(webex.internal.newMetrics.callDiagnosticMetrics.submitFeatureEvent, {
|
|
177
|
+
name: 'client.feature.meeting.summary',
|
|
178
|
+
payload: {
|
|
179
|
+
meetingSummaryInfo: {
|
|
180
|
+
featureName: 'syncSystemMuteStatus',
|
|
181
|
+
featureActions: [{
|
|
182
|
+
actionName: 'syncMeetingMicUnmuteStatusToSystem',
|
|
183
|
+
actionId: '14200',
|
|
184
|
+
isInitialValue: false,
|
|
185
|
+
clickCount: '1'
|
|
186
|
+
}]
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
options: {meetingId: '123'},
|
|
190
|
+
delaySubmitEvent: false,
|
|
191
|
+
});
|
|
192
|
+
});
|
|
128
193
|
|
|
129
194
|
it('submits MQE successfully', () => {
|
|
130
195
|
webex.internal.newMetrics.submitMQE({
|
|
@@ -264,19 +329,43 @@ describe('internal-plugin-metrics', () => {
|
|
|
264
329
|
describe('#setDelaySubmitClientEvents', () => {
|
|
265
330
|
it('sets delaySubmitClientEvents correctly and calls submitDelayedClientEvents when set to false', () => {
|
|
266
331
|
sinon.assert.match(webex.internal.newMetrics.delaySubmitClientEvents, false);
|
|
332
|
+
sinon.assert.match(webex.internal.newMetrics.delayedClientEventsOverrides, {});
|
|
267
333
|
|
|
268
|
-
webex.internal.newMetrics.setDelaySubmitClientEvents(true);
|
|
334
|
+
webex.internal.newMetrics.setDelaySubmitClientEvents({shouldDelay: true});
|
|
269
335
|
|
|
270
336
|
assert.notCalled(webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents);
|
|
271
337
|
|
|
272
338
|
sinon.assert.match(webex.internal.newMetrics.delaySubmitClientEvents, true);
|
|
339
|
+
sinon.assert.match(webex.internal.newMetrics.delayedClientEventsOverrides, {});
|
|
273
340
|
|
|
274
|
-
webex.internal.newMetrics.setDelaySubmitClientEvents(false);
|
|
341
|
+
webex.internal.newMetrics.setDelaySubmitClientEvents({shouldDelay: false, overrides: {foo: 'bar'}});
|
|
275
342
|
|
|
276
343
|
assert.calledOnce(webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents);
|
|
277
|
-
assert.calledWith(webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents);
|
|
344
|
+
assert.calledWith(webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents, {foo: 'bar'});
|
|
278
345
|
|
|
279
346
|
sinon.assert.match(webex.internal.newMetrics.delaySubmitClientEvents, false);
|
|
347
|
+
sinon.assert.match(webex.internal.newMetrics.delayedClientEventsOverrides, {foo: 'bar'});
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it('should not fail when called before webex is ready', () => {
|
|
351
|
+
|
|
352
|
+
// Create mock
|
|
353
|
+
webex = mockWebex()
|
|
354
|
+
|
|
355
|
+
webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp = sinon.stub();
|
|
356
|
+
webex.internal.newMetrics.callDiagnosticLatencies.clearTimestamps = sinon.stub();
|
|
357
|
+
webex.setTimingsAndFetch = sinon.stub();
|
|
358
|
+
|
|
359
|
+
sinon.assert.match(webex.internal.newMetrics.delaySubmitClientEvents, false);
|
|
360
|
+
|
|
361
|
+
// Call the method before webex is ready, will not throw error
|
|
362
|
+
webex.internal.newMetrics.setDelaySubmitClientEvents({shouldDelay: false});
|
|
363
|
+
webex.internal.newMetrics.setDelaySubmitClientEvents({shouldDelay: true});
|
|
364
|
+
|
|
365
|
+
webex.internal.newMetrics.setDelaySubmitClientEvents({shouldDelay: false});
|
|
366
|
+
// Webex is ready
|
|
367
|
+
webex.emit('ready');
|
|
368
|
+
|
|
280
369
|
});
|
|
281
370
|
});
|
|
282
371
|
});
|
|
@@ -76,6 +76,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
76
76
|
clickToInterstitial: undefined,
|
|
77
77
|
refreshCaptchaServiceReqResp: undefined,
|
|
78
78
|
downloadIntelligenceModelsReqResp: undefined,
|
|
79
|
+
clickToInterstitialWithUserDelay: undefined,
|
|
79
80
|
},
|
|
80
81
|
name: 'client.interstitial-window.launched',
|
|
81
82
|
},
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
10
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
11
|
-
var _batcher = _interopRequireDefault(require("./batcher"));
|
|
12
|
-
/*!
|
|
13
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
var CallDiagnosticEventsBatcher = _batcher.default.extend({
|
|
17
|
-
namespace: 'Metrics',
|
|
18
|
-
/**
|
|
19
|
-
* @param {string} webClientDomain
|
|
20
|
-
* @returns {string}
|
|
21
|
-
*/
|
|
22
|
-
getBuildType: function getBuildType(webClientDomain) {
|
|
23
|
-
if (webClientDomain !== null && webClientDomain !== void 0 && webClientDomain.includes('teams.webex.com') || webClientDomain !== null && webClientDomain !== void 0 && webClientDomain.includes('localhost') || webClientDomain !== null && webClientDomain !== void 0 && webClientDomain.includes('127.0.0.1') || process.env.NODE_ENV !== 'production') {
|
|
24
|
-
return 'test';
|
|
25
|
-
}
|
|
26
|
-
return process.env.NODE_ENV === 'production' ? 'prod' : 'test';
|
|
27
|
-
},
|
|
28
|
-
prepareItem: function prepareItem(item) {
|
|
29
|
-
var _item$event, _item$event$eventData;
|
|
30
|
-
// networkType should be a enum value: `wifi`, `ethernet`, `cellular`, or `unknown`.
|
|
31
|
-
// Browsers cannot provide such information right now. However, it is a required field.
|
|
32
|
-
var origin = {
|
|
33
|
-
buildType: this.getBuildType((_item$event = item.event) === null || _item$event === void 0 ? void 0 : (_item$event$eventData = _item$event.eventData) === null || _item$event$eventData === void 0 ? void 0 : _item$event$eventData.webClientDomain),
|
|
34
|
-
networkType: 'unknown'
|
|
35
|
-
};
|
|
36
|
-
item.eventPayload.origin = (0, _assign.default)(origin, item.eventPayload.origin);
|
|
37
|
-
return _promise.default.resolve(item);
|
|
38
|
-
},
|
|
39
|
-
prepareRequest: function prepareRequest(queue) {
|
|
40
|
-
// Add sent timestamp
|
|
41
|
-
queue.forEach(function (item) {
|
|
42
|
-
item.eventPayload.originTime = item.eventPayload.originTime || {};
|
|
43
|
-
item.eventPayload.originTime.sent = new Date().toISOString();
|
|
44
|
-
});
|
|
45
|
-
return _promise.default.resolve(queue);
|
|
46
|
-
},
|
|
47
|
-
submitHttpRequest: function submitHttpRequest(payload) {
|
|
48
|
-
return this.webex.request({
|
|
49
|
-
method: 'POST',
|
|
50
|
-
service: 'metrics',
|
|
51
|
-
resource: 'clientmetrics',
|
|
52
|
-
body: {
|
|
53
|
-
metrics: payload
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
var _default = exports.default = CallDiagnosticEventsBatcher;
|
|
59
|
-
//# sourceMappingURL=call-diagnostic-events-batcher.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_batcher","_interopRequireDefault","require","CallDiagnosticEventsBatcher","Batcher","extend","namespace","getBuildType","webClientDomain","includes","process","env","NODE_ENV","prepareItem","item","_item$event","_item$event$eventData","origin","buildType","event","eventData","networkType","eventPayload","_assign","default","_promise","resolve","prepareRequest","queue","forEach","originTime","sent","Date","toISOString","submitHttpRequest","payload","webex","request","method","service","resource","body","metrics","_default","exports"],"sources":["call-diagnostic-events-batcher.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport Batcher from './batcher';\n\nconst CallDiagnosticEventsBatcher = Batcher.extend({\n namespace: 'Metrics',\n\n /**\n * @param {string} webClientDomain\n * @returns {string}\n */\n getBuildType(webClientDomain) {\n if (\n webClientDomain?.includes('teams.webex.com') ||\n webClientDomain?.includes('localhost') ||\n webClientDomain?.includes('127.0.0.1') ||\n process.env.NODE_ENV !== 'production'\n ) {\n return 'test';\n }\n\n return process.env.NODE_ENV === 'production' ? 'prod' : 'test';\n },\n\n prepareItem(item) {\n // networkType should be a enum value: `wifi`, `ethernet`, `cellular`, or `unknown`.\n // Browsers cannot provide such information right now. However, it is a required field.\n const origin = {\n buildType: this.getBuildType(item.event?.eventData?.webClientDomain),\n networkType: 'unknown',\n };\n\n item.eventPayload.origin = Object.assign(origin, item.eventPayload.origin);\n\n return Promise.resolve(item);\n },\n\n prepareRequest(queue) {\n // Add sent timestamp\n queue.forEach((item) => {\n item.eventPayload.originTime = item.eventPayload.originTime || {};\n item.eventPayload.originTime.sent = new Date().toISOString();\n });\n\n return Promise.resolve(queue);\n },\n\n submitHttpRequest(payload) {\n return this.webex.request({\n method: 'POST',\n service: 'metrics',\n resource: 'clientmetrics',\n body: {\n metrics: payload,\n },\n });\n },\n});\n\nexport default CallDiagnosticEventsBatcher;\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA,IAAMC,2BAA2B,GAAGC,gBAAO,CAACC,MAAM,CAAC;EACjDC,SAAS,EAAE,SAAS;EAEpB;AACF;AACA;AACA;EACEC,YAAY,WAAZA,YAAYA,CAACC,eAAe,EAAE;IAC5B,IACEA,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAEC,QAAQ,CAAC,iBAAiB,CAAC,IAC5CD,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAEC,QAAQ,CAAC,WAAW,CAAC,IACtCD,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAEC,QAAQ,CAAC,WAAW,CAAC,IACtCC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EACrC;MACA,OAAO,MAAM;IACf;IAEA,OAAOF,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM;EAChE,CAAC;EAEDC,WAAW,WAAXA,WAAWA,CAACC,IAAI,EAAE;IAAA,IAAAC,WAAA,EAAAC,qBAAA;IAChB;IACA;IACA,IAAMC,MAAM,GAAG;MACbC,SAAS,EAAE,IAAI,CAACX,YAAY,EAAAQ,WAAA,GAACD,IAAI,CAACK,KAAK,cAAAJ,WAAA,wBAAAC,qBAAA,GAAVD,WAAA,CAAYK,SAAS,cAAAJ,qBAAA,uBAArBA,qBAAA,CAAuBR,eAAe,CAAC;MACpEa,WAAW,EAAE;IACf,CAAC;IAEDP,IAAI,CAACQ,YAAY,CAACL,MAAM,GAAG,IAAAM,OAAA,CAAAC,OAAA,EAAcP,MAAM,EAAEH,IAAI,CAACQ,YAAY,CAACL,MAAM,CAAC;IAE1E,OAAOQ,QAAA,CAAAD,OAAA,CAAQE,OAAO,CAACZ,IAAI,CAAC;EAC9B,CAAC;EAEDa,cAAc,WAAdA,cAAcA,CAACC,KAAK,EAAE;IACpB;IACAA,KAAK,CAACC,OAAO,CAAC,UAACf,IAAI,EAAK;MACtBA,IAAI,CAACQ,YAAY,CAACQ,UAAU,GAAGhB,IAAI,CAACQ,YAAY,CAACQ,UAAU,IAAI,CAAC,CAAC;MACjEhB,IAAI,CAACQ,YAAY,CAACQ,UAAU,CAACC,IAAI,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;IAC9D,CAAC,CAAC;IAEF,OAAOR,QAAA,CAAAD,OAAA,CAAQE,OAAO,CAACE,KAAK,CAAC;EAC/B,CAAC;EAEDM,iBAAiB,WAAjBA,iBAAiBA,CAACC,OAAO,EAAE;IACzB,OAAO,IAAI,CAACC,KAAK,CAACC,OAAO,CAAC;MACxBC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,SAAS;MAClBC,QAAQ,EAAE,eAAe;MACzBC,IAAI,EAAE;QACJC,OAAO,EAAEP;MACX;IACF,CAAC,CAAC;EACJ;AACF,CAAC,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEYrB,2BAA2B","ignoreList":[]}
|