@webex/plugin-meetings 3.12.0-webex-services-ready.2 → 3.12.0-webex-services-ready.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/aiEnableRequest/index.js +1 -1
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/events.js +29 -14
  4. package/dist/breakouts/events.js.map +1 -1
  5. package/dist/breakouts/index.js +65 -2
  6. package/dist/breakouts/index.js.map +1 -1
  7. package/dist/constants.js +2 -1
  8. package/dist/constants.js.map +1 -1
  9. package/dist/hashTree/hashTreeParser.js +193 -23
  10. package/dist/hashTree/hashTreeParser.js.map +1 -1
  11. package/dist/interpretation/index.js +1 -1
  12. package/dist/interpretation/siLanguage.js +1 -1
  13. package/dist/locus-info/index.js +141 -56
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/media/properties.js +3 -5
  16. package/dist/media/properties.js.map +1 -1
  17. package/dist/meeting/index.js +351 -52
  18. package/dist/meeting/index.js.map +1 -1
  19. package/dist/meetings/index.js +25 -0
  20. package/dist/meetings/index.js.map +1 -1
  21. package/dist/metrics/constants.js +3 -1
  22. package/dist/metrics/constants.js.map +1 -1
  23. package/dist/roap/turnDiscovery.js +8 -1
  24. package/dist/roap/turnDiscovery.js.map +1 -1
  25. package/dist/types/constants.d.ts +1 -0
  26. package/dist/types/hashTree/hashTreeParser.d.ts +51 -3
  27. package/dist/types/locus-info/index.d.ts +19 -4
  28. package/dist/types/media/properties.d.ts +5 -2
  29. package/dist/types/meeting/index.d.ts +63 -1
  30. package/dist/types/meetings/index.d.ts +8 -0
  31. package/dist/types/metrics/constants.d.ts +2 -0
  32. package/dist/webinar/index.js +4 -4
  33. package/dist/webinar/index.js.map +1 -1
  34. package/package.json +23 -23
  35. package/src/breakouts/events.ts +33 -11
  36. package/src/breakouts/index.ts +79 -1
  37. package/src/constants.ts +1 -0
  38. package/src/hashTree/hashTreeParser.ts +254 -18
  39. package/src/locus-info/index.ts +143 -51
  40. package/src/media/properties.ts +7 -3
  41. package/src/meeting/index.ts +329 -25
  42. package/src/meetings/index.ts +35 -1
  43. package/src/metrics/constants.ts +2 -0
  44. package/src/roap/turnDiscovery.ts +9 -1
  45. package/src/webinar/index.ts +2 -2
  46. package/test/unit/spec/breakouts/events.ts +120 -2
  47. package/test/unit/spec/breakouts/index.ts +142 -2
  48. package/test/unit/spec/hashTree/hashTreeParser.ts +556 -3
  49. package/test/unit/spec/locus-info/index.js +148 -5
  50. package/test/unit/spec/media/properties.ts +23 -23
  51. package/test/unit/spec/meeting/index.js +832 -126
  52. package/test/unit/spec/meetings/index.js +116 -12
  53. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  54. package/test/unit/spec/webinar/index.ts +3 -3
@@ -63,6 +63,7 @@ var LocusInfoUpdateType = exports.LocusInfoUpdateType = {
63
63
  MEETING_ENDED: 'MEETING_ENDED',
64
64
  LOCUS_NOT_FOUND: 'LOCUS_NOT_FOUND'
65
65
  };
66
+ var SYNC_METRICS_DATA_SETS = [_constants3.DataSetNames.MAIN, _constants3.DataSetNames.ATD_ACTIVE, _constants3.DataSetNames.ATD_UNMUTED];
66
67
  /**
67
68
  * This error is thrown if we receive information that the meeting has ended while we're processing some hash messages.
68
69
  * It's handled internally by HashTreeParser and results in MEETING_ENDED being sent up.
@@ -110,7 +111,8 @@ var HashTreeParser = /*#__PURE__*/function () {
110
111
  (0, _defineProperty2.default)(this, "visibleDataSetsUrl", void 0);
111
112
  // url from which we can get info about all data sets
112
113
  (0, _defineProperty2.default)(this, "webexRequest", void 0);
113
- (0, _defineProperty2.default)(this, "locusInfoUpdateCallback", void 0);
114
+ (0, _defineProperty2.default)(this, "callbacks", void 0);
115
+ (0, _defineProperty2.default)(this, "syncLatencyMeetingId", void 0);
114
116
  (0, _defineProperty2.default)(this, "visibleDataSets", void 0);
115
117
  (0, _defineProperty2.default)(this, "debugId", void 0);
116
118
  (0, _defineProperty2.default)(this, "excludedDataSets", void 0);
@@ -130,7 +132,8 @@ var HashTreeParser = /*#__PURE__*/function () {
130
132
 
131
133
  this.debugId = options.debugId;
132
134
  this.webexRequest = options.webexRequest;
133
- this.locusInfoUpdateCallback = options.locusInfoUpdateCallback;
135
+ this.callbacks = options.callbacks;
136
+ this.syncLatencyMeetingId = options.syncLatencyMeetingId;
134
137
  this.excludedDataSets = options.excludedDataSets || [];
135
138
  this.visibleDataSetsUrl = locus === null || locus === void 0 ? void 0 : (_locus$links = locus.links) === null || _locus$links === void 0 ? void 0 : (_locus$links$resource = _locus$links.resources) === null || _locus$links$resource === void 0 ? void 0 : (_locus$links$resource2 = _locus$links$resource.visibleDataSets) === null || _locus$links$resource2 === void 0 ? void 0 : _locus$links$resource2.url;
136
139
  this.setVisibleDataSets(((_options$metadata = options.metadata) === null || _options$metadata === void 0 ? void 0 : _options$metadata.visibleDataSets) || [], dataSets);
@@ -1271,6 +1274,10 @@ var HashTreeParser = /*#__PURE__*/function () {
1271
1274
  this.handleRootHashHeartBeatMessage(message);
1272
1275
  this.resetHeartbeatWatchdogs(message.dataSets);
1273
1276
  } else {
1277
+ // Completion of the sync latency metric (client.locus.sync.complete) is driven solely from
1278
+ // Meeting#processLocusLLMEvent once the matching LLM message arrives. body-mode syncs return
1279
+ // the locus state elements in the /sync HTTP response body, but per design the CA metric is
1280
+ // emitted only from the LLM message path, so no completion happens here.
1274
1281
  var updatedObjects = this.parseMessage(message, debugText);
1275
1282
  this.resetHeartbeatWatchdogs(message.dataSets);
1276
1283
  this.callLocusInfoUpdateCallback({
@@ -1280,6 +1287,33 @@ var HashTreeParser = /*#__PURE__*/function () {
1280
1287
  }
1281
1288
  }
1282
1289
 
1290
+ /**
1291
+ * Checks if Locus sync latency metrics should be collected for a dataset.
1292
+ *
1293
+ * @param {string} dataSetName dataset name
1294
+ * @param {boolean} [isInitialization=false] whether this is an initialization sync
1295
+ * @returns {boolean}
1296
+ */
1297
+ }, {
1298
+ key: "shouldCollectSyncMetrics",
1299
+ value: function shouldCollectSyncMetrics(dataSetName) {
1300
+ var isInitialization = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1301
+ return Boolean(this.callbacks.syncLatencyTracker && !isInitialization && SYNC_METRICS_DATA_SETS.includes(dataSetName));
1302
+ }
1303
+ }, {
1304
+ key: "saveSyncBackoffLatency",
1305
+ value: function saveSyncBackoffLatency(dataSetName, randomBackoffTime) {
1306
+ var _this$callbacks$syncL;
1307
+ var isInitialization = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1308
+ if (!this.shouldCollectSyncMetrics(dataSetName, isInitialization)) {
1309
+ return;
1310
+ }
1311
+ (_this$callbacks$syncL = this.callbacks.syncLatencyTracker) === null || _this$callbacks$syncL === void 0 ? void 0 : _this$callbacks$syncL.saveLatency('internal.client.locus.sync.random.backoff', Math.round(randomBackoffTime), {
1312
+ meetingId: this.syncLatencyMeetingId,
1313
+ dataSetName: dataSetName
1314
+ });
1315
+ }
1316
+
1283
1317
  /**
1284
1318
  * Calls the updateInfo callback if there are any updates to report
1285
1319
  *
@@ -1330,13 +1364,13 @@ var HashTreeParser = /*#__PURE__*/function () {
1330
1364
  return true;
1331
1365
  });
1332
1366
  if (filteredUpdates.length > 0) {
1333
- this.locusInfoUpdateCallback({
1367
+ this.callbacks.locusInfoUpdateCallback({
1334
1368
  updateType: updateType,
1335
1369
  updatedObjects: filteredUpdates
1336
1370
  });
1337
1371
  }
1338
1372
  } else if (updateType !== LocusInfoUpdateType.OBJECTS_UPDATED) {
1339
- this.locusInfoUpdateCallback({
1373
+ this.callbacks.locusInfoUpdateCallback({
1340
1374
  updateType: updateType
1341
1375
  });
1342
1376
  }
@@ -1357,6 +1391,46 @@ var HashTreeParser = /*#__PURE__*/function () {
1357
1391
  return Math.round(Math.pow(randomValue, exponent) * maxMs);
1358
1392
  }
1359
1393
 
1394
+ /**
1395
+ * Returns a copy of a hash tree message restricted to a single dataset, keeping only the
1396
+ * requested dataset and the elements belonging to it. Used to strip out datasets that Locus
1397
+ * may include in a sync response but that we didn't request (e.g. "unjoined" sharing elements
1398
+ * with "main"), which would otherwise be applied once per dataset.
1399
+ *
1400
+ * @param {HashTreeMessage} message the sync response message
1401
+ * @param {string} dataSetName the dataset that was requested
1402
+ * @returns {HashTreeMessage} a new message containing only the requested dataset
1403
+ */
1404
+ }, {
1405
+ key: "filterMessageToDataSet",
1406
+ value: function filterMessageToDataSet(message, dataSetName) {
1407
+ var _message$dataSets$fil, _message$dataSets2, _message$locusStateEl3, _message$locusStateEl4, _message$dataSets3, _message$locusStateEl5;
1408
+ var filteredOutDataSets = (_message$dataSets$fil = (_message$dataSets2 = message.dataSets) === null || _message$dataSets2 === void 0 ? void 0 : _message$dataSets2.filter(function (ds) {
1409
+ return ds.name !== dataSetName;
1410
+ })) !== null && _message$dataSets$fil !== void 0 ? _message$dataSets$fil : [];
1411
+ var filteredOutElements = (_message$locusStateEl3 = (_message$locusStateEl4 = message.locusStateElements) === null || _message$locusStateEl4 === void 0 ? void 0 : _message$locusStateEl4.filter(function (el) {
1412
+ var _el$htMeta$dataSetNam;
1413
+ return !((_el$htMeta$dataSetNam = el.htMeta.dataSetNames) !== null && _el$htMeta$dataSetNam !== void 0 && _el$htMeta$dataSetNam.includes(dataSetName));
1414
+ })) !== null && _message$locusStateEl3 !== void 0 ? _message$locusStateEl3 : [];
1415
+ if (filteredOutDataSets.length > 0 || filteredOutElements.length > 0) {
1416
+ _loggerProxy.default.logger.info("HashTreeParser#filterMessageToDataSet --> ".concat(this.debugId, " keeping only dataset \"").concat(dataSetName, "\", filtering out datasets: [").concat(filteredOutDataSets.map(function (ds) {
1417
+ return "".concat(ds.name, ":").concat(ds.version);
1418
+ }).join(','), "], elements: [").concat(filteredOutElements.map(function (el) {
1419
+ var _el$htMeta, _el$htMeta$elementId, _el$htMeta2, _el$htMeta2$elementId, _el$htMeta3, _el$htMeta3$elementId;
1420
+ return "".concat((_el$htMeta = el.htMeta) === null || _el$htMeta === void 0 ? void 0 : (_el$htMeta$elementId = _el$htMeta.elementId) === null || _el$htMeta$elementId === void 0 ? void 0 : _el$htMeta$elementId.type, ":").concat((_el$htMeta2 = el.htMeta) === null || _el$htMeta2 === void 0 ? void 0 : (_el$htMeta2$elementId = _el$htMeta2.elementId) === null || _el$htMeta2$elementId === void 0 ? void 0 : _el$htMeta2$elementId.id, ":").concat((_el$htMeta3 = el.htMeta) === null || _el$htMeta3 === void 0 ? void 0 : (_el$htMeta3$elementId = _el$htMeta3.elementId) === null || _el$htMeta3$elementId === void 0 ? void 0 : _el$htMeta3$elementId.version);
1421
+ }).join(','), "]"));
1422
+ }
1423
+ return _objectSpread(_objectSpread({}, message), {}, {
1424
+ dataSets: (_message$dataSets3 = message.dataSets) === null || _message$dataSets3 === void 0 ? void 0 : _message$dataSets3.filter(function (ds) {
1425
+ return ds.name === dataSetName;
1426
+ }),
1427
+ locusStateElements: (_message$locusStateEl5 = message.locusStateElements) === null || _message$locusStateEl5 === void 0 ? void 0 : _message$locusStateEl5.filter(function (el) {
1428
+ var _el$htMeta$dataSetNam2;
1429
+ return (_el$htMeta$dataSetNam2 = el.htMeta.dataSetNames) === null || _el$htMeta$dataSetNam2 === void 0 ? void 0 : _el$htMeta$dataSetNam2.includes(dataSetName);
1430
+ })
1431
+ });
1432
+ }
1433
+
1360
1434
  /**
1361
1435
  * Performs a sync for the given data set.
1362
1436
  *
@@ -1369,8 +1443,8 @@ var HashTreeParser = /*#__PURE__*/function () {
1369
1443
  key: "performSync",
1370
1444
  value: (function () {
1371
1445
  var _performSync = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(dataSet, reason, isInitialization) {
1372
- var _dataSet$syncAbortCon;
1373
- var abortController, hashTree, rootHash, leavesData, receivedHashes, hashesResult, mismatchedLeaveIndexes, syncResponse, _t3, _t4;
1446
+ var _dataSet$syncAbortCon, _this$callbacks$gener, _this$callbacks, _this$callbacks$gener2, _this$callbacks2;
1447
+ var abortController, hashTree, rootHash, shouldCollectMetrics, hashtreeTrackingId, syncTrackingId, syncRequestSent, _this$callbacks$syncL2, leavesData, receivedHashes, hashesResult, mismatchedLeaveIndexes, syncResponse, filteredResponse, _this$callbacks$syncL3, _t3, _t4;
1374
1448
  return _regenerator.default.wrap(function (_context7) {
1375
1449
  while (1) switch (_context7.prev = _context7.next) {
1376
1450
  case 0:
@@ -1384,6 +1458,25 @@ var HashTreeParser = /*#__PURE__*/function () {
1384
1458
  dataSet.syncAbortController = abortController;
1385
1459
  hashTree = dataSet.hashTree;
1386
1460
  rootHash = hashTree.getRootHash();
1461
+ shouldCollectMetrics = this.shouldCollectSyncMetrics(dataSet.name, isInitialization); // Generate two distinct tracking ids up-front. Each Locus request must carry its own unique
1462
+ // tracking id, so the /hashtree and /sync requests must not share one. hashtreeTrackingId is
1463
+ // generated first so that syncTrackingId (forced onto the /sync request, stored in metrics, and
1464
+ // used to match the LLM broadcast message) ends up with the later/higher sequence number,
1465
+ // matching the order in which Locus sees the requests. If we never call /hashtree (single-leaf
1466
+ // or initialization syncs), hashtreeTrackingId is simply unused.
1467
+ hashtreeTrackingId = shouldCollectMetrics ? (_this$callbacks$gener = (_this$callbacks = this.callbacks).generateTrackingId) === null || _this$callbacks$gener === void 0 ? void 0 : _this$callbacks$gener.call(_this$callbacks) : undefined;
1468
+ syncTrackingId = shouldCollectMetrics ? (_this$callbacks$gener2 = (_this$callbacks2 = this.callbacks).generateTrackingId) === null || _this$callbacks$gener2 === void 0 ? void 0 : _this$callbacks$gener2.call(_this$callbacks2) : undefined;
1469
+ syncRequestSent = false;
1470
+ if (shouldCollectMetrics) {
1471
+ (_this$callbacks$syncL2 = this.callbacks.syncLatencyTracker) === null || _this$callbacks$syncL2 === void 0 ? void 0 : _this$callbacks$syncL2.saveTimestamp({
1472
+ key: 'internal.client.locus.sync.start',
1473
+ options: {
1474
+ meetingId: this.syncLatencyMeetingId,
1475
+ dataSetName: dataSet.name,
1476
+ trackingId: syncTrackingId
1477
+ }
1478
+ });
1479
+ }
1387
1480
  _context7.prev = 2;
1388
1481
  _loggerProxy.default.logger.info("HashTreeParser#performSync --> ".concat(this.debugId, " ").concat(reason, ", syncing data set \"").concat(dataSet.name, "\""));
1389
1482
  leavesData = {};
@@ -1397,7 +1490,10 @@ var HashTreeParser = /*#__PURE__*/function () {
1397
1490
  }
1398
1491
  _context7.prev = 3;
1399
1492
  _context7.next = 4;
1400
- return this.getHashesFromLocus(dataSet.name, rootHash);
1493
+ return this.getHashesFromLocus(dataSet.name, rootHash, {
1494
+ requestTrackingId: hashtreeTrackingId,
1495
+ metricTrackingId: syncTrackingId
1496
+ });
1401
1497
  case 4:
1402
1498
  hashesResult = _context7.sent;
1403
1499
  if (hashesResult) {
@@ -1451,9 +1547,10 @@ var HashTreeParser = /*#__PURE__*/function () {
1451
1547
  _context7.next = 12;
1452
1548
  return this.sendSyncRequestToLocus(dataSet, {
1453
1549
  isInitialization: true
1454
- });
1550
+ }, syncTrackingId);
1455
1551
  case 12:
1456
1552
  syncResponse = _context7.sent;
1553
+ syncRequestSent = true;
1457
1554
  _context7.next = 15;
1458
1555
  break;
1459
1556
  case 13:
@@ -1464,9 +1561,10 @@ var HashTreeParser = /*#__PURE__*/function () {
1464
1561
  _context7.next = 14;
1465
1562
  return this.sendSyncRequestToLocus(dataSet, {
1466
1563
  mismatchedLeavesData: leavesData
1467
- });
1564
+ }, syncTrackingId);
1468
1565
  case 14:
1469
1566
  syncResponse = _context7.sent;
1567
+ syncRequestSent = true;
1470
1568
  case 15:
1471
1569
  // sync API may return nothing (in that case data will arrive via messages)
1472
1570
  // or it may return a response in the same format as messages
@@ -1478,8 +1576,10 @@ var HashTreeParser = /*#__PURE__*/function () {
1478
1576
  // misleading "aborting sync" message for this already-completed sync
1479
1577
  dataSet.syncAbortController = undefined;
1480
1578
 
1481
- // the format of sync response is the same as messages, so we can reuse the same handler
1482
- this.handleMessage(syncResponse, "via sync API (".concat(isInitialization ? 'init' : "".concat((0, _keys.default)(leavesData).length, " mismatched leaves"), ")"));
1579
+ // we only requested this dataset, so restrict the response to it before processing
1580
+ // (Locus may include shared datasets like "unjoined" alongside "main")
1581
+ filteredResponse = this.filterMessageToDataSet(syncResponse, dataSet.name); // the format of sync response is the same as messages, so we can reuse the same handler
1582
+ this.handleMessage(filteredResponse, "via sync API (".concat(isInitialization ? 'init' : "".concat((0, _keys.default)(leavesData).length, " mismatched leaves"), ")"));
1483
1583
  }
1484
1584
  _context7.next = 17;
1485
1585
  break;
@@ -1491,6 +1591,12 @@ var HashTreeParser = /*#__PURE__*/function () {
1491
1591
  }
1492
1592
  case 17:
1493
1593
  _context7.prev = 17;
1594
+ if (shouldCollectMetrics && !syncRequestSent) {
1595
+ // Drop only this sync's in-progress record (matched by its tracking id) rather than the
1596
+ // whole dataset, so a still-pending record from an earlier successful sync isn't wiped.
1597
+ // This mirrors the native client's onSyncError(syncId) which discards a single record.
1598
+ (_this$callbacks$syncL3 = this.callbacks.syncLatencyTracker) === null || _this$callbacks$syncL3 === void 0 ? void 0 : _this$callbacks$syncL3.clearLocusSyncLatency(dataSet.name, this.syncLatencyMeetingId, syncTrackingId);
1599
+ }
1494
1600
  dataSet.syncAbortController = undefined;
1495
1601
  return _context7.finish(17);
1496
1602
  case 18:
@@ -1788,6 +1894,7 @@ var HashTreeParser = /*#__PURE__*/function () {
1788
1894
  try {
1789
1895
  for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
1790
1896
  ds = _step1.value;
1897
+ this.saveSyncBackoffLatency(ds.name, delay);
1791
1898
  this.enqueueSyncForDataset(ds.name, 'syncAllDatasets');
1792
1899
  }
1793
1900
  } catch (err) {
@@ -1856,11 +1963,13 @@ var HashTreeParser = /*#__PURE__*/function () {
1856
1963
  return;
1857
1964
  }
1858
1965
  dataSet.hashTree.resize(receivedDataSet.leafCount);
1859
- var delay = dataSet.idleMs + this.getWeightedBackoffTime(dataSet.backoff);
1966
+ var randomBackoffTime = this.getWeightedBackoffTime(dataSet.backoff);
1967
+ var delay = dataSet.idleMs + randomBackoffTime;
1860
1968
  if (delay > 0) {
1861
1969
  if (dataSet.timer) {
1862
1970
  clearTimeout(dataSet.timer);
1863
1971
  }
1972
+ this.saveSyncBackoffLatency(dataSet.name, randomBackoffTime);
1864
1973
  dataSet.timer = setTimeout(function () {
1865
1974
  dataSet.timer = undefined;
1866
1975
  if (!dataSet.hashTree) {
@@ -1917,6 +2026,7 @@ var HashTreeParser = /*#__PURE__*/function () {
1917
2026
  debugId: _this11.debugId,
1918
2027
  dataSetName: dataSet.name
1919
2028
  });
2029
+ _this11.saveSyncBackoffLatency(dataSet.name, backoffTime);
1920
2030
  _this11.enqueueSyncForDataset(dataSet.name, "heartbeat watchdog expired");
1921
2031
  _this11.resetHeartbeatWatchdogs([dataSet]);
1922
2032
  }, delay);
@@ -1995,9 +2105,8 @@ var HashTreeParser = /*#__PURE__*/function () {
1995
2105
  }, {
1996
2106
  key: "resumeFromMessage",
1997
2107
  value: function resumeFromMessage(message) {
1998
- var _message$locusStateEl3, _metadataObject$data;
1999
- // check that message contains metadata with visible data sets - this is essential to be able to resume
2000
- var metadataObject = (_message$locusStateEl3 = message.locusStateElements) === null || _message$locusStateEl3 === void 0 ? void 0 : _message$locusStateEl3.find(function (el) {
2108
+ var _message$locusStateEl6, _metadataObject$data;
2109
+ var metadataObject = (_message$locusStateEl6 = message.locusStateElements) === null || _message$locusStateEl6 === void 0 ? void 0 : _message$locusStateEl6.find(function (el) {
2001
2110
  return (0, _utils.isMetadata)(el);
2002
2111
  });
2003
2112
  if (!(metadataObject !== null && metadataObject !== void 0 && (_metadataObject$data = metadataObject.data) !== null && _metadataObject$data !== void 0 && _metadataObject$data.visibleDataSets)) {
@@ -2083,23 +2192,55 @@ var HashTreeParser = /*#__PURE__*/function () {
2083
2192
  * Gets the current hashes from the locus for a specific data set.
2084
2193
  * @param {string} dataSetName
2085
2194
  * @param {string} currentRootHash
2195
+ * @param {Object} [trackingIds] tracking ids for the /hashtree request
2196
+ * @param {string} [trackingIds.requestTrackingId] tracking id forced onto the /hashtree HTTP request header (kept distinct from the /sync request's tracking id)
2197
+ * @param {string} [trackingIds.metricTrackingId] tracking id (the /sync request's) under which the hashtree latency milestones are recorded, so they belong to the same sync latency record
2086
2198
  * @returns {Object|null} An object containing the hashes and leaf count, or null if the hashes match and no sync is needed
2087
2199
  */
2088
2200
  }, {
2089
2201
  key: "getHashesFromLocus",
2090
- value: function getHashesFromLocus(dataSetName, currentRootHash) {
2202
+ value: function getHashesFromLocus(dataSetName, currentRootHash, trackingIds) {
2091
2203
  var _this12 = this;
2204
+ var _ref9 = trackingIds !== null && trackingIds !== void 0 ? trackingIds : {},
2205
+ requestTrackingId = _ref9.requestTrackingId,
2206
+ metricTrackingId = _ref9.metricTrackingId;
2092
2207
  _loggerProxy.default.logger.info("HashTreeParser#getHashesFromLocus --> ".concat(this.debugId, " Requesting hashes for data set \"").concat(dataSetName, "\""));
2093
2208
  var dataSet = this.dataSets[dataSetName];
2094
2209
  var url = "".concat(dataSet.url, "/hashtree");
2095
- return this.webexRequest({
2210
+ if (this.shouldCollectSyncMetrics(dataSetName)) {
2211
+ var _this$callbacks$syncL4;
2212
+ (_this$callbacks$syncL4 = this.callbacks.syncLatencyTracker) === null || _this$callbacks$syncL4 === void 0 ? void 0 : _this$callbacks$syncL4.saveTimestamp({
2213
+ key: 'internal.client.locus.hashtree.request',
2214
+ options: {
2215
+ meetingId: this.syncLatencyMeetingId,
2216
+ dataSetName: dataSetName,
2217
+ trackingId: metricTrackingId
2218
+ }
2219
+ });
2220
+ }
2221
+ return this.webexRequest(_objectSpread({
2096
2222
  method: _constants2.HTTP_VERBS.GET,
2097
2223
  uri: url,
2098
2224
  qs: {
2099
2225
  rootHash: currentRootHash
2100
2226
  }
2101
- }).then(function (response) {
2227
+ }, requestTrackingId ? {
2228
+ headers: {
2229
+ trackingid: requestTrackingId
2230
+ }
2231
+ } : {})).then(function (response) {
2102
2232
  var _response$body, _response$body2;
2233
+ if (_this12.shouldCollectSyncMetrics(dataSetName)) {
2234
+ var _this12$callbacks$syn;
2235
+ (_this12$callbacks$syn = _this12.callbacks.syncLatencyTracker) === null || _this12$callbacks$syn === void 0 ? void 0 : _this12$callbacks$syn.saveTimestamp({
2236
+ key: 'internal.client.locus.hashtree.response',
2237
+ options: {
2238
+ meetingId: _this12.syncLatencyMeetingId,
2239
+ dataSetName: dataSetName,
2240
+ trackingId: metricTrackingId
2241
+ }
2242
+ });
2243
+ }
2103
2244
  if (!response.body || (0, _lodash.isEmpty)(response.body)) {
2104
2245
  // 204 with empty body means our hashes match Locus, no sync needed
2105
2246
  _loggerProxy.default.logger.info("HashTreeParser#getHashesFromLocus --> ".concat(_this12.debugId, " Got ").concat(response.statusCode, " with empty body for data set \"").concat(dataSetName, "\", hashes match - no sync needed"));
@@ -2135,11 +2276,12 @@ var HashTreeParser = /*#__PURE__*/function () {
2135
2276
  *
2136
2277
  * @param {InternalDataSet} dataSet The data set to sync.
2137
2278
  * @param {Object} options Either `{ isInitialization: true }` for init syncs (uses leafCount=1 with empty leaf data) or `{ mismatchedLeavesData }` for normal syncs.
2138
- * @returns {Promise<HashTreeMessage|null>}
2279
+ * @param {string} [trackingId] tracking id
2280
+ * @returns {Promise<HashTreeMessage | null>}
2139
2281
  */
2140
2282
  }, {
2141
2283
  key: "sendSyncRequestToLocus",
2142
- value: function sendSyncRequestToLocus(dataSet, options) {
2284
+ value: function sendSyncRequestToLocus(dataSet, options, trackingId) {
2143
2285
  var _this13 = this;
2144
2286
  _loggerProxy.default.logger.info("HashTreeParser#sendSyncRequestToLocus --> ".concat(this.debugId, " Sending sync request for data set \"").concat(dataSet.name, "\""));
2145
2287
  var isInitialization = 'isInitialization' in options;
@@ -2165,14 +2307,42 @@ var HashTreeParser = /*#__PURE__*/function () {
2165
2307
  });
2166
2308
  }
2167
2309
  var ourCurrentRootHash = dataSet.hashTree ? dataSet.hashTree.getRootHash() : _constants3.EMPTY_HASH;
2168
- return this.webexRequest({
2310
+ var shouldCollectMetrics = this.shouldCollectSyncMetrics(dataSet.name, isInitialization);
2311
+ if (shouldCollectMetrics) {
2312
+ var _this$callbacks$syncL5;
2313
+ (_this$callbacks$syncL5 = this.callbacks.syncLatencyTracker) === null || _this$callbacks$syncL5 === void 0 ? void 0 : _this$callbacks$syncL5.saveTimestamp({
2314
+ key: 'internal.client.locus.sync.request',
2315
+ options: {
2316
+ meetingId: this.syncLatencyMeetingId,
2317
+ dataSetName: dataSet.name,
2318
+ trackingId: trackingId
2319
+ }
2320
+ });
2321
+ }
2322
+ return this.webexRequest(_objectSpread(_objectSpread({
2169
2323
  method: _constants2.HTTP_VERBS.POST,
2170
2324
  uri: url,
2171
2325
  qs: {
2172
2326
  rootHash: ourCurrentRootHash
2173
- },
2327
+ }
2328
+ }, trackingId ? {
2329
+ headers: {
2330
+ trackingid: trackingId
2331
+ }
2332
+ } : {}), {}, {
2174
2333
  body: body
2175
- }).then(function (resp) {
2334
+ })).then(function (resp) {
2335
+ if (shouldCollectMetrics) {
2336
+ var _this13$callbacks$syn;
2337
+ (_this13$callbacks$syn = _this13.callbacks.syncLatencyTracker) === null || _this13$callbacks$syn === void 0 ? void 0 : _this13$callbacks$syn.saveTimestamp({
2338
+ key: 'internal.client.locus.sync.response',
2339
+ options: {
2340
+ meetingId: _this13.syncLatencyMeetingId,
2341
+ dataSetName: dataSet.name,
2342
+ trackingId: trackingId
2343
+ }
2344
+ });
2345
+ }
2176
2346
  if (!resp.body || (0, _lodash.isEmpty)(resp.body)) {
2177
2347
  _loggerProxy.default.logger.info("HashTreeParser#sendSyncRequestToLocus --> ".concat(_this13.debugId, " Got ").concat(resp.statusCode, " with empty body for sync request for data set \"").concat(dataSet.name, "\", data should arrive via messages"));
2178
2348
  return null;