@webex/internal-plugin-metrics 3.9.0-next.4 → 3.9.0-next.6

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.
@@ -16,6 +16,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
16
16
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
17
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
18
18
  var _webexCore = require("@webex/webex-core");
19
+ var _lodash = require("lodash");
19
20
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
20
21
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable class-methods-use-this */ /* eslint-disable valid-jsdoc */
21
22
  // we only care about client event and feature event for now
@@ -41,6 +42,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
41
42
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "precomputedLatencies", void 0);
42
43
  // meetingId that the current latencies are for
43
44
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingId", void 0);
45
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "MAX_INTEGER", 2147483647);
44
46
  _this.latencyTimestamps = new _map.default();
45
47
  _this.precomputedLatencies = new _map.default();
46
48
  return _this;
@@ -180,13 +182,12 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
180
182
  return undefined;
181
183
  }
182
184
  var diff = end - start;
183
- if (!clampValues) {
184
- return diff;
185
- }
186
- var _clampValues$minimum = clampValues.minimum,
187
- minimum = _clampValues$minimum === void 0 ? 0 : _clampValues$minimum,
188
- maximum = clampValues.maximum;
189
- return Math.min(maximum !== null && maximum !== void 0 ? maximum : Infinity, Math.max(diff, minimum));
185
+ var _ref2 = clampValues || {},
186
+ _ref2$minimum = _ref2.minimum,
187
+ minimum = _ref2$minimum === void 0 ? 0 : _ref2$minimum,
188
+ _ref2$maximum = _ref2.maximum,
189
+ maximum = _ref2$maximum === void 0 ? this.MAX_INTEGER : _ref2$maximum;
190
+ return (0, _lodash.clamp)(diff, minimum, maximum);
190
191
  }
191
192
 
192
193
  /**
@@ -344,7 +345,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
344
345
  key: "getPageJMT",
345
346
  value: function getPageJMT() {
346
347
  var latency = this.precomputedLatencies.get('internal.client.pageJMT');
347
- return typeof latency === 'number' ? latency : undefined;
348
+ return typeof latency === 'number' ? (0, _lodash.clamp)(latency, 0, this.MAX_INTEGER) : undefined;
348
349
  }
349
350
 
350
351
  /**
@@ -355,7 +356,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
355
356
  key: "getDownloadTimeJMT",
356
357
  value: function getDownloadTimeJMT() {
357
358
  var latency = this.precomputedLatencies.get('internal.download.time');
358
- return typeof latency === 'number' ? latency : undefined;
359
+ return typeof latency === 'number' ? (0, _lodash.clamp)(latency, 0, this.MAX_INTEGER) : undefined;
359
360
  }
360
361
 
361
362
  /**
@@ -371,7 +372,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
371
372
  }
372
373
  var clickToInterstitialLatency = this.precomputedLatencies.get('internal.click.to.interstitial');
373
374
  if (typeof clickToInterstitialLatency === 'number') {
374
- return clickToInterstitialLatency;
375
+ return (0, _lodash.clamp)(clickToInterstitialLatency, 0, this.MAX_INTEGER);
375
376
  }
376
377
  return undefined;
377
378
  }
@@ -389,7 +390,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
389
390
  }
390
391
  var clickToInterstitialWithUserDelayLatency = this.precomputedLatencies.get('internal.click.to.interstitial.with.user.delay');
391
392
  if (typeof clickToInterstitialWithUserDelayLatency === 'number') {
392
- return clickToInterstitialWithUserDelayLatency;
393
+ return (0, _lodash.clamp)(clickToInterstitialWithUserDelayLatency, 0, this.MAX_INTEGER);
393
394
  }
394
395
  return undefined;
395
396
  }
@@ -431,7 +432,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
431
432
  var lobbyTime = typeof lobbyTimeLatency === 'number' ? lobbyTimeLatency : 0;
432
433
  if (interstitialJoinClickTimestamp && connectedMedia) {
433
434
  var interstitialToMediaOKJmt = connectedMedia - interstitialJoinClickTimestamp - lobbyTime;
434
- return Math.max(0, interstitialToMediaOKJmt);
435
+ return (0, _lodash.clamp)(interstitialToMediaOKJmt, 0, this.MAX_INTEGER);
435
436
  }
436
437
  return undefined;
437
438
  }
@@ -446,7 +447,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
446
447
  var clickToInterstitial = this.getClickToInterstitial();
447
448
  var interstitialToJoinOk = this.getInterstitialToJoinOK();
448
449
  if (typeof clickToInterstitial === 'number' && typeof interstitialToJoinOk === 'number') {
449
- return clickToInterstitial + interstitialToJoinOk;
450
+ return (0, _lodash.clamp)(clickToInterstitial + interstitialToJoinOk, 0, this.MAX_INTEGER);
450
451
  }
451
452
  return undefined;
452
453
  }
@@ -461,7 +462,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
461
462
  var clickToInterstitialWithUserDelay = this.getClickToInterstitialWithUserDelay();
462
463
  var interstitialToJoinOk = this.getInterstitialToJoinOK();
463
464
  if (typeof clickToInterstitialWithUserDelay === 'number' && typeof interstitialToJoinOk === 'number') {
464
- return clickToInterstitialWithUserDelay + interstitialToJoinOk;
465
+ return (0, _lodash.clamp)(clickToInterstitialWithUserDelay + interstitialToJoinOk, 0, this.MAX_INTEGER);
465
466
  }
466
467
  return undefined;
467
468
  }
@@ -476,7 +477,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
476
477
  var joinReqResp = this.getJoinReqResp();
477
478
  var ICESetupTime = this.getICESetupTime();
478
479
  if (joinReqResp && ICESetupTime) {
479
- return joinReqResp + ICESetupTime;
480
+ return (0, _lodash.clamp)(joinReqResp + ICESetupTime, 0, this.MAX_INTEGER);
480
481
  }
481
482
  return undefined;
482
483
  }
@@ -494,11 +495,11 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
494
495
  var lobbyTime = this.getStayLobbyTime();
495
496
  if (clickToInterstitial && interstitialToJoinOk && joinConfJMT) {
496
497
  var _this$getMeeting;
497
- var totalMediaJMT = Math.max(0, clickToInterstitial + interstitialToJoinOk + joinConfJMT);
498
+ var totalMediaJMT = (0, _lodash.clamp)(clickToInterstitial + interstitialToJoinOk + joinConfJMT, 0, Infinity);
498
499
  if ((_this$getMeeting = this.getMeeting()) !== null && _this$getMeeting !== void 0 && _this$getMeeting.allowMediaInLobby) {
499
- return totalMediaJMT;
500
+ return (0, _lodash.clamp)(totalMediaJMT, 0, this.MAX_INTEGER);
500
501
  }
501
- return Math.max(0, totalMediaJMT - lobbyTime);
502
+ return (0, _lodash.clamp)(totalMediaJMT - lobbyTime, 0, this.MAX_INTEGER);
502
503
  }
503
504
  return undefined;
504
505
  }
@@ -514,7 +515,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
514
515
  var interstitialToJoinOk = this.getInterstitialToJoinOK();
515
516
  var joinConfJMT = this.getJoinConfJMT();
516
517
  if (clickToInterstitialWithUserDelay && interstitialToJoinOk && joinConfJMT) {
517
- return Math.max(0, clickToInterstitialWithUserDelay + interstitialToJoinOk + joinConfJMT);
518
+ return (0, _lodash.clamp)(clickToInterstitialWithUserDelay + interstitialToJoinOk + joinConfJMT, 0, this.MAX_INTEGER);
518
519
  }
519
520
  return undefined;
520
521
  }
@@ -529,7 +530,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
529
530
  var interstitialToJoinOk = this.getInterstitialToJoinOK();
530
531
  var joinConfJMT = this.getJoinConfJMT();
531
532
  if (typeof interstitialToJoinOk === 'number' && typeof joinConfJMT === 'number') {
532
- return Math.max(0, interstitialToJoinOk - joinConfJMT);
533
+ return (0, _lodash.clamp)(interstitialToJoinOk - joinConfJMT, 0, this.MAX_INTEGER);
533
534
  }
534
535
  return undefined;
535
536
  }
@@ -559,7 +560,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
559
560
  key: "getReachabilityClustersReqResp",
560
561
  value: function getReachabilityClustersReqResp() {
561
562
  var reachablityClusterReqResp = this.precomputedLatencies.get('internal.get.cluster.time');
562
- return typeof reachablityClusterReqResp === 'number' ? Math.floor(reachablityClusterReqResp) : undefined;
563
+ return typeof reachablityClusterReqResp === 'number' ? (0, _lodash.clamp)(Math.floor(reachablityClusterReqResp), 0, this.MAX_INTEGER) : undefined;
563
564
  }
564
565
 
565
566
  /**
@@ -596,7 +597,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
596
597
  key: "getExchangeCITokenJMT",
597
598
  value: function getExchangeCITokenJMT() {
598
599
  var exchangeCITokenJMT = this.precomputedLatencies.get('internal.exchange.ci.token.time');
599
- return typeof exchangeCITokenJMT === 'number' ? Math.floor(exchangeCITokenJMT) : undefined;
600
+ return typeof exchangeCITokenJMT === 'number' ? (0, _lodash.clamp)(Math.floor(exchangeCITokenJMT), 0, this.MAX_INTEGER) : undefined;
600
601
  }
601
602
 
602
603
  /**
@@ -606,7 +607,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
606
607
  key: "getRefreshCaptchaReqResp",
607
608
  value: function getRefreshCaptchaReqResp() {
608
609
  var refreshCaptchaReqResp = this.precomputedLatencies.get('internal.refresh.captcha.time');
609
- return typeof refreshCaptchaReqResp === 'number' ? Math.floor(refreshCaptchaReqResp) : undefined;
610
+ return typeof refreshCaptchaReqResp === 'number' ? (0, _lodash.clamp)(Math.floor(refreshCaptchaReqResp), 0, this.MAX_INTEGER) : undefined;
610
611
  }
611
612
 
612
613
  /**
@@ -617,7 +618,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
617
618
  key: "getDownloadIntelligenceModelsReqResp",
618
619
  value: function getDownloadIntelligenceModelsReqResp() {
619
620
  var downloadIntelligenceModelsReqResp = this.precomputedLatencies.get('internal.api.fetch.intelligence.models');
620
- return typeof downloadIntelligenceModelsReqResp === 'number' ? Math.floor(downloadIntelligenceModelsReqResp) : undefined;
621
+ return typeof downloadIntelligenceModelsReqResp === 'number' ? (0, _lodash.clamp)(Math.floor(downloadIntelligenceModelsReqResp), 0, this.MAX_INTEGER) : undefined;
621
622
  }
622
623
 
623
624
  /**
@@ -629,7 +630,7 @@ var CallDiagnosticLatencies = exports.default = /*#__PURE__*/function (_WebexPlu
629
630
  key: "getOtherAppApiReqResp",
630
631
  value: function getOtherAppApiReqResp() {
631
632
  var otherAppApiJMT = this.precomputedLatencies.get('internal.other.app.api.time');
632
- return otherAppApiJMT > 0 ? Math.floor(otherAppApiJMT) : undefined;
633
+ return otherAppApiJMT > 0 ? (0, _lodash.clamp)(Math.floor(otherAppApiJMT), 0, this.MAX_INTEGER) : undefined;
633
634
  }
634
635
  }]);
635
636
  return CallDiagnosticLatencies;
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","CallDiagnosticLatencies","exports","_WebexPlugin","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","latencyTimestamps","_map","precomputedLatencies","_createClass2","key","value","clearTimestamps","clear","setMeetingId","meetingId","getMeeting","webex","meetings","getBasicMeetingInformation","undefined","saveTimestamp","_ref","_ref$value","Date","getTime","_ref$options","options","saveFirstTimestampOnly","set","delete","saveLatency","accumulate","existingValue","get","measureLatency","callback","_this2","start","performance","now","finally","has","getDiffBetweenTimestamps","a","b","clampValues","end","diff","_clampValues$minimum","minimum","maximum","Math","min","Infinity","max","getMeetingInfoReqResp","getShowInterstitialTime","getU2CTime","u2cLatency","floor","getRegisterWDMDeviceJMT","getCallInitJoinReq","getJoinReqResp","getTurnDiscoveryTime","getLocalSDPGenRemoteSDPRecv","getICESetupTime","getAudioICESetupTime","getVideoICESetupTime","getShareICESetupTime","getStayLobbyTime","getPageJMT","latency","getDownloadTimeJMT","getClickToInterstitial","clickToInterstitialLatency","getClickToInterstitialWithUserDelay","clickToInterstitialWithUserDelayLatency","getInterstitialToJoinOK","getCallInitMediaEngineReady","getInterstitialToMediaOKJMT","interstitialJoinClickTimestamp","connectedMedia","lobbyTimeLatency","lobbyTime","interstitialToMediaOKJmt","getTotalJMT","clickToInterstitial","interstitialToJoinOk","getTotalJMTWithUserDelay","clickToInterstitialWithUserDelay","getJoinConfJMT","joinReqResp","ICESetupTime","getTotalMediaJMT","joinConfJMT","_this$getMeeting","totalMediaJMT","allowMediaInLobby","getTotalMediaJMTWithUserDelay","getClientJMT","getAudioJoinRespRxStart","getVideoJoinRespRxStart","getReachabilityClustersReqResp","reachablityClusterReqResp","getAudioJoinRespTxStart","getVideoJoinRespTxStart","getShareDuration","getExchangeCITokenJMT","exchangeCITokenJMT","getRefreshCaptchaReqResp","refreshCaptchaReqResp","getDownloadIntelligenceModelsReqResp","downloadIntelligenceModelsReqResp","getOtherAppApiReqResp","otherAppApiJMT","WebexPlugin"],"sources":["call-diagnostic-metrics-latencies.ts"],"sourcesContent":["/* eslint-disable class-methods-use-this */\n/* eslint-disable valid-jsdoc */\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport {MetricEventNames, PreComputedLatencies} from '../metrics.types';\n\n// we only care about client event and feature event for now\n\n/**\n * @description Helper class to store latencies timestamp and to calculate various latencies for CA.\n * @exports\n * @class CallDiagnosticLatencies\n */\nexport default class CallDiagnosticLatencies extends WebexPlugin {\n latencyTimestamps: Map<MetricEventNames, number>;\n precomputedLatencies: Map<PreComputedLatencies, number>;\n // meetingId that the current latencies are for\n private meetingId?: string;\n\n /**\n * @constructor\n */\n constructor(...args) {\n super(...args);\n this.latencyTimestamps = new Map();\n this.precomputedLatencies = new Map();\n }\n\n /**\n * Clear timestamps\n */\n public clearTimestamps() {\n this.latencyTimestamps.clear();\n this.precomputedLatencies.clear();\n }\n\n /**\n * Associate current latencies with a meeting id\n * @param meetingId\n */\n private setMeetingId(meetingId: string) {\n this.meetingId = meetingId;\n }\n\n /**\n * Returns the meeting object associated with current latencies\n * @returns meeting object\n */\n private getMeeting() {\n if (this.meetingId) {\n // @ts-ignore\n return this.webex.meetings.getBasicMeetingInformation(this.meetingId);\n }\n\n return undefined;\n }\n\n /**\n * Store timestamp value\n * @param key - key\n * @param value - value\n * @param options - store options\n * @throws\n * @returns\n */\n public saveTimestamp({\n key,\n value = new Date().getTime(),\n options = {},\n }: {\n key: MetricEventNames;\n value?: number;\n options?: {meetingId?: string};\n }) {\n // save the meetingId so we can use the meeting object in latency calculations if needed\n const {meetingId} = options;\n if (meetingId) {\n this.setMeetingId(meetingId);\n }\n // for some events we're only interested in the first timestamp not last\n // as these events can happen multiple times\n if (\n key === 'client.media.rx.start' ||\n key === 'client.media.tx.start' ||\n key === 'internal.client.meetinginfo.request' ||\n key === 'internal.client.meetinginfo.response' ||\n key === 'client.media-engine.remote-sdp-received'\n ) {\n this.saveFirstTimestampOnly(key, value);\n } else {\n this.latencyTimestamps.set(key, value);\n // new offer/answer so reset the remote SDP timestamp\n if (key === 'client.media-engine.local-sdp-generated') {\n this.latencyTimestamps.delete('client.media-engine.remote-sdp-received');\n }\n }\n }\n\n /**\n * Store precomputed latency value\n * @param key - key\n * @param value - value\n * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement\n * @throws\n * @returns\n */\n public saveLatency(key: PreComputedLatencies, value: number, accumulate = false) {\n const existingValue = accumulate ? this.precomputedLatencies.get(key) || 0 : 0;\n this.precomputedLatencies.set(key, value + existingValue);\n }\n\n /**\n * Measure latency for a request\n * @param callback - callback for which you would like to measure latency\n * @param key - key\n * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement\n * @returns\n */\n public measureLatency(\n callback: () => Promise<unknown>,\n key: PreComputedLatencies,\n accumulate = false\n ) {\n const start = performance.now();\n\n return callback().finally(() => {\n this.saveLatency(key, performance.now() - start, accumulate);\n });\n }\n\n /**\n * Store only the first timestamp value for the given key\n * @param key - key\n * @param value -value\n * @throws\n * @returns\n */\n saveFirstTimestampOnly(key: MetricEventNames, value: number = new Date().getTime()) {\n if (this.latencyTimestamps.has(key)) {\n return;\n }\n this.latencyTimestamps.set(key, value);\n }\n\n /**\n * Helper to calculate end - start\n * @param a start\n * @param b end\n * @returns latency\n */\n public getDiffBetweenTimestamps(\n a: MetricEventNames,\n b: MetricEventNames,\n clampValues?: {minimum?: number; maximum?: number}\n ) {\n const start = this.latencyTimestamps.get(a);\n const end = this.latencyTimestamps.get(b);\n\n if (typeof start !== 'number' || typeof end !== 'number') {\n return undefined;\n }\n\n const diff = end - start;\n\n if (!clampValues) {\n return diff;\n }\n\n const {minimum = 0, maximum} = clampValues;\n\n return Math.min(maximum ?? Infinity, Math.max(diff, minimum));\n }\n\n /**\n * Meeting Info Request\n * @note Meeting Info request happen not just in the join phase. CA requires\n * metrics around meeting info request that are only part of join phase.\n * This internal.* event is used to track the real timestamps\n * (when the actual request/response happen). This is because the actual CA event is\n * sent inside the join method on the meeting object based on some logic, but that's not exactly when\n * those events are actually fired. The logic only confirms that they have happened, and we send them over.\n * @returns - latency\n */\n public getMeetingInfoReqResp() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.meetinginfo.request',\n 'internal.client.meetinginfo.response',\n {maximum: 1200000}\n );\n }\n\n /**\n * Interstitial Time\n * @returns - latency\n */\n public getShowInterstitialTime() {\n return this.getDiffBetweenTimestamps(\n 'client.interstitial-window.start-launch',\n 'internal.client.interstitial-window.click.joinbutton'\n );\n }\n\n /**\n * getU2CTime\n * @returns - latency\n */\n public getU2CTime() {\n const u2cLatency = this.precomputedLatencies.get('internal.get.u2c.time');\n\n return typeof u2cLatency === 'number' ? Math.floor(u2cLatency) : undefined;\n }\n\n /**\n * Device Register Time\n * @returns - latency\n */\n public getRegisterWDMDeviceJMT() {\n return this.getDiffBetweenTimestamps(\n 'internal.register.device.request',\n 'internal.register.device.response'\n );\n }\n\n /**\n * Call Init Join Request\n * @returns - latency\n */\n public getCallInitJoinReq() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.interstitial-window.click.joinbutton',\n 'client.locus.join.request',\n {maximum: 1200000}\n );\n }\n\n /**\n * Locus Join Request\n * @returns - latency\n */\n public getJoinReqResp() {\n return this.getDiffBetweenTimestamps(\n 'client.locus.join.request',\n 'client.locus.join.response',\n {maximum: 1200000}\n );\n }\n\n /**\n * Time taken to do turn discovery\n * @returns - latency\n */\n public getTurnDiscoveryTime() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.add-media.turn-discovery.start',\n 'internal.client.add-media.turn-discovery.end'\n );\n }\n\n /**\n * Local SDP Generated Remote SDP REceived\n * @returns - latency\n */\n public getLocalSDPGenRemoteSDPRecv() {\n return this.getDiffBetweenTimestamps(\n 'client.media-engine.local-sdp-generated',\n 'client.media-engine.remote-sdp-received',\n {maximum: 1200000}\n );\n }\n\n /**\n * ICE Setup Time\n * @returns - latency\n */\n public getICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end', {maximum: 1200000});\n }\n\n /**\n * Audio ICE time\n * @returns - latency\n */\n public getAudioICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');\n }\n\n /**\n * Video ICE Time\n * @returns - latency\n */\n public getVideoICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');\n }\n\n /**\n * Share ICE Time\n * @returns - latency\n */\n public getShareICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');\n }\n\n /**\n * Stay Lobby Time\n * @returns - latency\n */\n public getStayLobbyTime() {\n return this.getDiffBetweenTimestamps(\n 'client.locus.join.response',\n 'internal.host.meeting.participant.admitted'\n );\n }\n\n /**\n * Page JMT\n * @returns - latency\n */\n public getPageJMT() {\n const latency = this.precomputedLatencies.get('internal.client.pageJMT');\n\n return typeof latency === 'number' ? latency : undefined;\n }\n\n /**\n * Download Time JMT\n * @returns - latency\n */\n public getDownloadTimeJMT() {\n const latency = this.precomputedLatencies.get('internal.download.time');\n\n return typeof latency === 'number' ? latency : undefined;\n }\n\n /**\n * Click To Interstitial\n * @returns - latency\n */\n public getClickToInterstitial() {\n // for normal join (where green join button exists before interstitial, i.e reminder, space list etc)\n if (this.latencyTimestamps.get('internal.client.meeting.click.joinbutton')) {\n return this.getDiffBetweenTimestamps(\n 'internal.client.meeting.click.joinbutton',\n 'internal.client.meeting.interstitial-window.showed'\n );\n }\n\n const clickToInterstitialLatency = this.precomputedLatencies.get(\n 'internal.click.to.interstitial'\n );\n\n if (typeof clickToInterstitialLatency === 'number') {\n return clickToInterstitialLatency;\n }\n\n return undefined;\n }\n\n /**\n * Click To Interstitial With User Delay\n * @returns - latency\n */\n public getClickToInterstitialWithUserDelay() {\n // for normal join (where green join button exists before interstitial, i.e reminder, space list etc)\n if (this.latencyTimestamps.get('internal.client.meeting.click.joinbutton')) {\n return this.getDiffBetweenTimestamps(\n 'internal.client.meeting.click.joinbutton',\n 'internal.client.meeting.interstitial-window.showed'\n );\n }\n\n const clickToInterstitialWithUserDelayLatency = this.precomputedLatencies.get(\n 'internal.click.to.interstitial.with.user.delay'\n );\n\n if (typeof clickToInterstitialWithUserDelayLatency === 'number') {\n return clickToInterstitialWithUserDelayLatency;\n }\n\n return undefined;\n }\n\n /**\n * Interstitial To Join Ok\n * @returns - latency\n */\n public getInterstitialToJoinOK() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.interstitial-window.click.joinbutton',\n 'client.locus.join.response'\n );\n }\n\n /**\n * Call Init To MediaEngineReady\n * @returns - latency\n */\n public getCallInitMediaEngineReady() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.interstitial-window.click.joinbutton',\n 'client.media-engine.ready',\n {maximum: 1200000}\n );\n }\n\n /**\n * Interstitial To Media Ok\n * @returns - latency\n */\n public getInterstitialToMediaOKJMT() {\n const interstitialJoinClickTimestamp = this.latencyTimestamps.get(\n 'internal.client.interstitial-window.click.joinbutton'\n );\n\n // get the first timestamp\n const connectedMedia = this.latencyTimestamps.get('client.ice.end');\n\n const lobbyTimeLatency = this.getStayLobbyTime();\n const lobbyTime = typeof lobbyTimeLatency === 'number' ? lobbyTimeLatency : 0;\n\n if (interstitialJoinClickTimestamp && connectedMedia) {\n const interstitialToMediaOKJmt = connectedMedia - interstitialJoinClickTimestamp - lobbyTime;\n\n return Math.max(0, interstitialToMediaOKJmt);\n }\n\n return undefined;\n }\n\n /**\n * Total JMT\n * @returns - latency\n */\n public getTotalJMT() {\n const clickToInterstitial = this.getClickToInterstitial();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n\n if (typeof clickToInterstitial === 'number' && typeof interstitialToJoinOk === 'number') {\n return clickToInterstitial + interstitialToJoinOk;\n }\n\n return undefined;\n }\n\n /**\n * Total JMT With User Delay\n * @returns - latency\n */\n public getTotalJMTWithUserDelay() {\n const clickToInterstitialWithUserDelay = this.getClickToInterstitialWithUserDelay();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n\n if (\n typeof clickToInterstitialWithUserDelay === 'number' &&\n typeof interstitialToJoinOk === 'number'\n ) {\n return clickToInterstitialWithUserDelay + interstitialToJoinOk;\n }\n\n return undefined;\n }\n\n /**\n * Join Conf JMT\n * @returns - latency\n */\n public getJoinConfJMT() {\n const joinReqResp = this.getJoinReqResp();\n const ICESetupTime = this.getICESetupTime();\n\n if (joinReqResp && ICESetupTime) {\n return joinReqResp + ICESetupTime;\n }\n\n return undefined;\n }\n\n /**\n * Total Media JMT\n * @returns - latency\n */\n public getTotalMediaJMT() {\n const clickToInterstitial = this.getClickToInterstitial();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n const joinConfJMT = this.getJoinConfJMT();\n const lobbyTime = this.getStayLobbyTime();\n\n if (clickToInterstitial && interstitialToJoinOk && joinConfJMT) {\n const totalMediaJMT = Math.max(0, clickToInterstitial + interstitialToJoinOk + joinConfJMT);\n if (this.getMeeting()?.allowMediaInLobby) {\n return totalMediaJMT;\n }\n\n return Math.max(0, totalMediaJMT - lobbyTime);\n }\n\n return undefined;\n }\n\n /**\n * Total Media JMT With User Delay\n * @returns - latency\n */\n public getTotalMediaJMTWithUserDelay() {\n const clickToInterstitialWithUserDelay = this.getClickToInterstitialWithUserDelay();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n const joinConfJMT = this.getJoinConfJMT();\n\n if (clickToInterstitialWithUserDelay && interstitialToJoinOk && joinConfJMT) {\n return Math.max(0, clickToInterstitialWithUserDelay + interstitialToJoinOk + joinConfJMT);\n }\n\n return undefined;\n }\n\n /**\n * Client JMT\n * @returns - latency\n */\n public getClientJMT() {\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n const joinConfJMT = this.getJoinConfJMT();\n\n if (typeof interstitialToJoinOk === 'number' && typeof joinConfJMT === 'number') {\n return Math.max(0, interstitialToJoinOk - joinConfJMT);\n }\n\n return undefined;\n }\n\n /**\n * Audio setup delay receive\n */\n public getAudioJoinRespRxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.rx.start');\n }\n\n /**\n * Video setup delay receive\n */\n public getVideoJoinRespRxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.rx.start');\n }\n\n /**\n * Total latency for all get cluster request.\n */\n public getReachabilityClustersReqResp() {\n const reachablityClusterReqResp = this.precomputedLatencies.get('internal.get.cluster.time');\n\n return typeof reachablityClusterReqResp === 'number'\n ? Math.floor(reachablityClusterReqResp)\n : undefined;\n }\n\n /**\n * Audio setup delay transmit\n */\n public getAudioJoinRespTxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');\n }\n\n /**\n * Video setup delay transmit\n */\n public getVideoJoinRespTxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');\n }\n\n /**\n * Time from share initiation to share stop (ms).\n */\n public getShareDuration() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.share.initiated',\n 'internal.client.share.stopped'\n );\n }\n\n /**\n * Total latency for all exchange ci token.\n */\n public getExchangeCITokenJMT() {\n const exchangeCITokenJMT = this.precomputedLatencies.get('internal.exchange.ci.token.time');\n\n return typeof exchangeCITokenJMT === 'number' ? Math.floor(exchangeCITokenJMT) : undefined;\n }\n\n /**\n * Total latency for all refresh captcha requests.\n */\n public getRefreshCaptchaReqResp() {\n const refreshCaptchaReqResp = this.precomputedLatencies.get('internal.refresh.captcha.time');\n\n return typeof refreshCaptchaReqResp === 'number'\n ? Math.floor(refreshCaptchaReqResp)\n : undefined;\n }\n\n /**\n * Get the latency for downloading intelligence models.\n * @returns - latency\n */\n public getDownloadIntelligenceModelsReqResp() {\n const downloadIntelligenceModelsReqResp = this.precomputedLatencies.get(\n 'internal.api.fetch.intelligence.models'\n );\n\n return typeof downloadIntelligenceModelsReqResp === 'number'\n ? Math.floor(downloadIntelligenceModelsReqResp)\n : undefined;\n }\n\n /**\n * Get the total latency for all other app API requests.\n * Excludes meeting info, because it's measured separately.\n * @returns - latency\n */\n public getOtherAppApiReqResp() {\n const ot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AC3G,oBAAoB,CAAC0B,GAAG,CAAC,6BAA6B,CAAC;MAEnF,OAAOiF,cAAc,GAAG,CAAC,GAAG/D,IAAI,CAACQ,KAAK,CAACuD,cAAc,CAAC,GAAG/F,SAAS;IACpE;EAAC;EAAA,OAAA7B,uBAAA;AAAA,EAhmBkD6H,sBAAW"}
1
+ {"version":3,"names":["_webexCore","require","_lodash","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","CallDiagnosticLatencies","exports","_WebexPlugin","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","latencyTimestamps","_map","precomputedLatencies","_createClass2","key","value","clearTimestamps","clear","setMeetingId","meetingId","getMeeting","webex","meetings","getBasicMeetingInformation","undefined","saveTimestamp","_ref","_ref$value","Date","getTime","_ref$options","options","saveFirstTimestampOnly","set","delete","saveLatency","accumulate","existingValue","get","measureLatency","callback","_this2","start","performance","now","finally","has","getDiffBetweenTimestamps","a","b","clampValues","end","diff","_ref2","_ref2$minimum","minimum","_ref2$maximum","maximum","MAX_INTEGER","clamp","getMeetingInfoReqResp","getShowInterstitialTime","getU2CTime","u2cLatency","Math","floor","getRegisterWDMDeviceJMT","getCallInitJoinReq","getJoinReqResp","getTurnDiscoveryTime","getLocalSDPGenRemoteSDPRecv","getICESetupTime","getAudioICESetupTime","getVideoICESetupTime","getShareICESetupTime","getStayLobbyTime","getPageJMT","latency","getDownloadTimeJMT","getClickToInterstitial","clickToInterstitialLatency","getClickToInterstitialWithUserDelay","clickToInterstitialWithUserDelayLatency","getInterstitialToJoinOK","getCallInitMediaEngineReady","getInterstitialToMediaOKJMT","interstitialJoinClickTimestamp","connectedMedia","lobbyTimeLatency","lobbyTime","interstitialToMediaOKJmt","getTotalJMT","clickToInterstitial","interstitialToJoinOk","getTotalJMTWithUserDelay","clickToInterstitialWithUserDelay","getJoinConfJMT","joinReqResp","ICESetupTime","getTotalMediaJMT","joinConfJMT","_this$getMeeting","totalMediaJMT","Infinity","allowMediaInLobby","getTotalMediaJMTWithUserDelay","getClientJMT","getAudioJoinRespRxStart","getVideoJoinRespRxStart","getReachabilityClustersReqResp","reachablityClusterReqResp","getAudioJoinRespTxStart","getVideoJoinRespTxStart","getShareDuration","getExchangeCITokenJMT","exchangeCITokenJMT","getRefreshCaptchaReqResp","refreshCaptchaReqResp","getDownloadIntelligenceModelsReqResp","downloadIntelligenceModelsReqResp","getOtherAppApiReqResp","otherAppApiJMT","WebexPlugin"],"sources":["call-diagnostic-metrics-latencies.ts"],"sourcesContent":["/* eslint-disable class-methods-use-this */\n/* eslint-disable valid-jsdoc */\nimport {WebexPlugin} from '@webex/webex-core';\nimport {clamp} from 'lodash';\n\nimport {MetricEventNames, PreComputedLatencies} from '../metrics.types';\n\n// we only care about client event and feature event for now\n\n/**\n * @description Helper class to store latencies timestamp and to calculate various latencies for CA.\n * @exports\n * @class CallDiagnosticLatencies\n */\nexport default class CallDiagnosticLatencies extends WebexPlugin {\n latencyTimestamps: Map<MetricEventNames, number>;\n precomputedLatencies: Map<PreComputedLatencies, number>;\n // meetingId that the current latencies are for\n private meetingId?: string;\n private MAX_INTEGER = 2147483647;\n\n /**\n * @constructor\n */\n constructor(...args) {\n super(...args);\n this.latencyTimestamps = new Map();\n this.precomputedLatencies = new Map();\n }\n\n /**\n * Clear timestamps\n */\n public clearTimestamps() {\n this.latencyTimestamps.clear();\n this.precomputedLatencies.clear();\n }\n\n /**\n * Associate current latencies with a meeting id\n * @param meetingId\n */\n private setMeetingId(meetingId: string) {\n this.meetingId = meetingId;\n }\n\n /**\n * Returns the meeting object associated with current latencies\n * @returns meeting object\n */\n private getMeeting() {\n if (this.meetingId) {\n // @ts-ignore\n return this.webex.meetings.getBasicMeetingInformation(this.meetingId);\n }\n\n return undefined;\n }\n\n /**\n * Store timestamp value\n * @param key - key\n * @param value - value\n * @param options - store options\n * @throws\n * @returns\n */\n public saveTimestamp({\n key,\n value = new Date().getTime(),\n options = {},\n }: {\n key: MetricEventNames;\n value?: number;\n options?: {meetingId?: string};\n }) {\n // save the meetingId so we can use the meeting object in latency calculations if needed\n const {meetingId} = options;\n if (meetingId) {\n this.setMeetingId(meetingId);\n }\n // for some events we're only interested in the first timestamp not last\n // as these events can happen multiple times\n if (\n key === 'client.media.rx.start' ||\n key === 'client.media.tx.start' ||\n key === 'internal.client.meetinginfo.request' ||\n key === 'internal.client.meetinginfo.response' ||\n key === 'client.media-engine.remote-sdp-received'\n ) {\n this.saveFirstTimestampOnly(key, value);\n } else {\n this.latencyTimestamps.set(key, value);\n // new offer/answer so reset the remote SDP timestamp\n if (key === 'client.media-engine.local-sdp-generated') {\n this.latencyTimestamps.delete('client.media-engine.remote-sdp-received');\n }\n }\n }\n\n /**\n * Store precomputed latency value\n * @param key - key\n * @param value - value\n * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement\n * @throws\n * @returns\n */\n public saveLatency(key: PreComputedLatencies, value: number, accumulate = false) {\n const existingValue = accumulate ? this.precomputedLatencies.get(key) || 0 : 0;\n this.precomputedLatencies.set(key, value + existingValue);\n }\n\n /**\n * Measure latency for a request\n * @param callback - callback for which you would like to measure latency\n * @param key - key\n * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement\n * @returns\n */\n public measureLatency(\n callback: () => Promise<unknown>,\n key: PreComputedLatencies,\n accumulate = false\n ) {\n const start = performance.now();\n\n return callback().finally(() => {\n this.saveLatency(key, performance.now() - start, accumulate);\n });\n }\n\n /**\n * Store only the first timestamp value for the given key\n * @param key - key\n * @param value -value\n * @throws\n * @returns\n */\n saveFirstTimestampOnly(key: MetricEventNames, value: number = new Date().getTime()) {\n if (this.latencyTimestamps.has(key)) {\n return;\n }\n this.latencyTimestamps.set(key, value);\n }\n\n /**\n * Helper to calculate end - start\n * @param a start\n * @param b end\n * @returns latency\n */\n public getDiffBetweenTimestamps(\n a: MetricEventNames,\n b: MetricEventNames,\n clampValues?: {minimum?: number; maximum?: number}\n ) {\n const start = this.latencyTimestamps.get(a);\n const end = this.latencyTimestamps.get(b);\n\n if (typeof start !== 'number' || typeof end !== 'number') {\n return undefined;\n }\n\n const diff = end - start;\n\n const {minimum = 0, maximum = this.MAX_INTEGER} = clampValues || {};\n\n return clamp(diff, minimum, maximum);\n }\n\n /**\n * Meeting Info Request\n * @note Meeting Info request happen not just in the join phase. CA requires\n * metrics around meeting info request that are only part of join phase.\n * This internal.* event is used to track the real timestamps\n * (when the actual request/response happen). This is because the actual CA event is\n * sent inside the join method on the meeting object based on some logic, but that's not exactly when\n * those events are actually fired. The logic only confirms that they have happened, and we send them over.\n * @returns - latency\n */\n public getMeetingInfoReqResp() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.meetinginfo.request',\n 'internal.client.meetinginfo.response',\n {maximum: 1200000}\n );\n }\n\n /**\n * Interstitial Time\n * @returns - latency\n */\n public getShowInterstitialTime() {\n return this.getDiffBetweenTimestamps(\n 'client.interstitial-window.start-launch',\n 'internal.client.interstitial-window.click.joinbutton'\n );\n }\n\n /**\n * getU2CTime\n * @returns - latency\n */\n public getU2CTime() {\n const u2cLatency = this.precomputedLatencies.get('internal.get.u2c.time');\n\n return typeof u2cLatency === 'number' ? Math.floor(u2cLatency) : undefined;\n }\n\n /**\n * Device Register Time\n * @returns - latency\n */\n public getRegisterWDMDeviceJMT() {\n return this.getDiffBetweenTimestamps(\n 'internal.register.device.request',\n 'internal.register.device.response'\n );\n }\n\n /**\n * Call Init Join Request\n * @returns - latency\n */\n public getCallInitJoinReq() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.interstitial-window.click.joinbutton',\n 'client.locus.join.request',\n {maximum: 1200000}\n );\n }\n\n /**\n * Locus Join Request\n * @returns - latency\n */\n public getJoinReqResp() {\n return this.getDiffBetweenTimestamps(\n 'client.locus.join.request',\n 'client.locus.join.response',\n {maximum: 1200000}\n );\n }\n\n /**\n * Time taken to do turn discovery\n * @returns - latency\n */\n public getTurnDiscoveryTime() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.add-media.turn-discovery.start',\n 'internal.client.add-media.turn-discovery.end'\n );\n }\n\n /**\n * Local SDP Generated Remote SDP REceived\n * @returns - latency\n */\n public getLocalSDPGenRemoteSDPRecv() {\n return this.getDiffBetweenTimestamps(\n 'client.media-engine.local-sdp-generated',\n 'client.media-engine.remote-sdp-received',\n {maximum: 1200000}\n );\n }\n\n /**\n * ICE Setup Time\n * @returns - latency\n */\n public getICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end', {maximum: 1200000});\n }\n\n /**\n * Audio ICE time\n * @returns - latency\n */\n public getAudioICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');\n }\n\n /**\n * Video ICE Time\n * @returns - latency\n */\n public getVideoICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');\n }\n\n /**\n * Share ICE Time\n * @returns - latency\n */\n public getShareICESetupTime() {\n return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');\n }\n\n /**\n * Stay Lobby Time\n * @returns - latency\n */\n public getStayLobbyTime() {\n return this.getDiffBetweenTimestamps(\n 'client.locus.join.response',\n 'internal.host.meeting.participant.admitted'\n );\n }\n\n /**\n * Page JMT\n * @returns - latency\n */\n public getPageJMT() {\n const latency = this.precomputedLatencies.get('internal.client.pageJMT');\n\n return typeof latency === 'number' ? clamp(latency, 0, this.MAX_INTEGER) : undefined;\n }\n\n /**\n * Download Time JMT\n * @returns - latency\n */\n public getDownloadTimeJMT() {\n const latency = this.precomputedLatencies.get('internal.download.time');\n\n return typeof latency === 'number' ? clamp(latency, 0, this.MAX_INTEGER) : undefined;\n }\n\n /**\n * Click To Interstitial\n * @returns - latency\n */\n public getClickToInterstitial() {\n // for normal join (where green join button exists before interstitial, i.e reminder, space list etc)\n if (this.latencyTimestamps.get('internal.client.meeting.click.joinbutton')) {\n return this.getDiffBetweenTimestamps(\n 'internal.client.meeting.click.joinbutton',\n 'internal.client.meeting.interstitial-window.showed'\n );\n }\n\n const clickToInterstitialLatency = this.precomputedLatencies.get(\n 'internal.click.to.interstitial'\n );\n\n if (typeof clickToInterstitialLatency === 'number') {\n return clamp(clickToInterstitialLatency, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Click To Interstitial With User Delay\n * @returns - latency\n */\n public getClickToInterstitialWithUserDelay() {\n // for normal join (where green join button exists before interstitial, i.e reminder, space list etc)\n if (this.latencyTimestamps.get('internal.client.meeting.click.joinbutton')) {\n return this.getDiffBetweenTimestamps(\n 'internal.client.meeting.click.joinbutton',\n 'internal.client.meeting.interstitial-window.showed'\n );\n }\n\n const clickToInterstitialWithUserDelayLatency = this.precomputedLatencies.get(\n 'internal.click.to.interstitial.with.user.delay'\n );\n\n if (typeof clickToInterstitialWithUserDelayLatency === 'number') {\n return clamp(clickToInterstitialWithUserDelayLatency, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Interstitial To Join Ok\n * @returns - latency\n */\n public getInterstitialToJoinOK() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.interstitial-window.click.joinbutton',\n 'client.locus.join.response'\n );\n }\n\n /**\n * Call Init To MediaEngineReady\n * @returns - latency\n */\n public getCallInitMediaEngineReady() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.interstitial-window.click.joinbutton',\n 'client.media-engine.ready',\n {maximum: 1200000}\n );\n }\n\n /**\n * Interstitial To Media Ok\n * @returns - latency\n */\n public getInterstitialToMediaOKJMT() {\n const interstitialJoinClickTimestamp = this.latencyTimestamps.get(\n 'internal.client.interstitial-window.click.joinbutton'\n );\n\n // get the first timestamp\n const connectedMedia = this.latencyTimestamps.get('client.ice.end');\n\n const lobbyTimeLatency = this.getStayLobbyTime();\n const lobbyTime = typeof lobbyTimeLatency === 'number' ? lobbyTimeLatency : 0;\n\n if (interstitialJoinClickTimestamp && connectedMedia) {\n const interstitialToMediaOKJmt = connectedMedia - interstitialJoinClickTimestamp - lobbyTime;\n\n return clamp(interstitialToMediaOKJmt, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Total JMT\n * @returns - latency\n */\n public getTotalJMT() {\n const clickToInterstitial = this.getClickToInterstitial();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n\n if (typeof clickToInterstitial === 'number' && typeof interstitialToJoinOk === 'number') {\n return clamp(clickToInterstitial + interstitialToJoinOk, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Total JMT With User Delay\n * @returns - latency\n */\n public getTotalJMTWithUserDelay() {\n const clickToInterstitialWithUserDelay = this.getClickToInterstitialWithUserDelay();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n\n if (\n typeof clickToInterstitialWithUserDelay === 'number' &&\n typeof interstitialToJoinOk === 'number'\n ) {\n return clamp(clickToInterstitialWithUserDelay + interstitialToJoinOk, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Join Conf JMT\n * @returns - latency\n */\n public getJoinConfJMT() {\n const joinReqResp = this.getJoinReqResp();\n const ICESetupTime = this.getICESetupTime();\n\n if (joinReqResp && ICESetupTime) {\n return clamp(joinReqResp + ICESetupTime, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Total Media JMT\n * @returns - latency\n */\n public getTotalMediaJMT() {\n const clickToInterstitial = this.getClickToInterstitial();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n const joinConfJMT = this.getJoinConfJMT();\n const lobbyTime = this.getStayLobbyTime();\n\n if (clickToInterstitial && interstitialToJoinOk && joinConfJMT) {\n const totalMediaJMT = clamp(\n clickToInterstitial + interstitialToJoinOk + joinConfJMT,\n 0,\n Infinity\n );\n if (this.getMeeting()?.allowMediaInLobby) {\n return clamp(totalMediaJMT, 0, this.MAX_INTEGER);\n }\n\n return clamp(totalMediaJMT - lobbyTime, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Total Media JMT With User Delay\n * @returns - latency\n */\n public getTotalMediaJMTWithUserDelay() {\n const clickToInterstitialWithUserDelay = this.getClickToInterstitialWithUserDelay();\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n const joinConfJMT = this.getJoinConfJMT();\n\n if (clickToInterstitialWithUserDelay && interstitialToJoinOk && joinConfJMT) {\n return clamp(\n clickToInterstitialWithUserDelay + interstitialToJoinOk + joinConfJMT,\n 0,\n this.MAX_INTEGER\n );\n }\n\n return undefined;\n }\n\n /**\n * Client JMT\n * @returns - latency\n */\n public getClientJMT() {\n const interstitialToJoinOk = this.getInterstitialToJoinOK();\n const joinConfJMT = this.getJoinConfJMT();\n\n if (typeof interstitialToJoinOk === 'number' && typeof joinConfJMT === 'number') {\n return clamp(interstitialToJoinOk - joinConfJMT, 0, this.MAX_INTEGER);\n }\n\n return undefined;\n }\n\n /**\n * Audio setup delay receive\n */\n public getAudioJoinRespRxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.rx.start');\n }\n\n /**\n * Video setup delay receive\n */\n public getVideoJoinRespRxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.rx.start');\n }\n\n /**\n * Total latency for all get cluster request.\n */\n public getReachabilityClustersReqResp() {\n const reachablityClusterReqResp = this.precomputedLatencies.get('internal.get.cluster.time');\n\n return typeof reachablityClusterReqResp === 'number'\n ? clamp(Math.floor(reachablityClusterReqResp), 0, this.MAX_INTEGER)\n : undefined;\n }\n\n /**\n * Audio setup delay transmit\n */\n public getAudioJoinRespTxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');\n }\n\n /**\n * Video setup delay transmit\n */\n public getVideoJoinRespTxStart() {\n return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');\n }\n\n /**\n * Time from share initiation to share stop (ms).\n */\n public getShareDuration() {\n return this.getDiffBetweenTimestamps(\n 'internal.client.share.initiated',\n 'internal.client.share.stopped'\n );\n }\n\n /**\n * Total latency for all exchange ci token.\n */\n public getExchangeCITokenJMT() {\n const exchangeCITokenJMT = this.precomputedLatencies.get('internal.exchange.ci.token.time');\n\n return typeof exchangeCITokenJMT === 'number'\n ? clamp(Math.floor(exchangeCITokenJMT), 0, this.MAX_INTEGER)\n : undefined;\n }\n\n /**\n * Total latency for all refresh captcha requests.\n */\n public getRefreshCaptchaReqResp() {\n const refreshCaptchaReqResp = this.precomputedLatencies.get('internal.refresh.captcha.time');\n\n return typeof refreshCaptchaReqResp === 'number'\n ? clamp(Math.floor(refreshCaptchaReqResp), 0, this.MAX_INTEGER)\n : undefined;\n }\n\n /**\n * Get the latency for downloading intelligence models.\n * @returns - latency\n */\n public getDownloadIntelligenceModelsReqResp() {\n const downloadIntelligenceModelsReqResp = this.precomputedLatencies.get(\n 'internal.api.fetch.intelligence.models'\n );\n\n return typeof downloadIntelligenceModelsReqResp === 'number'\n ? clamp(Math.floor(downloadIntelligenceModelsReqResp), 0, this.MAX_INTEGER)\n : undefined;\n }\n\n /**\n * Get the total latency for all other app API requests.\n * Excludes meeting info, because it's measured separately.\n * @returns - latency\n */\n public getOtherAppApiReqResp() {\n const otherAppApiJMT = this.precomputedLatencies.get('internal.other.app.api.time');\n\n return otherAppApiJMT > 0 ? clamp(Math.floor(otherAppApiJMT), 0, this.MAX_INTEGER) : undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAA6B,SAAAE,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAA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AAE,IAAI,CAAC3D,WAAW,CAAC,GAC7DlC,SAAS;IACf;;IAEA;AACF;AACA;AACA;EAHE;IAAAV,GAAA;IAAAC,KAAA,EAIA,SAAAuG,qCAAA,EAA8C;MAC5C,IAAMC,iCAAiC,GAAG,IAAI,CAAC3G,oBAAoB,CAAC0B,GAAG,CACrE,wCACF,CAAC;MAED,OAAO,OAAOiF,iCAAiC,KAAK,QAAQ,GACxD,IAAA5D,aAAK,EAACK,IAAI,CAACC,KAAK,CAACsD,iCAAiC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC7D,WAAW,CAAC,GACzElC,SAAS;IACf;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAAV,GAAA;IAAAC,KAAA,EAKA,SAAAyG,sBAAA,EAA+B;MAC7B,IAAMC,cAAc,GAAG,IAAI,CAAC7G,oBAAoB,CAAC0B,GAAG,CAAC,6BAA6B,CAAC;MAEnF,OAAOmF,cAAc,GAAG,CAAC,GAAG,IAAA9D,aAAK,EAACK,IAAI,CAACC,KAAK,CAACwD,cAAc,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC/D,WAAW,CAAC,GAAGlC,SAAS;IAChG;EAAC;EAAA,OAAA7B,uBAAA;AAAA,EAvmBkD+H,sBAAW"}
package/dist/metrics.js CHANGED
@@ -148,7 +148,7 @@ var Metrics = _webexCore.WebexPlugin.extend({
148
148
  }
149
149
  });
150
150
  },
151
- version: "3.9.0-next.4"
151
+ version: "3.9.0-next.6"
152
152
  });
153
153
  var _default = exports.default = Metrics;
154
154
  //# sourceMappingURL=metrics.js.map
@@ -9,6 +9,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
9
9
  latencyTimestamps: Map<MetricEventNames, number>;
10
10
  precomputedLatencies: Map<PreComputedLatencies, number>;
11
11
  private meetingId?;
12
+ private MAX_INTEGER;
12
13
  /**
13
14
  * @constructor
14
15
  */
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "@webex/event-dictionary-ts": "^1.0.1930",
41
41
  "@webex/test-helper-chai": "3.8.1-next.11",
42
42
  "@webex/test-helper-mock-webex": "3.8.1-next.11",
43
- "@webex/webex-core": "3.9.0-next.4",
43
+ "@webex/webex-core": "3.9.0-next.6",
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.9.0-next.4"
56
+ "version": "3.9.0-next.6"
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
- if (!clampValues) {
166
- return diff;
167
- }
168
-
169
- const {minimum = 0, maximum} = clampValues;
167
+ const {minimum = 0, maximum = this.MAX_INTEGER} = clampValues || {};
170
168
 
171
- return Math.min(maximum ?? Infinity, Math.max(diff, minimum));
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 Math.max(0, interstitialToMediaOKJmt);
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 = Math.max(0, clickToInterstitial + interstitialToJoinOk + joinConfJMT);
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 Math.max(0, totalMediaJMT - lobbyTime);
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 Math.max(0, clickToInterstitialWithUserDelay + interstitialToJoinOk + joinConfJMT);
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 Math.max(0, interstitialToJoinOk - joinConfJMT);
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' ? Math.floor(exchangeCITokenJMT) : undefined;
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
  }
@@ -131,7 +131,7 @@ describe('internal-plugin-metrics', () => {
131
131
  });
132
132
 
133
133
  describe('getDiffBetweenTimestamps with clamping', () => {
134
- it('should return diff without clamping when no clampValues provided', () => {
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
  });