@webex/internal-plugin-metrics 3.9.0 → 3.10.0-multi-llms.1
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 +26 -25
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +8 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/metrics.types.js.map +1 -1
- package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +1 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +10 -9
- package/dist/types/metrics.types.d.ts +1 -0
- package/package.json +12 -12
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +32 -24
- package/src/call-diagnostic/call-diagnostic-metrics.ts +10 -2
- package/src/metrics.types.ts +1 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +200 -1
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +36 -1
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/@webex/internal-plugin-metrics"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=18"
|
|
15
15
|
},
|
|
16
16
|
"browserify": {
|
|
17
17
|
"transform": [
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
27
27
|
"@webex/jest-config-legacy": "0.0.0",
|
|
28
28
|
"@webex/legacy-tools": "0.0.0",
|
|
29
|
-
"@webex/test-helper-chai": "3.9.0",
|
|
30
|
-
"@webex/test-helper-mocha": "3.9.0",
|
|
31
|
-
"@webex/test-helper-mock-webex": "3.9.0",
|
|
32
|
-
"@webex/test-helper-test-users": "3.9.0",
|
|
29
|
+
"@webex/test-helper-chai": "3.9.0-multi-llms.1",
|
|
30
|
+
"@webex/test-helper-mocha": "3.9.0-multi-llms.1",
|
|
31
|
+
"@webex/test-helper-mock-webex": "3.9.0-multi-llms.1",
|
|
32
|
+
"@webex/test-helper-test-users": "3.9.0-multi-llms.1",
|
|
33
33
|
"eslint": "^8.24.0",
|
|
34
34
|
"prettier": "^2.7.1",
|
|
35
35
|
"sinon": "^9.2.4"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@webex/common": "3.9.0",
|
|
39
|
-
"@webex/common-timers": "3.9.0",
|
|
40
|
-
"@webex/event-dictionary-ts": "^1.0.
|
|
41
|
-
"@webex/test-helper-chai": "3.9.0",
|
|
42
|
-
"@webex/test-helper-mock-webex": "3.9.0",
|
|
43
|
-
"@webex/webex-core": "3.
|
|
38
|
+
"@webex/common": "3.9.0-multi-llms.1",
|
|
39
|
+
"@webex/common-timers": "3.9.0-multi-llms.1",
|
|
40
|
+
"@webex/event-dictionary-ts": "^1.0.1930",
|
|
41
|
+
"@webex/test-helper-chai": "3.9.0-multi-llms.1",
|
|
42
|
+
"@webex/test-helper-mock-webex": "3.9.0-multi-llms.1",
|
|
43
|
+
"@webex/webex-core": "3.10.0-multi-llms.1",
|
|
44
44
|
"ip-anonymize": "^0.1.0",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
46
|
"uuid": "^3.3.2"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"test:style": "eslint ./src/**/*.*",
|
|
54
54
|
"test:unit": "webex-legacy-tools test --unit --runner mocha"
|
|
55
55
|
},
|
|
56
|
-
"version": "3.
|
|
56
|
+
"version": "3.10.0-multi-llms.1"
|
|
57
57
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this */
|
|
2
2
|
/* eslint-disable valid-jsdoc */
|
|
3
3
|
import {WebexPlugin} from '@webex/webex-core';
|
|
4
|
+
import {clamp} from 'lodash';
|
|
4
5
|
|
|
5
6
|
import {MetricEventNames, PreComputedLatencies} from '../metrics.types';
|
|
6
7
|
|
|
@@ -16,6 +17,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
16
17
|
precomputedLatencies: Map<PreComputedLatencies, number>;
|
|
17
18
|
// meetingId that the current latencies are for
|
|
18
19
|
private meetingId?: string;
|
|
20
|
+
private MAX_INTEGER = 2147483647;
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* @constructor
|
|
@@ -162,13 +164,9 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
162
164
|
|
|
163
165
|
const diff = end - start;
|
|
164
166
|
|
|
165
|
-
|
|
166
|
-
return diff;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const {minimum = 0, maximum} = clampValues;
|
|
167
|
+
const {minimum = 0, maximum = this.MAX_INTEGER} = clampValues || {};
|
|
170
168
|
|
|
171
|
-
return
|
|
169
|
+
return clamp(diff, minimum, maximum);
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
/**
|
|
@@ -318,7 +316,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
318
316
|
public getPageJMT() {
|
|
319
317
|
const latency = this.precomputedLatencies.get('internal.client.pageJMT');
|
|
320
318
|
|
|
321
|
-
return typeof latency === 'number' ? latency : undefined;
|
|
319
|
+
return typeof latency === 'number' ? clamp(latency, 0, this.MAX_INTEGER) : undefined;
|
|
322
320
|
}
|
|
323
321
|
|
|
324
322
|
/**
|
|
@@ -328,7 +326,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
328
326
|
public getDownloadTimeJMT() {
|
|
329
327
|
const latency = this.precomputedLatencies.get('internal.download.time');
|
|
330
328
|
|
|
331
|
-
return typeof latency === 'number' ? latency : undefined;
|
|
329
|
+
return typeof latency === 'number' ? clamp(latency, 0, this.MAX_INTEGER) : undefined;
|
|
332
330
|
}
|
|
333
331
|
|
|
334
332
|
/**
|
|
@@ -349,7 +347,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
349
347
|
);
|
|
350
348
|
|
|
351
349
|
if (typeof clickToInterstitialLatency === 'number') {
|
|
352
|
-
return clickToInterstitialLatency;
|
|
350
|
+
return clamp(clickToInterstitialLatency, 0, this.MAX_INTEGER);
|
|
353
351
|
}
|
|
354
352
|
|
|
355
353
|
return undefined;
|
|
@@ -373,7 +371,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
373
371
|
);
|
|
374
372
|
|
|
375
373
|
if (typeof clickToInterstitialWithUserDelayLatency === 'number') {
|
|
376
|
-
return clickToInterstitialWithUserDelayLatency;
|
|
374
|
+
return clamp(clickToInterstitialWithUserDelayLatency, 0, this.MAX_INTEGER);
|
|
377
375
|
}
|
|
378
376
|
|
|
379
377
|
return undefined;
|
|
@@ -420,7 +418,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
420
418
|
if (interstitialJoinClickTimestamp && connectedMedia) {
|
|
421
419
|
const interstitialToMediaOKJmt = connectedMedia - interstitialJoinClickTimestamp - lobbyTime;
|
|
422
420
|
|
|
423
|
-
return
|
|
421
|
+
return clamp(interstitialToMediaOKJmt, 0, this.MAX_INTEGER);
|
|
424
422
|
}
|
|
425
423
|
|
|
426
424
|
return undefined;
|
|
@@ -435,7 +433,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
435
433
|
const interstitialToJoinOk = this.getInterstitialToJoinOK();
|
|
436
434
|
|
|
437
435
|
if (typeof clickToInterstitial === 'number' && typeof interstitialToJoinOk === 'number') {
|
|
438
|
-
return clickToInterstitial + interstitialToJoinOk;
|
|
436
|
+
return clamp(clickToInterstitial + interstitialToJoinOk, 0, this.MAX_INTEGER);
|
|
439
437
|
}
|
|
440
438
|
|
|
441
439
|
return undefined;
|
|
@@ -453,7 +451,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
453
451
|
typeof clickToInterstitialWithUserDelay === 'number' &&
|
|
454
452
|
typeof interstitialToJoinOk === 'number'
|
|
455
453
|
) {
|
|
456
|
-
return clickToInterstitialWithUserDelay + interstitialToJoinOk;
|
|
454
|
+
return clamp(clickToInterstitialWithUserDelay + interstitialToJoinOk, 0, this.MAX_INTEGER);
|
|
457
455
|
}
|
|
458
456
|
|
|
459
457
|
return undefined;
|
|
@@ -468,7 +466,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
468
466
|
const ICESetupTime = this.getICESetupTime();
|
|
469
467
|
|
|
470
468
|
if (joinReqResp && ICESetupTime) {
|
|
471
|
-
return joinReqResp + ICESetupTime;
|
|
469
|
+
return clamp(joinReqResp + ICESetupTime, 0, this.MAX_INTEGER);
|
|
472
470
|
}
|
|
473
471
|
|
|
474
472
|
return undefined;
|
|
@@ -485,12 +483,16 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
485
483
|
const lobbyTime = this.getStayLobbyTime();
|
|
486
484
|
|
|
487
485
|
if (clickToInterstitial && interstitialToJoinOk && joinConfJMT) {
|
|
488
|
-
const totalMediaJMT =
|
|
486
|
+
const totalMediaJMT = clamp(
|
|
487
|
+
clickToInterstitial + interstitialToJoinOk + joinConfJMT,
|
|
488
|
+
0,
|
|
489
|
+
Infinity
|
|
490
|
+
);
|
|
489
491
|
if (this.getMeeting()?.allowMediaInLobby) {
|
|
490
|
-
return totalMediaJMT;
|
|
492
|
+
return clamp(totalMediaJMT, 0, this.MAX_INTEGER);
|
|
491
493
|
}
|
|
492
494
|
|
|
493
|
-
return
|
|
495
|
+
return clamp(totalMediaJMT - lobbyTime, 0, this.MAX_INTEGER);
|
|
494
496
|
}
|
|
495
497
|
|
|
496
498
|
return undefined;
|
|
@@ -506,7 +508,11 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
506
508
|
const joinConfJMT = this.getJoinConfJMT();
|
|
507
509
|
|
|
508
510
|
if (clickToInterstitialWithUserDelay && interstitialToJoinOk && joinConfJMT) {
|
|
509
|
-
return
|
|
511
|
+
return clamp(
|
|
512
|
+
clickToInterstitialWithUserDelay + interstitialToJoinOk + joinConfJMT,
|
|
513
|
+
0,
|
|
514
|
+
this.MAX_INTEGER
|
|
515
|
+
);
|
|
510
516
|
}
|
|
511
517
|
|
|
512
518
|
return undefined;
|
|
@@ -521,7 +527,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
521
527
|
const joinConfJMT = this.getJoinConfJMT();
|
|
522
528
|
|
|
523
529
|
if (typeof interstitialToJoinOk === 'number' && typeof joinConfJMT === 'number') {
|
|
524
|
-
return
|
|
530
|
+
return clamp(interstitialToJoinOk - joinConfJMT, 0, this.MAX_INTEGER);
|
|
525
531
|
}
|
|
526
532
|
|
|
527
533
|
return undefined;
|
|
@@ -548,7 +554,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
548
554
|
const reachablityClusterReqResp = this.precomputedLatencies.get('internal.get.cluster.time');
|
|
549
555
|
|
|
550
556
|
return typeof reachablityClusterReqResp === 'number'
|
|
551
|
-
? Math.floor(reachablityClusterReqResp)
|
|
557
|
+
? clamp(Math.floor(reachablityClusterReqResp), 0, this.MAX_INTEGER)
|
|
552
558
|
: undefined;
|
|
553
559
|
}
|
|
554
560
|
|
|
@@ -582,7 +588,9 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
582
588
|
public getExchangeCITokenJMT() {
|
|
583
589
|
const exchangeCITokenJMT = this.precomputedLatencies.get('internal.exchange.ci.token.time');
|
|
584
590
|
|
|
585
|
-
return typeof exchangeCITokenJMT === 'number'
|
|
591
|
+
return typeof exchangeCITokenJMT === 'number'
|
|
592
|
+
? clamp(Math.floor(exchangeCITokenJMT), 0, this.MAX_INTEGER)
|
|
593
|
+
: undefined;
|
|
586
594
|
}
|
|
587
595
|
|
|
588
596
|
/**
|
|
@@ -592,7 +600,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
592
600
|
const refreshCaptchaReqResp = this.precomputedLatencies.get('internal.refresh.captcha.time');
|
|
593
601
|
|
|
594
602
|
return typeof refreshCaptchaReqResp === 'number'
|
|
595
|
-
? Math.floor(refreshCaptchaReqResp)
|
|
603
|
+
? clamp(Math.floor(refreshCaptchaReqResp), 0, this.MAX_INTEGER)
|
|
596
604
|
: undefined;
|
|
597
605
|
}
|
|
598
606
|
|
|
@@ -606,7 +614,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
606
614
|
);
|
|
607
615
|
|
|
608
616
|
return typeof downloadIntelligenceModelsReqResp === 'number'
|
|
609
|
-
? Math.floor(downloadIntelligenceModelsReqResp)
|
|
617
|
+
? clamp(Math.floor(downloadIntelligenceModelsReqResp), 0, this.MAX_INTEGER)
|
|
610
618
|
: undefined;
|
|
611
619
|
}
|
|
612
620
|
|
|
@@ -618,6 +626,6 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
|
|
|
618
626
|
public getOtherAppApiReqResp() {
|
|
619
627
|
const otherAppApiJMT = this.precomputedLatencies.get('internal.other.app.api.time');
|
|
620
628
|
|
|
621
|
-
return otherAppApiJMT > 0 ? Math.floor(otherAppApiJMT) : undefined;
|
|
629
|
+
return otherAppApiJMT > 0 ? clamp(Math.floor(otherAppApiJMT), 0, this.MAX_INTEGER) : undefined;
|
|
622
630
|
}
|
|
623
631
|
}
|
|
@@ -75,6 +75,7 @@ type GetOriginOptions = {
|
|
|
75
75
|
browserLaunchMethod?: BrowserLaunchMethodType;
|
|
76
76
|
environment?: EnvironmentType;
|
|
77
77
|
newEnvironment?: NewEnvironmentType;
|
|
78
|
+
vendorId?: string;
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
type GetIdentifiersOptions = {
|
|
@@ -297,6 +298,10 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
297
298
|
origin.clientInfo.browserLaunchMethod = options.browserLaunchMethod;
|
|
298
299
|
}
|
|
299
300
|
|
|
301
|
+
if (options?.vendorId) {
|
|
302
|
+
origin.clientInfo.vendorId = options.vendorId;
|
|
303
|
+
}
|
|
304
|
+
|
|
300
305
|
return origin;
|
|
301
306
|
}
|
|
302
307
|
|
|
@@ -1410,8 +1415,11 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
1410
1415
|
*/
|
|
1411
1416
|
public setDeviceInfo(device: any): void {
|
|
1412
1417
|
// This was created to fix the circular dependency between internal-plugin-device and internal-plugin-metrics
|
|
1413
|
-
this.logger.log('CallDiagnosticMetrics: @setDeviceInfo called',
|
|
1414
|
-
|
|
1418
|
+
this.logger.log('CallDiagnosticMetrics: @setDeviceInfo called', {
|
|
1419
|
+
userId: device?.userId,
|
|
1420
|
+
deviceId: device?.url,
|
|
1421
|
+
orgId: device?.orgId,
|
|
1422
|
+
});
|
|
1415
1423
|
this.device = device;
|
|
1416
1424
|
}
|
|
1417
1425
|
}
|
package/src/metrics.types.ts
CHANGED
|
@@ -131,7 +131,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
describe('getDiffBetweenTimestamps with clamping', () => {
|
|
134
|
-
it('should
|
|
134
|
+
it('should apply default clamping (min: 0, max: 2147483647) when no clampValues provided', () => {
|
|
135
135
|
cdl.saveTimestamp({key: 'client.alert.displayed', value: 10});
|
|
136
136
|
cdl.saveTimestamp({key: 'client.alert.removed', value: 50});
|
|
137
137
|
const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed');
|
|
@@ -204,6 +204,20 @@ describe('internal-plugin-metrics', () => {
|
|
|
204
204
|
});
|
|
205
205
|
assert.deepEqual(res, undefined);
|
|
206
206
|
});
|
|
207
|
+
|
|
208
|
+
it('should apply default minimum clamping (0) when no clampValues provided and diff is negative', () => {
|
|
209
|
+
cdl.saveTimestamp({key: 'client.alert.displayed', value: 100});
|
|
210
|
+
cdl.saveTimestamp({key: 'client.alert.removed', value: 50});
|
|
211
|
+
const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed');
|
|
212
|
+
assert.deepEqual(res, 0);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should clamp the value when a number greater than 2147483647', () => {
|
|
216
|
+
cdl.saveTimestamp({key: 'client.alert.displayed', value: 0});
|
|
217
|
+
cdl.saveTimestamp({key: 'client.alert.removed', value: 2147483648});
|
|
218
|
+
const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed');
|
|
219
|
+
assert.deepEqual(res, 2147483647);
|
|
220
|
+
});
|
|
207
221
|
});
|
|
208
222
|
|
|
209
223
|
it('calculates getMeetingInfoReqResp correctly', () => {
|
|
@@ -303,6 +317,12 @@ describe('internal-plugin-metrics', () => {
|
|
|
303
317
|
|
|
304
318
|
assert.deepEqual(cdl.getRefreshCaptchaReqResp(), 321);
|
|
305
319
|
});
|
|
320
|
+
|
|
321
|
+
it('returns the correct number when it is greater than 2147483647', () => {
|
|
322
|
+
cdl.saveLatency('internal.refresh.captcha.time', 4294967400);
|
|
323
|
+
|
|
324
|
+
assert.deepEqual(cdl.getRefreshCaptchaReqResp(), 2147483647);
|
|
325
|
+
});
|
|
306
326
|
});
|
|
307
327
|
|
|
308
328
|
describe('getReachabilityClustersReqResp', () => {
|
|
@@ -321,6 +341,12 @@ describe('internal-plugin-metrics', () => {
|
|
|
321
341
|
|
|
322
342
|
assert.deepEqual(cdl.getReachabilityClustersReqResp(), 321);
|
|
323
343
|
});
|
|
344
|
+
|
|
345
|
+
it('returns the correct number when it is greater than 2147483647', () => {
|
|
346
|
+
cdl.saveLatency('internal.get.cluster.time', 4294967400);
|
|
347
|
+
|
|
348
|
+
assert.deepEqual(cdl.getReachabilityClustersReqResp(), 2147483647);
|
|
349
|
+
});
|
|
324
350
|
});
|
|
325
351
|
|
|
326
352
|
describe('getExchangeCITokenJMT', () => {
|
|
@@ -339,6 +365,12 @@ describe('internal-plugin-metrics', () => {
|
|
|
339
365
|
|
|
340
366
|
assert.deepEqual(cdl.getExchangeCITokenJMT(), 321);
|
|
341
367
|
});
|
|
368
|
+
|
|
369
|
+
it('returns the correct number when it is greater than 2147483647', () => {
|
|
370
|
+
cdl.saveLatency('internal.exchange.ci.token.time', 4294967400);
|
|
371
|
+
|
|
372
|
+
assert.deepEqual(cdl.getExchangeCITokenJMT(), 2147483647);
|
|
373
|
+
});
|
|
342
374
|
});
|
|
343
375
|
|
|
344
376
|
describe('saveTimestamp', () => {
|
|
@@ -492,6 +524,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
492
524
|
assert.deepEqual(cdl.getPageJMT(), 10);
|
|
493
525
|
});
|
|
494
526
|
|
|
527
|
+
it('calculates getPageJMT correctly when it is greater than MAX_INTEGER', () => {
|
|
528
|
+
cdl.saveLatency('internal.client.pageJMT', 2147483648);
|
|
529
|
+
assert.deepEqual(cdl.getPageJMT(), 2147483647);
|
|
530
|
+
});
|
|
531
|
+
|
|
495
532
|
it('calculates getClickToInterstitial correctly', () => {
|
|
496
533
|
cdl.saveTimestamp({
|
|
497
534
|
key: 'internal.client.meeting.click.joinbutton',
|
|
@@ -522,6 +559,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
522
559
|
assert.deepEqual(cdl.getClickToInterstitial(), 0);
|
|
523
560
|
});
|
|
524
561
|
|
|
562
|
+
it('calculates getClickToInterstitial without join button timestamp when it is greater than MAX_INTEGER', () => {
|
|
563
|
+
cdl.saveLatency('internal.click.to.interstitial', 2147483648);
|
|
564
|
+
assert.deepEqual(cdl.getClickToInterstitial(), 2147483647);
|
|
565
|
+
});
|
|
566
|
+
|
|
525
567
|
it('calculates getClickToInterstitialWithUserDelay correctly', () => {
|
|
526
568
|
cdl.saveTimestamp({
|
|
527
569
|
key: 'internal.client.meeting.click.joinbutton',
|
|
@@ -552,6 +594,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
552
594
|
assert.deepEqual(cdl.getClickToInterstitialWithUserDelay(), 0);
|
|
553
595
|
});
|
|
554
596
|
|
|
597
|
+
it('calculates getClickToInterstitialWithUserDelay without join button timestamp when it is greater than MAX_INTEGER', () => {
|
|
598
|
+
cdl.saveLatency('internal.click.to.interstitial.with.user.delay', 2147483648);
|
|
599
|
+
assert.deepEqual(cdl.getClickToInterstitialWithUserDelay(), 2147483647);
|
|
600
|
+
});
|
|
601
|
+
|
|
555
602
|
it('calculates getInterstitialToJoinOK correctly', () => {
|
|
556
603
|
cdl.saveTimestamp({
|
|
557
604
|
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
@@ -660,6 +707,19 @@ describe('internal-plugin-metrics', () => {
|
|
|
660
707
|
assert.deepEqual(cdl.getTotalJMT(), undefined);
|
|
661
708
|
});
|
|
662
709
|
|
|
710
|
+
it('calculates getTotalJMT correctly when it is greater than MAX_INTEGER', () => {
|
|
711
|
+
cdl.saveTimestamp({
|
|
712
|
+
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
713
|
+
value: 5,
|
|
714
|
+
});
|
|
715
|
+
cdl.saveTimestamp({
|
|
716
|
+
key: 'client.locus.join.response',
|
|
717
|
+
value: 40,
|
|
718
|
+
});
|
|
719
|
+
cdl.saveLatency('internal.click.to.interstitial', 2147483648);
|
|
720
|
+
assert.deepEqual(cdl.getTotalJMT(), 2147483647);
|
|
721
|
+
});
|
|
722
|
+
|
|
663
723
|
it('calculates getTotalJMTWithUserDelay correctly', () => {
|
|
664
724
|
cdl.saveTimestamp({
|
|
665
725
|
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
@@ -732,6 +792,19 @@ describe('internal-plugin-metrics', () => {
|
|
|
732
792
|
assert.deepEqual(cdl.getTotalJMTWithUserDelay(), undefined);
|
|
733
793
|
});
|
|
734
794
|
|
|
795
|
+
it('calculates getTotalJMTWithUserDelay correctly when it is greater than MAX_INTEGER', () => {
|
|
796
|
+
cdl.saveLatency('internal.click.to.interstitial.with.user.delay', 2147483648);
|
|
797
|
+
cdl.saveTimestamp({
|
|
798
|
+
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
799
|
+
value: 20,
|
|
800
|
+
});
|
|
801
|
+
cdl.saveTimestamp({
|
|
802
|
+
key: 'client.locus.join.response',
|
|
803
|
+
value: 40,
|
|
804
|
+
});
|
|
805
|
+
assert.deepEqual(cdl.getTotalJMTWithUserDelay(), 2147483647);
|
|
806
|
+
});
|
|
807
|
+
|
|
735
808
|
it('calculates getTotalMediaJMT correctly', () => {
|
|
736
809
|
cdl.saveTimestamp({
|
|
737
810
|
key: 'internal.client.meeting.click.joinbutton',
|
|
@@ -768,6 +841,42 @@ describe('internal-plugin-metrics', () => {
|
|
|
768
841
|
assert.deepEqual(cdl.getTotalMediaJMT(), 27);
|
|
769
842
|
});
|
|
770
843
|
|
|
844
|
+
it('calculates getTotalMediaJMT correctly when it is greater than MAX_INTEGER', () => {
|
|
845
|
+
cdl.saveTimestamp({
|
|
846
|
+
key: 'internal.client.meeting.click.joinbutton',
|
|
847
|
+
value: 5,
|
|
848
|
+
});
|
|
849
|
+
cdl.saveTimestamp({
|
|
850
|
+
key: 'internal.client.meeting.interstitial-window.showed',
|
|
851
|
+
value: 8,
|
|
852
|
+
});
|
|
853
|
+
cdl.saveTimestamp({
|
|
854
|
+
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
855
|
+
value: 10,
|
|
856
|
+
});
|
|
857
|
+
cdl.saveTimestamp({
|
|
858
|
+
key: 'client.locus.join.request',
|
|
859
|
+
value: 12,
|
|
860
|
+
});
|
|
861
|
+
cdl.saveTimestamp({
|
|
862
|
+
key: 'client.locus.join.response',
|
|
863
|
+
value: 2147483700,
|
|
864
|
+
});
|
|
865
|
+
cdl.saveTimestamp({
|
|
866
|
+
key: 'internal.host.meeting.participant.admitted',
|
|
867
|
+
value: 2147483800,
|
|
868
|
+
});
|
|
869
|
+
cdl.saveTimestamp({
|
|
870
|
+
key: 'client.ice.start',
|
|
871
|
+
value: 30,
|
|
872
|
+
});
|
|
873
|
+
cdl.saveTimestamp({
|
|
874
|
+
key: 'client.ice.end',
|
|
875
|
+
value: 100,
|
|
876
|
+
});
|
|
877
|
+
assert.deepEqual(cdl.getTotalMediaJMT(), 2147483647);
|
|
878
|
+
});
|
|
879
|
+
|
|
771
880
|
it('calculates getTotalMediaJMT correctly with allowMediaInLobby true', () => {
|
|
772
881
|
cdl.saveTimestamp({
|
|
773
882
|
key: 'internal.client.meeting.click.joinbutton',
|
|
@@ -805,6 +914,43 @@ describe('internal-plugin-metrics', () => {
|
|
|
805
914
|
assert.deepEqual(cdl.getTotalMediaJMT(), 31);
|
|
806
915
|
});
|
|
807
916
|
|
|
917
|
+
it('calculates getTotalMediaJMT correctly with allowMediaInLobby true and it is greater than MAX_INTEGER', () => {
|
|
918
|
+
cdl.saveTimestamp({
|
|
919
|
+
key: 'internal.client.meeting.click.joinbutton',
|
|
920
|
+
value: 5,
|
|
921
|
+
options: {meetingId: 'meeting-id'},
|
|
922
|
+
});
|
|
923
|
+
cdl.saveTimestamp({
|
|
924
|
+
key: 'internal.client.meeting.interstitial-window.showed',
|
|
925
|
+
value: 100,
|
|
926
|
+
});
|
|
927
|
+
cdl.saveTimestamp({
|
|
928
|
+
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
929
|
+
value: 1000,
|
|
930
|
+
});
|
|
931
|
+
cdl.saveTimestamp({
|
|
932
|
+
key: 'client.locus.join.request',
|
|
933
|
+
value: 2000,
|
|
934
|
+
});
|
|
935
|
+
cdl.saveTimestamp({
|
|
936
|
+
key: 'client.locus.join.response',
|
|
937
|
+
value: 2147483700,
|
|
938
|
+
});
|
|
939
|
+
cdl.saveTimestamp({
|
|
940
|
+
key: 'internal.host.meeting.participant.admitted',
|
|
941
|
+
value: 2147483800,
|
|
942
|
+
});
|
|
943
|
+
cdl.saveTimestamp({
|
|
944
|
+
key: 'client.ice.start',
|
|
945
|
+
value: 2147483900,
|
|
946
|
+
});
|
|
947
|
+
cdl.saveTimestamp({
|
|
948
|
+
key: 'client.ice.end',
|
|
949
|
+
value: 4294967400,
|
|
950
|
+
});
|
|
951
|
+
assert.deepEqual(cdl.getTotalMediaJMT(), 2147483647);
|
|
952
|
+
});
|
|
953
|
+
|
|
808
954
|
it('calculates getTotalMediaJMTWithUserDelay correctly', () => {
|
|
809
955
|
cdl.saveLatency('internal.click.to.interstitial.with.user.delay', 7);
|
|
810
956
|
cdl.saveTimestamp({
|
|
@@ -890,6 +1036,28 @@ describe('internal-plugin-metrics', () => {
|
|
|
890
1036
|
assert.deepEqual(cdl.getJoinConfJMT(), 20);
|
|
891
1037
|
});
|
|
892
1038
|
|
|
1039
|
+
it('calculates getJoinConfJMT correctly when it is greater than MAX_INTEGER', () => {
|
|
1040
|
+
// Since both getJoinReqResp and getICESetupTime are individually clamped to 1200000,
|
|
1041
|
+
// the maximum possible sum is 2400000, which is less than MAX_INTEGER (2147483647).
|
|
1042
|
+
// This test should verify that the final clamping works by mocking the intermediate methods
|
|
1043
|
+
// to return values that would sum to more than MAX_INTEGER.
|
|
1044
|
+
|
|
1045
|
+
const originalGetJoinReqResp = cdl.getJoinReqResp;
|
|
1046
|
+
const originalGetICESetupTime = cdl.getICESetupTime;
|
|
1047
|
+
|
|
1048
|
+
// Mock the methods to return large values that would exceed MAX_INTEGER when summed
|
|
1049
|
+
cdl.getJoinReqResp = () => 1500000000;
|
|
1050
|
+
cdl.getICESetupTime = () => 1000000000;
|
|
1051
|
+
|
|
1052
|
+
const result = cdl.getJoinConfJMT();
|
|
1053
|
+
|
|
1054
|
+
// Restore original methods
|
|
1055
|
+
cdl.getJoinReqResp = originalGetJoinReqResp;
|
|
1056
|
+
cdl.getICESetupTime = originalGetICESetupTime;
|
|
1057
|
+
|
|
1058
|
+
assert.deepEqual(result, 2147483647);
|
|
1059
|
+
});
|
|
1060
|
+
|
|
893
1061
|
it('calculates getClientJMT correctly', () => {
|
|
894
1062
|
cdl.saveTimestamp({
|
|
895
1063
|
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
@@ -982,6 +1150,26 @@ describe('internal-plugin-metrics', () => {
|
|
|
982
1150
|
assert.deepEqual(cdl.getInterstitialToMediaOKJMT(), 8);
|
|
983
1151
|
});
|
|
984
1152
|
|
|
1153
|
+
it('calculates getInterstitialToMediaOKJMT correctly when it is greater than MAX_INTEGER', () => {
|
|
1154
|
+
cdl.saveTimestamp({
|
|
1155
|
+
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
1156
|
+
value: 4,
|
|
1157
|
+
});
|
|
1158
|
+
cdl.saveTimestamp({
|
|
1159
|
+
key: 'client.locus.join.response',
|
|
1160
|
+
value: 10,
|
|
1161
|
+
});
|
|
1162
|
+
cdl.saveTimestamp({
|
|
1163
|
+
key: 'internal.host.meeting.participant.admitted',
|
|
1164
|
+
value: 12,
|
|
1165
|
+
});
|
|
1166
|
+
cdl.saveTimestamp({
|
|
1167
|
+
key: 'client.ice.end',
|
|
1168
|
+
value: 2147483700,
|
|
1169
|
+
});
|
|
1170
|
+
assert.deepEqual(cdl.getInterstitialToMediaOKJMT(), 2147483647);
|
|
1171
|
+
});
|
|
1172
|
+
|
|
985
1173
|
it('calculates getInterstitialToMediaOKJMT correctly without lobby', () => {
|
|
986
1174
|
cdl.saveTimestamp({
|
|
987
1175
|
key: 'internal.client.interstitial-window.click.joinbutton',
|
|
@@ -1029,6 +1217,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
1029
1217
|
assert.deepEqual(cdl.getDownloadTimeJMT(), 1000);
|
|
1030
1218
|
});
|
|
1031
1219
|
|
|
1220
|
+
it('calculates getDownloadTimeJMT correctly when it is greater than MAX_INTEGER', () => {
|
|
1221
|
+
cdl.saveLatency('internal.download.time', 2147483648);
|
|
1222
|
+
assert.deepEqual(cdl.getDownloadTimeJMT(), 2147483647);
|
|
1223
|
+
});
|
|
1224
|
+
|
|
1032
1225
|
describe('getOtherAppApiReqResp', () => {
|
|
1033
1226
|
it('returns undefined when no precomputed value available', () => {
|
|
1034
1227
|
assert.deepEqual(cdl.getOtherAppApiReqResp(), undefined);
|
|
@@ -1051,6 +1244,12 @@ describe('internal-plugin-metrics', () => {
|
|
|
1051
1244
|
|
|
1052
1245
|
assert.deepEqual(cdl.getOtherAppApiReqResp(), 321);
|
|
1053
1246
|
});
|
|
1247
|
+
|
|
1248
|
+
it('returns the correct number when it is greater than 2147483647', () => {
|
|
1249
|
+
cdl.saveLatency('internal.other.app.api.time', 4294967400);
|
|
1250
|
+
|
|
1251
|
+
assert.deepEqual(cdl.getOtherAppApiReqResp(), 2147483647);
|
|
1252
|
+
});
|
|
1054
1253
|
});
|
|
1055
1254
|
});
|
|
1056
1255
|
});
|
|
@@ -264,6 +264,41 @@ describe('internal-plugin-metrics', () => {
|
|
|
264
264
|
});
|
|
265
265
|
});
|
|
266
266
|
|
|
267
|
+
it('should build origin correctly and vendorId can be passed in options', () => {
|
|
268
|
+
sinon.stub(CallDiagnosticUtils, 'anonymizeIPAddress').returns('1.1.1.1');
|
|
269
|
+
|
|
270
|
+
//@ts-ignore
|
|
271
|
+
const res = cd.getOrigin(
|
|
272
|
+
{
|
|
273
|
+
subClientType: 'WEB_APP',
|
|
274
|
+
clientType: 'TEAMS_CLIENT',
|
|
275
|
+
clientLaunchMethod: 'url-handler',
|
|
276
|
+
vendorId: 'GoogleMeet',
|
|
277
|
+
},
|
|
278
|
+
fakeMeeting.id
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
assert.deepEqual(res, {
|
|
282
|
+
clientInfo: {
|
|
283
|
+
browser: getBrowserName(),
|
|
284
|
+
browserVersion: getBrowserVersion(),
|
|
285
|
+
clientType: 'TEAMS_CLIENT',
|
|
286
|
+
clientVersion: 'webex-js-sdk/webex-version',
|
|
287
|
+
publicNetworkPrefix: '1.1.1.1',
|
|
288
|
+
localNetworkPrefix: '1.1.1.1',
|
|
289
|
+
os: getOSNameInternal(),
|
|
290
|
+
osVersion: getOSVersion() || 'unknown',
|
|
291
|
+
subClientType: 'WEB_APP',
|
|
292
|
+
clientLaunchMethod: 'url-handler',
|
|
293
|
+
vendorId: 'GoogleMeet',
|
|
294
|
+
},
|
|
295
|
+
environment: 'meeting_evn',
|
|
296
|
+
name: 'endpoint',
|
|
297
|
+
networkType: 'unknown',
|
|
298
|
+
userAgent,
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
267
302
|
it('should build origin correctly with browserLaunchMethod', () => {
|
|
268
303
|
sinon.stub(CallDiagnosticUtils, 'anonymizeIPAddress').returns('1.1.1.1');
|
|
269
304
|
|
|
@@ -3871,7 +3906,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
3871
3906
|
|
|
3872
3907
|
assert.deepEqual(webexLoggerLogCalls[0].args, [
|
|
3873
3908
|
'CallDiagnosticMetrics: @setDeviceInfo called',
|
|
3874
|
-
|
|
3909
|
+
{userId: 'userId', deviceId: 'deviceUrl', orgId: 'orgId'},
|
|
3875
3910
|
]);
|
|
3876
3911
|
|
|
3877
3912
|
assert.deepEqual(cd.device, device);
|