@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.
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/events.js +29 -14
- package/dist/breakouts/events.js.map +1 -1
- package/dist/breakouts/index.js +65 -2
- package/dist/breakouts/index.js.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +193 -23
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +141 -56
- package/dist/locus-info/index.js.map +1 -1
- package/dist/media/properties.js +3 -5
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/index.js +351 -52
- package/dist/meeting/index.js.map +1 -1
- package/dist/meetings/index.js +25 -0
- package/dist/meetings/index.js.map +1 -1
- package/dist/metrics/constants.js +3 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/roap/turnDiscovery.js +8 -1
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +51 -3
- package/dist/types/locus-info/index.d.ts +19 -4
- package/dist/types/media/properties.d.ts +5 -2
- package/dist/types/meeting/index.d.ts +63 -1
- package/dist/types/meetings/index.d.ts +8 -0
- package/dist/types/metrics/constants.d.ts +2 -0
- package/dist/webinar/index.js +4 -4
- package/dist/webinar/index.js.map +1 -1
- package/package.json +23 -23
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +79 -1
- package/src/constants.ts +1 -0
- package/src/hashTree/hashTreeParser.ts +254 -18
- package/src/locus-info/index.ts +143 -51
- package/src/media/properties.ts +7 -3
- package/src/meeting/index.ts +329 -25
- package/src/meetings/index.ts +35 -1
- package/src/metrics/constants.ts +2 -0
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/index.ts +2 -2
- package/test/unit/spec/breakouts/events.ts +120 -2
- package/test/unit/spec/breakouts/index.ts +142 -2
- package/test/unit/spec/hashTree/hashTreeParser.ts +556 -3
- package/test/unit/spec/locus-info/index.js +148 -5
- package/test/unit/spec/media/properties.ts +23 -23
- package/test/unit/spec/meeting/index.js +832 -126
- package/test/unit/spec/meetings/index.js +116 -12
- package/test/unit/spec/roap/turnDiscovery.ts +20 -0
- package/test/unit/spec/webinar/index.ts +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {cloneDeep, isEmpty, zip} from 'lodash';
|
|
2
|
+
import type {LocusSyncLatencyEventName} from '@webex/internal-plugin-metrics';
|
|
2
3
|
import HashTree, {LeafDataItem} from './hashTree';
|
|
3
4
|
import LoggerProxy from '../common/logs/logger-proxy';
|
|
4
5
|
import Metrics from '../metrics';
|
|
@@ -61,6 +62,7 @@ interface InternalDataSet extends DataSet {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
type WebexRequestMethod = (options: Record<string, any>) => Promise<any>;
|
|
65
|
+
type GenerateTrackingId = () => string | undefined;
|
|
64
66
|
|
|
65
67
|
export const LocusInfoUpdateType = {
|
|
66
68
|
OBJECTS_UPDATED: 'OBJECTS_UPDATED',
|
|
@@ -84,6 +86,38 @@ export type LocusInfoUpdate = {
|
|
|
84
86
|
|
|
85
87
|
export type LocusInfoUpdateCallback = (update: LocusInfoUpdate) => void;
|
|
86
88
|
|
|
89
|
+
export type SyncLatencyTracker = {
|
|
90
|
+
saveLatency: (
|
|
91
|
+
key: 'internal.client.locus.sync.random.backoff',
|
|
92
|
+
value: number,
|
|
93
|
+
options: {
|
|
94
|
+
meetingId: string;
|
|
95
|
+
dataSetName: string;
|
|
96
|
+
}
|
|
97
|
+
) => void;
|
|
98
|
+
saveTimestamp: (options: {
|
|
99
|
+
key: LocusSyncLatencyEventName;
|
|
100
|
+
options: {
|
|
101
|
+
meetingId: string;
|
|
102
|
+
dataSetName: string;
|
|
103
|
+
trackingId?: string;
|
|
104
|
+
};
|
|
105
|
+
}) => void;
|
|
106
|
+
clearLocusSyncLatency: (dataSetName: string, meetingId: string, trackingId?: string) => void;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type HashTreeParserCallbacks = {
|
|
110
|
+
locusInfoUpdateCallback: LocusInfoUpdateCallback;
|
|
111
|
+
syncLatencyTracker?: SyncLatencyTracker;
|
|
112
|
+
generateTrackingId?: GenerateTrackingId;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const SYNC_METRICS_DATA_SETS = [
|
|
116
|
+
DataSetNames.MAIN,
|
|
117
|
+
DataSetNames.ATD_ACTIVE,
|
|
118
|
+
DataSetNames.ATD_UNMUTED,
|
|
119
|
+
];
|
|
120
|
+
|
|
87
121
|
interface LeafInfo {
|
|
88
122
|
type: ObjectType;
|
|
89
123
|
id: number;
|
|
@@ -122,12 +156,18 @@ class HashTreeParser {
|
|
|
122
156
|
dataSets: Record<string, InternalDataSet> = {};
|
|
123
157
|
visibleDataSetsUrl: string; // url from which we can get info about all data sets
|
|
124
158
|
webexRequest: WebexRequestMethod;
|
|
125
|
-
|
|
159
|
+
private callbacks: HashTreeParserCallbacks;
|
|
160
|
+
private syncLatencyMeetingId: string;
|
|
126
161
|
visibleDataSets: VisibleDataSetInfo[];
|
|
127
162
|
debugId: string;
|
|
128
163
|
private excludedDataSets: string[];
|
|
129
164
|
state: 'active' | 'stopped';
|
|
130
|
-
private syncQueue: Array<{
|
|
165
|
+
private syncQueue: Array<{
|
|
166
|
+
dataSetName: string;
|
|
167
|
+
reason: string;
|
|
168
|
+
isInitialization?: boolean;
|
|
169
|
+
}> = [];
|
|
170
|
+
|
|
131
171
|
private isSyncInProgress = false;
|
|
132
172
|
// tracks whether syncAllDatasets is currently in its backoff delay phase and with what scope
|
|
133
173
|
private syncAllBackoffType: SyncAllBackoffType = SyncAllBackoffType.NONE;
|
|
@@ -136,7 +176,6 @@ class HashTreeParser {
|
|
|
136
176
|
private syncQueueProcessingPromise: Promise<void> = Promise.resolve();
|
|
137
177
|
// top-level heartbeat interval from the most recent message, used as fallback when dataset-level value is missing
|
|
138
178
|
private topLevelHeartbeatIntervalMs?: number;
|
|
139
|
-
|
|
140
179
|
/**
|
|
141
180
|
* Constructor for HashTreeParser
|
|
142
181
|
* @param {Object} options
|
|
@@ -149,15 +188,17 @@ class HashTreeParser {
|
|
|
149
188
|
};
|
|
150
189
|
metadata: Metadata | null;
|
|
151
190
|
webexRequest: WebexRequestMethod;
|
|
152
|
-
|
|
191
|
+
callbacks: HashTreeParserCallbacks;
|
|
153
192
|
debugId: string;
|
|
154
193
|
excludedDataSets?: string[];
|
|
194
|
+
syncLatencyMeetingId: string;
|
|
155
195
|
}) {
|
|
156
196
|
const {dataSets, locus} = options.initialLocus; // extract dataSets from initialLocus
|
|
157
197
|
|
|
158
198
|
this.debugId = options.debugId;
|
|
159
199
|
this.webexRequest = options.webexRequest;
|
|
160
|
-
this.
|
|
200
|
+
this.callbacks = options.callbacks;
|
|
201
|
+
this.syncLatencyMeetingId = options.syncLatencyMeetingId;
|
|
161
202
|
this.excludedDataSets = options.excludedDataSets || [];
|
|
162
203
|
this.visibleDataSetsUrl = locus?.links?.resources?.visibleDataSets?.url;
|
|
163
204
|
this.setVisibleDataSets(options.metadata?.visibleDataSets || [], dataSets);
|
|
@@ -1175,6 +1216,10 @@ class HashTreeParser {
|
|
|
1175
1216
|
this.handleRootHashHeartBeatMessage(message);
|
|
1176
1217
|
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
1177
1218
|
} else {
|
|
1219
|
+
// Completion of the sync latency metric (client.locus.sync.complete) is driven solely from
|
|
1220
|
+
// Meeting#processLocusLLMEvent once the matching LLM message arrives. body-mode syncs return
|
|
1221
|
+
// the locus state elements in the /sync HTTP response body, but per design the CA metric is
|
|
1222
|
+
// emitted only from the LLM message path, so no completion happens here.
|
|
1178
1223
|
const updatedObjects = this.parseMessage(message, debugText);
|
|
1179
1224
|
|
|
1180
1225
|
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
@@ -1185,6 +1230,40 @@ class HashTreeParser {
|
|
|
1185
1230
|
}
|
|
1186
1231
|
}
|
|
1187
1232
|
|
|
1233
|
+
/**
|
|
1234
|
+
* Checks if Locus sync latency metrics should be collected for a dataset.
|
|
1235
|
+
*
|
|
1236
|
+
* @param {string} dataSetName dataset name
|
|
1237
|
+
* @param {boolean} [isInitialization=false] whether this is an initialization sync
|
|
1238
|
+
* @returns {boolean}
|
|
1239
|
+
*/
|
|
1240
|
+
private shouldCollectSyncMetrics(dataSetName: string, isInitialization = false): boolean {
|
|
1241
|
+
return Boolean(
|
|
1242
|
+
this.callbacks.syncLatencyTracker &&
|
|
1243
|
+
!isInitialization &&
|
|
1244
|
+
SYNC_METRICS_DATA_SETS.includes(dataSetName)
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
private saveSyncBackoffLatency(
|
|
1249
|
+
dataSetName: string,
|
|
1250
|
+
randomBackoffTime: number,
|
|
1251
|
+
isInitialization = false
|
|
1252
|
+
) {
|
|
1253
|
+
if (!this.shouldCollectSyncMetrics(dataSetName, isInitialization)) {
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
this.callbacks.syncLatencyTracker?.saveLatency(
|
|
1258
|
+
'internal.client.locus.sync.random.backoff',
|
|
1259
|
+
Math.round(randomBackoffTime),
|
|
1260
|
+
{
|
|
1261
|
+
meetingId: this.syncLatencyMeetingId,
|
|
1262
|
+
dataSetName,
|
|
1263
|
+
}
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1188
1267
|
/**
|
|
1189
1268
|
* Calls the updateInfo callback if there are any updates to report
|
|
1190
1269
|
*
|
|
@@ -1238,10 +1317,10 @@ class HashTreeParser {
|
|
|
1238
1317
|
});
|
|
1239
1318
|
|
|
1240
1319
|
if (filteredUpdates.length > 0) {
|
|
1241
|
-
this.locusInfoUpdateCallback({updateType, updatedObjects: filteredUpdates});
|
|
1320
|
+
this.callbacks.locusInfoUpdateCallback({updateType, updatedObjects: filteredUpdates});
|
|
1242
1321
|
}
|
|
1243
1322
|
} else if (updateType !== LocusInfoUpdateType.OBJECTS_UPDATED) {
|
|
1244
|
-
this.locusInfoUpdateCallback({updateType});
|
|
1323
|
+
this.callbacks.locusInfoUpdateCallback({updateType});
|
|
1245
1324
|
}
|
|
1246
1325
|
}
|
|
1247
1326
|
|
|
@@ -1259,6 +1338,46 @@ class HashTreeParser {
|
|
|
1259
1338
|
return Math.round(randomValue ** exponent * maxMs);
|
|
1260
1339
|
}
|
|
1261
1340
|
|
|
1341
|
+
/**
|
|
1342
|
+
* Returns a copy of a hash tree message restricted to a single dataset, keeping only the
|
|
1343
|
+
* requested dataset and the elements belonging to it. Used to strip out datasets that Locus
|
|
1344
|
+
* may include in a sync response but that we didn't request (e.g. "unjoined" sharing elements
|
|
1345
|
+
* with "main"), which would otherwise be applied once per dataset.
|
|
1346
|
+
*
|
|
1347
|
+
* @param {HashTreeMessage} message the sync response message
|
|
1348
|
+
* @param {string} dataSetName the dataset that was requested
|
|
1349
|
+
* @returns {HashTreeMessage} a new message containing only the requested dataset
|
|
1350
|
+
*/
|
|
1351
|
+
private filterMessageToDataSet(message: HashTreeMessage, dataSetName: string): HashTreeMessage {
|
|
1352
|
+
const filteredOutDataSets = message.dataSets?.filter((ds) => ds.name !== dataSetName) ?? [];
|
|
1353
|
+
const filteredOutElements =
|
|
1354
|
+
message.locusStateElements?.filter((el) => !el.htMeta.dataSetNames?.includes(dataSetName)) ??
|
|
1355
|
+
[];
|
|
1356
|
+
|
|
1357
|
+
if (filteredOutDataSets.length > 0 || filteredOutElements.length > 0) {
|
|
1358
|
+
LoggerProxy.logger.info(
|
|
1359
|
+
`HashTreeParser#filterMessageToDataSet --> ${
|
|
1360
|
+
this.debugId
|
|
1361
|
+
} keeping only dataset "${dataSetName}", filtering out datasets: [${filteredOutDataSets
|
|
1362
|
+
.map((ds) => `${ds.name}:${ds.version}`)
|
|
1363
|
+
.join(',')}], elements: [${filteredOutElements
|
|
1364
|
+
.map(
|
|
1365
|
+
(el) =>
|
|
1366
|
+
`${el.htMeta?.elementId?.type}:${el.htMeta?.elementId?.id}:${el.htMeta?.elementId?.version}`
|
|
1367
|
+
)
|
|
1368
|
+
.join(',')}]`
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
return {
|
|
1373
|
+
...message,
|
|
1374
|
+
dataSets: message.dataSets?.filter((ds) => ds.name === dataSetName),
|
|
1375
|
+
locusStateElements: message.locusStateElements?.filter((el) =>
|
|
1376
|
+
el.htMeta.dataSetNames?.includes(dataSetName)
|
|
1377
|
+
),
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1262
1381
|
/**
|
|
1263
1382
|
* Performs a sync for the given data set.
|
|
1264
1383
|
*
|
|
@@ -1281,6 +1400,29 @@ class HashTreeParser {
|
|
|
1281
1400
|
|
|
1282
1401
|
const {hashTree} = dataSet;
|
|
1283
1402
|
const rootHash = hashTree.getRootHash();
|
|
1403
|
+
const shouldCollectMetrics = this.shouldCollectSyncMetrics(dataSet.name, isInitialization);
|
|
1404
|
+
// Generate two distinct tracking ids up-front. Each Locus request must carry its own unique
|
|
1405
|
+
// tracking id, so the /hashtree and /sync requests must not share one. hashtreeTrackingId is
|
|
1406
|
+
// generated first so that syncTrackingId (forced onto the /sync request, stored in metrics, and
|
|
1407
|
+
// used to match the LLM broadcast message) ends up with the later/higher sequence number,
|
|
1408
|
+
// matching the order in which Locus sees the requests. If we never call /hashtree (single-leaf
|
|
1409
|
+
// or initialization syncs), hashtreeTrackingId is simply unused.
|
|
1410
|
+
const hashtreeTrackingId = shouldCollectMetrics
|
|
1411
|
+
? this.callbacks.generateTrackingId?.()
|
|
1412
|
+
: undefined;
|
|
1413
|
+
const syncTrackingId = shouldCollectMetrics ? this.callbacks.generateTrackingId?.() : undefined;
|
|
1414
|
+
let syncRequestSent = false;
|
|
1415
|
+
|
|
1416
|
+
if (shouldCollectMetrics) {
|
|
1417
|
+
this.callbacks.syncLatencyTracker?.saveTimestamp({
|
|
1418
|
+
key: 'internal.client.locus.sync.start',
|
|
1419
|
+
options: {
|
|
1420
|
+
meetingId: this.syncLatencyMeetingId,
|
|
1421
|
+
dataSetName: dataSet.name,
|
|
1422
|
+
trackingId: syncTrackingId,
|
|
1423
|
+
},
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1284
1426
|
|
|
1285
1427
|
try {
|
|
1286
1428
|
LoggerProxy.logger.info(
|
|
@@ -1295,7 +1437,10 @@ class HashTreeParser {
|
|
|
1295
1437
|
|
|
1296
1438
|
try {
|
|
1297
1439
|
// request hashes from sender
|
|
1298
|
-
const hashesResult = await this.getHashesFromLocus(dataSet.name, rootHash
|
|
1440
|
+
const hashesResult = await this.getHashesFromLocus(dataSet.name, rootHash, {
|
|
1441
|
+
requestTrackingId: hashtreeTrackingId,
|
|
1442
|
+
metricTrackingId: syncTrackingId,
|
|
1443
|
+
});
|
|
1299
1444
|
|
|
1300
1445
|
if (!hashesResult) {
|
|
1301
1446
|
// hashes match, no sync needed
|
|
@@ -1339,11 +1484,21 @@ class HashTreeParser {
|
|
|
1339
1484
|
let syncResponse: HashTreeMessage | null = null;
|
|
1340
1485
|
|
|
1341
1486
|
if (isInitialization) {
|
|
1342
|
-
syncResponse = await this.sendSyncRequestToLocus(
|
|
1487
|
+
syncResponse = await this.sendSyncRequestToLocus(
|
|
1488
|
+
dataSet,
|
|
1489
|
+
{isInitialization: true},
|
|
1490
|
+
syncTrackingId
|
|
1491
|
+
);
|
|
1492
|
+
|
|
1493
|
+
syncRequestSent = true;
|
|
1343
1494
|
} else if (Object.keys(leavesData).length > 0) {
|
|
1344
|
-
syncResponse = await this.sendSyncRequestToLocus(
|
|
1345
|
-
|
|
1346
|
-
|
|
1495
|
+
syncResponse = await this.sendSyncRequestToLocus(
|
|
1496
|
+
dataSet,
|
|
1497
|
+
{mismatchedLeavesData: leavesData},
|
|
1498
|
+
syncTrackingId
|
|
1499
|
+
);
|
|
1500
|
+
|
|
1501
|
+
syncRequestSent = true;
|
|
1347
1502
|
}
|
|
1348
1503
|
|
|
1349
1504
|
// sync API may return nothing (in that case data will arrive via messages)
|
|
@@ -1357,9 +1512,13 @@ class HashTreeParser {
|
|
|
1357
1512
|
// misleading "aborting sync" message for this already-completed sync
|
|
1358
1513
|
dataSet.syncAbortController = undefined;
|
|
1359
1514
|
|
|
1515
|
+
// we only requested this dataset, so restrict the response to it before processing
|
|
1516
|
+
// (Locus may include shared datasets like "unjoined" alongside "main")
|
|
1517
|
+
const filteredResponse = this.filterMessageToDataSet(syncResponse, dataSet.name);
|
|
1518
|
+
|
|
1360
1519
|
// the format of sync response is the same as messages, so we can reuse the same handler
|
|
1361
1520
|
this.handleMessage(
|
|
1362
|
-
|
|
1521
|
+
filteredResponse,
|
|
1363
1522
|
`via sync API (${
|
|
1364
1523
|
isInitialization ? 'init' : `${Object.keys(leavesData).length} mismatched leaves`
|
|
1365
1524
|
})`
|
|
@@ -1373,6 +1532,16 @@ class HashTreeParser {
|
|
|
1373
1532
|
);
|
|
1374
1533
|
}
|
|
1375
1534
|
} finally {
|
|
1535
|
+
if (shouldCollectMetrics && !syncRequestSent) {
|
|
1536
|
+
// Drop only this sync's in-progress record (matched by its tracking id) rather than the
|
|
1537
|
+
// whole dataset, so a still-pending record from an earlier successful sync isn't wiped.
|
|
1538
|
+
// This mirrors the native client's onSyncError(syncId) which discards a single record.
|
|
1539
|
+
this.callbacks.syncLatencyTracker?.clearLocusSyncLatency(
|
|
1540
|
+
dataSet.name,
|
|
1541
|
+
this.syncLatencyMeetingId,
|
|
1542
|
+
syncTrackingId
|
|
1543
|
+
);
|
|
1544
|
+
}
|
|
1376
1545
|
dataSet.syncAbortController = undefined;
|
|
1377
1546
|
}
|
|
1378
1547
|
}
|
|
@@ -1598,6 +1767,7 @@ class HashTreeParser {
|
|
|
1598
1767
|
);
|
|
1599
1768
|
|
|
1600
1769
|
for (const ds of effectiveDataSetsToSync) {
|
|
1770
|
+
this.saveSyncBackoffLatency(ds.name, delay);
|
|
1601
1771
|
this.enqueueSyncForDataset(ds.name, 'syncAllDatasets');
|
|
1602
1772
|
}
|
|
1603
1773
|
|
|
@@ -1648,13 +1818,16 @@ class HashTreeParser {
|
|
|
1648
1818
|
|
|
1649
1819
|
dataSet.hashTree.resize(receivedDataSet.leafCount);
|
|
1650
1820
|
|
|
1651
|
-
const
|
|
1821
|
+
const randomBackoffTime = this.getWeightedBackoffTime(dataSet.backoff);
|
|
1822
|
+
const delay = dataSet.idleMs + randomBackoffTime;
|
|
1652
1823
|
|
|
1653
1824
|
if (delay > 0) {
|
|
1654
1825
|
if (dataSet.timer) {
|
|
1655
1826
|
clearTimeout(dataSet.timer);
|
|
1656
1827
|
}
|
|
1657
1828
|
|
|
1829
|
+
this.saveSyncBackoffLatency(dataSet.name, randomBackoffTime);
|
|
1830
|
+
|
|
1658
1831
|
dataSet.timer = setTimeout(() => {
|
|
1659
1832
|
dataSet.timer = undefined;
|
|
1660
1833
|
|
|
@@ -1723,6 +1896,8 @@ class HashTreeParser {
|
|
|
1723
1896
|
dataSetName: dataSet.name,
|
|
1724
1897
|
});
|
|
1725
1898
|
|
|
1899
|
+
this.saveSyncBackoffLatency(dataSet.name, backoffTime);
|
|
1900
|
+
|
|
1726
1901
|
this.enqueueSyncForDataset(dataSet.name, `heartbeat watchdog expired`);
|
|
1727
1902
|
this.resetHeartbeatWatchdogs([dataSet]);
|
|
1728
1903
|
}, delay);
|
|
@@ -1786,7 +1961,6 @@ class HashTreeParser {
|
|
|
1786
1961
|
* @returns {void}
|
|
1787
1962
|
*/
|
|
1788
1963
|
public resumeFromMessage(message: HashTreeMessage) {
|
|
1789
|
-
// check that message contains metadata with visible data sets - this is essential to be able to resume
|
|
1790
1964
|
const metadataObject = message.locusStateElements?.find((el) => isMetadata(el));
|
|
1791
1965
|
|
|
1792
1966
|
if (!metadataObject?.data?.visibleDataSets) {
|
|
@@ -1875,9 +2049,18 @@ class HashTreeParser {
|
|
|
1875
2049
|
* Gets the current hashes from the locus for a specific data set.
|
|
1876
2050
|
* @param {string} dataSetName
|
|
1877
2051
|
* @param {string} currentRootHash
|
|
2052
|
+
* @param {Object} [trackingIds] tracking ids for the /hashtree request
|
|
2053
|
+
* @param {string} [trackingIds.requestTrackingId] tracking id forced onto the /hashtree HTTP request header (kept distinct from the /sync request's tracking id)
|
|
2054
|
+
* @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
|
|
1878
2055
|
* @returns {Object|null} An object containing the hashes and leaf count, or null if the hashes match and no sync is needed
|
|
1879
2056
|
*/
|
|
1880
|
-
private getHashesFromLocus(
|
|
2057
|
+
private getHashesFromLocus(
|
|
2058
|
+
dataSetName: string,
|
|
2059
|
+
currentRootHash: string,
|
|
2060
|
+
trackingIds?: {requestTrackingId?: string; metricTrackingId?: string}
|
|
2061
|
+
) {
|
|
2062
|
+
const {requestTrackingId, metricTrackingId} = trackingIds ?? {};
|
|
2063
|
+
|
|
1881
2064
|
LoggerProxy.logger.info(
|
|
1882
2065
|
`HashTreeParser#getHashesFromLocus --> ${this.debugId} Requesting hashes for data set "${dataSetName}"`
|
|
1883
2066
|
);
|
|
@@ -1886,14 +2069,39 @@ class HashTreeParser {
|
|
|
1886
2069
|
|
|
1887
2070
|
const url = `${dataSet.url}/hashtree`;
|
|
1888
2071
|
|
|
2072
|
+
if (this.shouldCollectSyncMetrics(dataSetName)) {
|
|
2073
|
+
this.callbacks.syncLatencyTracker?.saveTimestamp({
|
|
2074
|
+
key: 'internal.client.locus.hashtree.request',
|
|
2075
|
+
options: {
|
|
2076
|
+
meetingId: this.syncLatencyMeetingId,
|
|
2077
|
+
dataSetName,
|
|
2078
|
+
trackingId: metricTrackingId,
|
|
2079
|
+
},
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
|
|
1889
2083
|
return this.webexRequest({
|
|
1890
2084
|
method: HTTP_VERBS.GET,
|
|
1891
2085
|
uri: url,
|
|
1892
2086
|
qs: {
|
|
1893
2087
|
rootHash: currentRootHash,
|
|
1894
2088
|
},
|
|
2089
|
+
// Force a dedicated tracking id onto the /hashtree request so it does not share the /sync
|
|
2090
|
+
// request's tracking id; the tracking id interceptor leaves an already-set header untouched.
|
|
2091
|
+
...(requestTrackingId ? {headers: {trackingid: requestTrackingId}} : {}),
|
|
1895
2092
|
})
|
|
1896
2093
|
.then((response) => {
|
|
2094
|
+
if (this.shouldCollectSyncMetrics(dataSetName)) {
|
|
2095
|
+
this.callbacks.syncLatencyTracker?.saveTimestamp({
|
|
2096
|
+
key: 'internal.client.locus.hashtree.response',
|
|
2097
|
+
options: {
|
|
2098
|
+
meetingId: this.syncLatencyMeetingId,
|
|
2099
|
+
dataSetName,
|
|
2100
|
+
trackingId: metricTrackingId,
|
|
2101
|
+
},
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
|
|
1897
2105
|
if (!response.body || isEmpty(response.body)) {
|
|
1898
2106
|
// 204 with empty body means our hashes match Locus, no sync needed
|
|
1899
2107
|
LoggerProxy.logger.info(
|
|
@@ -1948,11 +2156,13 @@ class HashTreeParser {
|
|
|
1948
2156
|
*
|
|
1949
2157
|
* @param {InternalDataSet} dataSet The data set to sync.
|
|
1950
2158
|
* @param {Object} options Either `{ isInitialization: true }` for init syncs (uses leafCount=1 with empty leaf data) or `{ mismatchedLeavesData }` for normal syncs.
|
|
1951
|
-
* @
|
|
2159
|
+
* @param {string} [trackingId] tracking id
|
|
2160
|
+
* @returns {Promise<HashTreeMessage | null>}
|
|
1952
2161
|
*/
|
|
1953
2162
|
private sendSyncRequestToLocus(
|
|
1954
2163
|
dataSet: InternalDataSet,
|
|
1955
|
-
options: {isInitialization: true} | {mismatchedLeavesData: Record<number, LeafDataItem[]>}
|
|
2164
|
+
options: {isInitialization: true} | {mismatchedLeavesData: Record<number, LeafDataItem[]>},
|
|
2165
|
+
trackingId?: string
|
|
1956
2166
|
): Promise<HashTreeMessage | null> {
|
|
1957
2167
|
LoggerProxy.logger.info(
|
|
1958
2168
|
`HashTreeParser#sendSyncRequestToLocus --> ${this.debugId} Sending sync request for data set "${dataSet.name}"`
|
|
@@ -1986,6 +2196,18 @@ class HashTreeParser {
|
|
|
1986
2196
|
}
|
|
1987
2197
|
|
|
1988
2198
|
const ourCurrentRootHash = dataSet.hashTree ? dataSet.hashTree.getRootHash() : EMPTY_HASH;
|
|
2199
|
+
const shouldCollectMetrics = this.shouldCollectSyncMetrics(dataSet.name, isInitialization);
|
|
2200
|
+
|
|
2201
|
+
if (shouldCollectMetrics) {
|
|
2202
|
+
this.callbacks.syncLatencyTracker?.saveTimestamp({
|
|
2203
|
+
key: 'internal.client.locus.sync.request',
|
|
2204
|
+
options: {
|
|
2205
|
+
meetingId: this.syncLatencyMeetingId,
|
|
2206
|
+
dataSetName: dataSet.name,
|
|
2207
|
+
trackingId,
|
|
2208
|
+
},
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
1989
2211
|
|
|
1990
2212
|
return this.webexRequest({
|
|
1991
2213
|
method: HTTP_VERBS.POST,
|
|
@@ -1993,9 +2215,23 @@ class HashTreeParser {
|
|
|
1993
2215
|
qs: {
|
|
1994
2216
|
rootHash: ourCurrentRootHash,
|
|
1995
2217
|
},
|
|
2218
|
+
// Force the pre-generated tracking id onto the /sync request so Locus echoes it back on the
|
|
2219
|
+
// resulting LLM message; the tracking id interceptor leaves an already-set header untouched.
|
|
2220
|
+
...(trackingId ? {headers: {trackingid: trackingId}} : {}),
|
|
1996
2221
|
body,
|
|
1997
2222
|
})
|
|
1998
2223
|
.then((resp) => {
|
|
2224
|
+
if (shouldCollectMetrics) {
|
|
2225
|
+
this.callbacks.syncLatencyTracker?.saveTimestamp({
|
|
2226
|
+
key: 'internal.client.locus.sync.response',
|
|
2227
|
+
options: {
|
|
2228
|
+
meetingId: this.syncLatencyMeetingId,
|
|
2229
|
+
dataSetName: dataSet.name,
|
|
2230
|
+
trackingId,
|
|
2231
|
+
},
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
|
|
1999
2235
|
if (!resp.body || isEmpty(resp.body)) {
|
|
2000
2236
|
LoggerProxy.logger.info(
|
|
2001
2237
|
`HashTreeParser#sendSyncRequestToLocus --> ${this.debugId} Got ${resp.statusCode} with empty body for sync request for data set "${dataSet.name}", data should arrive via messages`
|