@webex/plugin-meetings 3.12.0-next.102 → 3.12.0-next.103
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 +147 -19
- 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 +56 -33
- package/dist/locus-info/index.js.map +1 -1
- package/dist/meeting/index.js +284 -37
- package/dist/meeting/index.js.map +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +40 -3
- package/dist/types/locus-info/index.d.ts +10 -4
- package/dist/types/meeting/index.d.ts +54 -1
- package/dist/webinar/index.js +1 -1
- package/package.json +13 -13
- 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 +209 -17
- package/src/locus-info/index.ts +45 -18
- package/src/meeting/index.ts +246 -4
- 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 +440 -3
- package/test/unit/spec/locus-info/index.js +45 -5
- package/test/unit/spec/meeting/index.js +389 -0
|
@@ -177,15 +177,23 @@ describe('HashTreeParser', () => {
|
|
|
177
177
|
function createHashTreeParser(
|
|
178
178
|
initialLocus: any = exampleInitialLocus,
|
|
179
179
|
metadata: any = exampleMetadata,
|
|
180
|
-
excludedDataSets?: string[]
|
|
180
|
+
excludedDataSets?: string[],
|
|
181
|
+
syncLatencyTracker?: any,
|
|
182
|
+
syncLatencyMeetingId = 'meeting-1',
|
|
183
|
+
generateTrackingId?: any
|
|
181
184
|
) {
|
|
182
185
|
return new HashTreeParser({
|
|
183
186
|
initialLocus,
|
|
184
187
|
metadata,
|
|
185
188
|
webexRequest,
|
|
186
|
-
|
|
189
|
+
callbacks: {
|
|
190
|
+
locusInfoUpdateCallback: callback,
|
|
191
|
+
syncLatencyTracker,
|
|
192
|
+
generateTrackingId,
|
|
193
|
+
},
|
|
187
194
|
debugId: 'test',
|
|
188
195
|
excludedDataSets,
|
|
196
|
+
syncLatencyMeetingId,
|
|
189
197
|
});
|
|
190
198
|
}
|
|
191
199
|
|
|
@@ -226,7 +234,7 @@ describe('HashTreeParser', () => {
|
|
|
226
234
|
}
|
|
227
235
|
|
|
228
236
|
// Helper to mock sendSyncRequestToLocus response
|
|
229
|
-
function mockSendSyncRequestResponse(dataSetUrl: string, response: any) {
|
|
237
|
+
function mockSendSyncRequestResponse(dataSetUrl: string, response: any, headers?: any) {
|
|
230
238
|
webexRequest
|
|
231
239
|
.withArgs(
|
|
232
240
|
sinon.match({
|
|
@@ -236,6 +244,7 @@ describe('HashTreeParser', () => {
|
|
|
236
244
|
)
|
|
237
245
|
.resolves({
|
|
238
246
|
body: response,
|
|
247
|
+
headers,
|
|
239
248
|
});
|
|
240
249
|
}
|
|
241
250
|
|
|
@@ -2384,6 +2393,7 @@ describe('HashTreeParser', () => {
|
|
|
2384
2393
|
reason: 'sync failed',
|
|
2385
2394
|
});
|
|
2386
2395
|
});
|
|
2396
|
+
|
|
2387
2397
|
});
|
|
2388
2398
|
|
|
2389
2399
|
describe('handles visible data sets changes correctly', () => {
|
|
@@ -3097,6 +3107,106 @@ describe('HashTreeParser', () => {
|
|
|
3097
3107
|
);
|
|
3098
3108
|
});
|
|
3099
3109
|
|
|
3110
|
+
it('uses the watchdog random backoff when reporting sync metrics', async () => {
|
|
3111
|
+
const syncLatencyTracker = {
|
|
3112
|
+
saveLatency: sinon.stub(),
|
|
3113
|
+
saveTimestamp: sinon.stub(),
|
|
3114
|
+
getLocusSyncLatency: sinon.stub(),
|
|
3115
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
3116
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
3117
|
+
};
|
|
3118
|
+
const parser = createHashTreeParser(
|
|
3119
|
+
undefined,
|
|
3120
|
+
undefined,
|
|
3121
|
+
undefined,
|
|
3122
|
+
syncLatencyTracker
|
|
3123
|
+
);
|
|
3124
|
+
const heartbeatIntervalMs = 5000;
|
|
3125
|
+
const mainDataSetUrl = parser.dataSets.main.url;
|
|
3126
|
+
|
|
3127
|
+
mathRandomStub.onFirstCall().returns(0.1); // root-hash timer backoff = 10ms
|
|
3128
|
+
mathRandomStub.onSecondCall().returns(0.5); // watchdog backoff = 250ms
|
|
3129
|
+
mathRandomStub.returns(0);
|
|
3130
|
+
|
|
3131
|
+
parser.handleMessage(
|
|
3132
|
+
{
|
|
3133
|
+
dataSets: [
|
|
3134
|
+
{
|
|
3135
|
+
...createDataSet('main', 16, 1100),
|
|
3136
|
+
root: parser.dataSets.main.hashTree.getRootHash(),
|
|
3137
|
+
},
|
|
3138
|
+
],
|
|
3139
|
+
visibleDataSetsUrl,
|
|
3140
|
+
locusUrl,
|
|
3141
|
+
},
|
|
3142
|
+
'initial heartbeat'
|
|
3143
|
+
);
|
|
3144
|
+
|
|
3145
|
+
mockGetHashesFromLocusResponse(
|
|
3146
|
+
mainDataSetUrl,
|
|
3147
|
+
new Array(16).fill('00000000000000000000000000000000'),
|
|
3148
|
+
createDataSet('main', 16, 1101)
|
|
3149
|
+
);
|
|
3150
|
+
mockSendSyncRequestResponse(mainDataSetUrl, null);
|
|
3151
|
+
|
|
3152
|
+
await clock.tickAsync(heartbeatIntervalMs + 250);
|
|
3153
|
+
|
|
3154
|
+
assert.calledWithExactly(
|
|
3155
|
+
syncLatencyTracker.saveLatency,
|
|
3156
|
+
'internal.client.locus.sync.random.backoff',
|
|
3157
|
+
250,
|
|
3158
|
+
{
|
|
3159
|
+
meetingId: 'meeting-1',
|
|
3160
|
+
dataSetName: 'main',
|
|
3161
|
+
}
|
|
3162
|
+
);
|
|
3163
|
+
});
|
|
3164
|
+
|
|
3165
|
+
it('uses the root sync random backoff when root timer fires before watchdog', async () => {
|
|
3166
|
+
const syncLatencyTracker = {
|
|
3167
|
+
saveLatency: sinon.stub(),
|
|
3168
|
+
saveTimestamp: sinon.stub(),
|
|
3169
|
+
getLocusSyncLatency: sinon.stub(),
|
|
3170
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
3171
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
3172
|
+
};
|
|
3173
|
+
const parser = createHashTreeParser(
|
|
3174
|
+
undefined,
|
|
3175
|
+
undefined,
|
|
3176
|
+
undefined,
|
|
3177
|
+
syncLatencyTracker
|
|
3178
|
+
);
|
|
3179
|
+
const mainDataSetUrl = parser.dataSets.main.url;
|
|
3180
|
+
|
|
3181
|
+
mathRandomStub.onFirstCall().returns(0.1); // root-hash timer backoff = 10ms
|
|
3182
|
+
mathRandomStub.onSecondCall().returns(0.5); // watchdog backoff = 250ms
|
|
3183
|
+
mathRandomStub.returns(0);
|
|
3184
|
+
|
|
3185
|
+
parser.handleMessage(
|
|
3186
|
+
createHeartbeatMessage('main', 16, 1100, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1'),
|
|
3187
|
+
'root mismatch heartbeat'
|
|
3188
|
+
);
|
|
3189
|
+
|
|
3190
|
+
mockGetHashesFromLocusResponse(
|
|
3191
|
+
mainDataSetUrl,
|
|
3192
|
+
new Array(16).fill('00000000000000000000000000000000'),
|
|
3193
|
+
createDataSet('main', 16, 1101)
|
|
3194
|
+
);
|
|
3195
|
+
mockSendSyncRequestResponse(mainDataSetUrl, null);
|
|
3196
|
+
|
|
3197
|
+
await clock.tickAsync(1010);
|
|
3198
|
+
|
|
3199
|
+
assert.calledWithExactly(
|
|
3200
|
+
syncLatencyTracker.saveLatency,
|
|
3201
|
+
'internal.client.locus.sync.random.backoff',
|
|
3202
|
+
10,
|
|
3203
|
+
{
|
|
3204
|
+
meetingId: 'meeting-1',
|
|
3205
|
+
dataSetName: 'main',
|
|
3206
|
+
}
|
|
3207
|
+
);
|
|
3208
|
+
});
|
|
3209
|
+
|
|
3100
3210
|
it('calls POST sync directly for leafCount === 1 data sets', async () => {
|
|
3101
3211
|
const parser = createHashTreeParser();
|
|
3102
3212
|
const heartbeatIntervalMs = 5000;
|
|
@@ -4697,6 +4807,47 @@ describe('HashTreeParser', () => {
|
|
|
4697
4807
|
assert.neverCalledWith(webexRequest, sinon.match({method: 'GET', uri: `${selfUrl}/hashtree`}));
|
|
4698
4808
|
});
|
|
4699
4809
|
|
|
4810
|
+
it('uses the syncAll random backoff when reporting sync metrics', async () => {
|
|
4811
|
+
mathRandomStub.returns(0.5); // syncAll backoff = 0.5^2 * 1000 = 250ms
|
|
4812
|
+
|
|
4813
|
+
const syncLatencyTracker = {
|
|
4814
|
+
saveLatency: sinon.stub(),
|
|
4815
|
+
saveTimestamp: sinon.stub(),
|
|
4816
|
+
getLocusSyncLatency: sinon.stub(),
|
|
4817
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
4818
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
4819
|
+
};
|
|
4820
|
+
const parser = createHashTreeParser(
|
|
4821
|
+
undefined,
|
|
4822
|
+
undefined,
|
|
4823
|
+
['atd-unmuted'],
|
|
4824
|
+
syncLatencyTracker
|
|
4825
|
+
);
|
|
4826
|
+
const mainUrl = parser.dataSets.main.url;
|
|
4827
|
+
|
|
4828
|
+
mockGetHashesFromLocusResponse(
|
|
4829
|
+
mainUrl,
|
|
4830
|
+
new Array(16).fill('00000000000000000000000000000000'),
|
|
4831
|
+
createDataSet('main', 16, 1100)
|
|
4832
|
+
);
|
|
4833
|
+
mockSendSyncRequestResponse(mainUrl, null);
|
|
4834
|
+
|
|
4835
|
+
const syncAllPromise = parser.syncAllDatasets({onlyLLM: true});
|
|
4836
|
+
|
|
4837
|
+
await clock.tickAsync(250);
|
|
4838
|
+
await syncAllPromise;
|
|
4839
|
+
|
|
4840
|
+
assert.calledWithExactly(
|
|
4841
|
+
syncLatencyTracker.saveLatency,
|
|
4842
|
+
'internal.client.locus.sync.random.backoff',
|
|
4843
|
+
250,
|
|
4844
|
+
{
|
|
4845
|
+
meetingId: 'meeting-1',
|
|
4846
|
+
dataSetName: 'main',
|
|
4847
|
+
}
|
|
4848
|
+
);
|
|
4849
|
+
});
|
|
4850
|
+
|
|
4700
4851
|
it('should upgrade scope from onlyLLM=true to all datasets when onlyLLM=false call arrives during backoff', async () => {
|
|
4701
4852
|
// Make Math.random return 1 so backoff = 1^2 * 1000 = 1000ms (non-zero delay for interleaving)
|
|
4702
4853
|
mathRandomStub.returns(1);
|
|
@@ -5325,4 +5476,290 @@ describe('HashTreeParser', () => {
|
|
|
5325
5476
|
expect(parser.dataSets).to.deep.equal({});
|
|
5326
5477
|
});
|
|
5327
5478
|
});
|
|
5479
|
+
|
|
5480
|
+
describe('#syncMetrics', () => {
|
|
5481
|
+
it('records sync latency timestamps when sync response has empty body', async () => {
|
|
5482
|
+
const syncLatencyTracker = {
|
|
5483
|
+
saveLatency: sinon.stub(),
|
|
5484
|
+
saveTimestamp: sinon.stub(),
|
|
5485
|
+
getLocusSyncLatency: sinon.stub(),
|
|
5486
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
5487
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
5488
|
+
};
|
|
5489
|
+
const parser = createHashTreeParser(
|
|
5490
|
+
undefined,
|
|
5491
|
+
undefined,
|
|
5492
|
+
undefined,
|
|
5493
|
+
syncLatencyTracker
|
|
5494
|
+
);
|
|
5495
|
+
const mainDataSetUrl = parser.dataSets.main.url;
|
|
5496
|
+
|
|
5497
|
+
mockGetHashesFromLocusResponse(
|
|
5498
|
+
mainDataSetUrl,
|
|
5499
|
+
new Array(16).fill('00000000000000000000000000000000'),
|
|
5500
|
+
createDataSet('main', 16, 1101)
|
|
5501
|
+
);
|
|
5502
|
+
mockSendSyncRequestResponse(mainDataSetUrl, null);
|
|
5503
|
+
|
|
5504
|
+
parser.handleMessage(
|
|
5505
|
+
createHeartbeatMessage('main', 16, 1100, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1'),
|
|
5506
|
+
'trigger sync metrics'
|
|
5507
|
+
);
|
|
5508
|
+
|
|
5509
|
+
await clock.tickAsync(1000);
|
|
5510
|
+
|
|
5511
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5512
|
+
key: 'internal.client.locus.sync.start',
|
|
5513
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: undefined},
|
|
5514
|
+
});
|
|
5515
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5516
|
+
key: 'internal.client.locus.hashtree.request',
|
|
5517
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: undefined},
|
|
5518
|
+
});
|
|
5519
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5520
|
+
key: 'internal.client.locus.hashtree.response',
|
|
5521
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: undefined},
|
|
5522
|
+
});
|
|
5523
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5524
|
+
key: 'internal.client.locus.sync.request',
|
|
5525
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: undefined},
|
|
5526
|
+
});
|
|
5527
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5528
|
+
key: 'internal.client.locus.sync.response',
|
|
5529
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: undefined},
|
|
5530
|
+
});
|
|
5531
|
+
assert.notCalled(syncLatencyTracker.getLocusSyncLatency);
|
|
5532
|
+
});
|
|
5533
|
+
|
|
5534
|
+
it('clears only the failed sync record (by tracking id) when the /sync request errors', async () => {
|
|
5535
|
+
const syncLatencyTracker = {
|
|
5536
|
+
saveLatency: sinon.stub(),
|
|
5537
|
+
saveTimestamp: sinon.stub(),
|
|
5538
|
+
getLocusSyncLatency: sinon.stub(),
|
|
5539
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
5540
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
5541
|
+
};
|
|
5542
|
+
const generateTrackingId = sinon.stub().returns('our-sync-tracking-id');
|
|
5543
|
+
const parser = createHashTreeParser(
|
|
5544
|
+
undefined,
|
|
5545
|
+
undefined,
|
|
5546
|
+
undefined,
|
|
5547
|
+
syncLatencyTracker,
|
|
5548
|
+
undefined,
|
|
5549
|
+
generateTrackingId
|
|
5550
|
+
);
|
|
5551
|
+
const mainDataSetUrl = parser.dataSets.main.url;
|
|
5552
|
+
|
|
5553
|
+
// Mismatched hashes so the flow proceeds to POST /sync, which then fails.
|
|
5554
|
+
mockGetHashesFromLocusResponse(
|
|
5555
|
+
mainDataSetUrl,
|
|
5556
|
+
new Array(16).fill('00000000000000000000000000000000'),
|
|
5557
|
+
createDataSet('main', 16, 1101)
|
|
5558
|
+
);
|
|
5559
|
+
webexRequest
|
|
5560
|
+
.withArgs(sinon.match({method: 'POST', uri: `${mainDataSetUrl}/sync`}))
|
|
5561
|
+
.rejects(new Error('sync failed'));
|
|
5562
|
+
|
|
5563
|
+
parser.handleMessage(
|
|
5564
|
+
createHeartbeatMessage('main', 16, 1100, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1'),
|
|
5565
|
+
'trigger sync metrics'
|
|
5566
|
+
);
|
|
5567
|
+
|
|
5568
|
+
await clock.tickAsync(1000);
|
|
5569
|
+
|
|
5570
|
+
// Because /sync failed, syncRequestSent stays false and the finally block drops the record,
|
|
5571
|
+
// passing the tracking id so only this in-progress record is removed (native onSyncError parity).
|
|
5572
|
+
assert.calledWithExactly(
|
|
5573
|
+
syncLatencyTracker.clearLocusSyncLatency,
|
|
5574
|
+
'main',
|
|
5575
|
+
'meeting-1',
|
|
5576
|
+
'our-sync-tracking-id'
|
|
5577
|
+
);
|
|
5578
|
+
});
|
|
5579
|
+
|
|
5580
|
+
it('forces a pre-generated tracking id onto the sync request and records it', async () => {
|
|
5581
|
+
const syncLatencyTracker = {
|
|
5582
|
+
saveLatency: sinon.stub(),
|
|
5583
|
+
saveTimestamp: sinon.stub(),
|
|
5584
|
+
getLocusSyncLatency: sinon.stub(),
|
|
5585
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
5586
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
5587
|
+
};
|
|
5588
|
+
// two distinct tracking ids are generated: the first for the /hashtree request and the
|
|
5589
|
+
// second for the /sync request (which is also stored in metrics and used for LLM matching)
|
|
5590
|
+
const generateTrackingId = sinon.stub();
|
|
5591
|
+
generateTrackingId.onFirstCall().returns('our-hashtree-tracking-id');
|
|
5592
|
+
generateTrackingId.onSecondCall().returns('our-sync-tracking-id');
|
|
5593
|
+
const parser = createHashTreeParser(
|
|
5594
|
+
undefined,
|
|
5595
|
+
undefined,
|
|
5596
|
+
undefined,
|
|
5597
|
+
syncLatencyTracker,
|
|
5598
|
+
undefined,
|
|
5599
|
+
generateTrackingId
|
|
5600
|
+
);
|
|
5601
|
+
const mainDataSetUrl = parser.dataSets.main.url;
|
|
5602
|
+
|
|
5603
|
+
mockGetHashesFromLocusResponse(
|
|
5604
|
+
mainDataSetUrl,
|
|
5605
|
+
new Array(16).fill('00000000000000000000000000000000'),
|
|
5606
|
+
createDataSet('main', 16, 1102)
|
|
5607
|
+
);
|
|
5608
|
+
mockSendSyncRequestResponse(mainDataSetUrl, null);
|
|
5609
|
+
|
|
5610
|
+
parser.handleMessage(
|
|
5611
|
+
createHeartbeatMessage('main', 16, 1100, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1'),
|
|
5612
|
+
'trigger sync metrics'
|
|
5613
|
+
);
|
|
5614
|
+
|
|
5615
|
+
await clock.tickAsync(1000);
|
|
5616
|
+
|
|
5617
|
+
// two distinct tracking ids are generated up-front so the /hashtree and /sync requests do
|
|
5618
|
+
// not share a tracking id
|
|
5619
|
+
assert.calledTwice(generateTrackingId);
|
|
5620
|
+
// the /hashtree request carries its own (first) tracking id
|
|
5621
|
+
assert.calledWith(
|
|
5622
|
+
webexRequest,
|
|
5623
|
+
sinon.match({
|
|
5624
|
+
method: 'GET',
|
|
5625
|
+
uri: `${mainDataSetUrl}/hashtree`,
|
|
5626
|
+
headers: {trackingid: 'our-hashtree-tracking-id'},
|
|
5627
|
+
})
|
|
5628
|
+
);
|
|
5629
|
+
// the /sync request carries the second tracking id, which Locus echoes back on the resulting
|
|
5630
|
+
// LLM message so the Meeting object can match it to this sync
|
|
5631
|
+
assert.calledWith(
|
|
5632
|
+
webexRequest,
|
|
5633
|
+
sinon.match({
|
|
5634
|
+
method: 'POST',
|
|
5635
|
+
uri: `${mainDataSetUrl}/sync`,
|
|
5636
|
+
headers: {trackingid: 'our-sync-tracking-id'},
|
|
5637
|
+
})
|
|
5638
|
+
);
|
|
5639
|
+
|
|
5640
|
+
// the same tracking id is stamped on the sync milestones so the Meeting object can later
|
|
5641
|
+
// match the LLM event to this sync
|
|
5642
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5643
|
+
key: 'internal.client.locus.sync.start',
|
|
5644
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: 'our-sync-tracking-id'},
|
|
5645
|
+
});
|
|
5646
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5647
|
+
key: 'internal.client.locus.hashtree.request',
|
|
5648
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: 'our-sync-tracking-id'},
|
|
5649
|
+
});
|
|
5650
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5651
|
+
key: 'internal.client.locus.hashtree.response',
|
|
5652
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: 'our-sync-tracking-id'},
|
|
5653
|
+
});
|
|
5654
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5655
|
+
key: 'internal.client.locus.sync.request',
|
|
5656
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: 'our-sync-tracking-id'},
|
|
5657
|
+
});
|
|
5658
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5659
|
+
key: 'internal.client.locus.sync.response',
|
|
5660
|
+
options: {meetingId: 'meeting-1', dataSetName: 'main', trackingId: 'our-sync-tracking-id'},
|
|
5661
|
+
});
|
|
5662
|
+
assert.notCalled(syncLatencyTracker.getLocusSyncLatency);
|
|
5663
|
+
});
|
|
5664
|
+
|
|
5665
|
+
it('does not complete or clear metrics when matching dataset message arrives', () => {
|
|
5666
|
+
const syncLatencyTracker = {
|
|
5667
|
+
saveLatency: sinon.stub(),
|
|
5668
|
+
saveTimestamp: sinon.stub(),
|
|
5669
|
+
getLocusSyncLatency: sinon.stub(),
|
|
5670
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
5671
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
5672
|
+
};
|
|
5673
|
+
const parser = createHashTreeParser(
|
|
5674
|
+
undefined,
|
|
5675
|
+
undefined,
|
|
5676
|
+
undefined,
|
|
5677
|
+
syncLatencyTracker
|
|
5678
|
+
);
|
|
5679
|
+
|
|
5680
|
+
parser.handleMessage({
|
|
5681
|
+
dataSets: [
|
|
5682
|
+
{
|
|
5683
|
+
...createDataSet('main', 16, 1001),
|
|
5684
|
+
root: 'newroot',
|
|
5685
|
+
},
|
|
5686
|
+
],
|
|
5687
|
+
visibleDataSetsUrl,
|
|
5688
|
+
locusUrl,
|
|
5689
|
+
locusStateElements: [],
|
|
5690
|
+
});
|
|
5691
|
+
|
|
5692
|
+
assert.notCalled(syncLatencyTracker.getLocusSyncLatency);
|
|
5693
|
+
assert.notCalled(syncLatencyTracker.clearLocusSyncLatency);
|
|
5694
|
+
assert.notCalled(syncLatencyTracker.completeLocusSyncLatency);
|
|
5695
|
+
});
|
|
5696
|
+
|
|
5697
|
+
it('does not complete sync metrics when sync response has body (completion is LLM-only)', async () => {
|
|
5698
|
+
const syncLatencyTracker = {
|
|
5699
|
+
saveLatency: sinon.stub(),
|
|
5700
|
+
saveTimestamp: sinon.stub(),
|
|
5701
|
+
getLocusSyncLatency: sinon.stub(),
|
|
5702
|
+
clearLocusSyncLatency: sinon.stub(),
|
|
5703
|
+
completeLocusSyncLatency: sinon.stub(),
|
|
5704
|
+
};
|
|
5705
|
+
const generateTrackingId = sinon.stub().returns('our-sync-tracking-id');
|
|
5706
|
+
const parser = createHashTreeParser(
|
|
5707
|
+
undefined,
|
|
5708
|
+
undefined,
|
|
5709
|
+
undefined,
|
|
5710
|
+
syncLatencyTracker,
|
|
5711
|
+
undefined,
|
|
5712
|
+
generateTrackingId
|
|
5713
|
+
);
|
|
5714
|
+
const mainDataSetUrl = parser.dataSets.main.url;
|
|
5715
|
+
const syncResponse = {
|
|
5716
|
+
dataSets: [
|
|
5717
|
+
{
|
|
5718
|
+
...createDataSet('main', 16, 1102),
|
|
5719
|
+
root: 'newroot',
|
|
5720
|
+
},
|
|
5721
|
+
],
|
|
5722
|
+
visibleDataSetsUrl,
|
|
5723
|
+
locusUrl,
|
|
5724
|
+
locusStateElements: [],
|
|
5725
|
+
};
|
|
5726
|
+
|
|
5727
|
+
mockGetHashesFromLocusResponse(
|
|
5728
|
+
mainDataSetUrl,
|
|
5729
|
+
new Array(16).fill('00000000000000000000000000000000'),
|
|
5730
|
+
createDataSet('main', 16, 1102)
|
|
5731
|
+
);
|
|
5732
|
+
mockSendSyncRequestResponse(mainDataSetUrl, syncResponse);
|
|
5733
|
+
|
|
5734
|
+
parser.handleMessage(
|
|
5735
|
+
createHeartbeatMessage('main', 16, 1100, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1'),
|
|
5736
|
+
'trigger sync metrics'
|
|
5737
|
+
);
|
|
5738
|
+
|
|
5739
|
+
await clock.tickAsync(1000);
|
|
5740
|
+
|
|
5741
|
+
assert.calledWithExactly(syncLatencyTracker.saveTimestamp, {
|
|
5742
|
+
key: 'internal.client.locus.sync.response',
|
|
5743
|
+
options: {
|
|
5744
|
+
meetingId: 'meeting-1',
|
|
5745
|
+
dataSetName: 'main',
|
|
5746
|
+
trackingId: 'our-sync-tracking-id',
|
|
5747
|
+
},
|
|
5748
|
+
});
|
|
5749
|
+
// body-mode syncs return the state elements in the /sync HTTP response, but per the LLM-only
|
|
5750
|
+
// design the CA metric is completed solely from Meeting#processLocusLLMEvent once the matching
|
|
5751
|
+
// LLM message arrives. handleMessage must not record the message-received milestone nor
|
|
5752
|
+
// complete the metric here.
|
|
5753
|
+
assert.neverCalledWith(syncLatencyTracker.saveTimestamp, {
|
|
5754
|
+
key: 'internal.client.locus.sync.message.received',
|
|
5755
|
+
options: {
|
|
5756
|
+
meetingId: 'meeting-1',
|
|
5757
|
+
dataSetName: 'main',
|
|
5758
|
+
trackingId: 'our-sync-tracking-id',
|
|
5759
|
+
},
|
|
5760
|
+
});
|
|
5761
|
+
assert.notCalled(syncLatencyTracker.completeLocusSyncLatency);
|
|
5762
|
+
});
|
|
5763
|
+
|
|
5764
|
+
});
|
|
5328
5765
|
});
|
|
@@ -3,6 +3,7 @@ import sinon from 'sinon';
|
|
|
3
3
|
import {cloneDeep, forEach} from 'lodash';
|
|
4
4
|
import {assert} from '@webex/test-helper-chai';
|
|
5
5
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
6
|
+
import {webexTrackingIdSequenceNumbers} from '@webex/webex-core';
|
|
6
7
|
import testUtils from '../../../utils/testUtils';
|
|
7
8
|
import Meetings from '@webex/plugin-meetings';
|
|
8
9
|
import LocusInfo, {createLocusFromHashTreeMessage, findMeetingForHashTreeMessage} from '@webex/plugin-meetings/src/locus-info';
|
|
@@ -57,7 +58,7 @@ describe('plugin-meetings', () => {
|
|
|
57
58
|
|
|
58
59
|
beforeEach(() => {
|
|
59
60
|
mockMeeting = {};
|
|
60
|
-
locusInfo = new LocusInfo(updateMeeting, webex, meetingId);
|
|
61
|
+
locusInfo = new LocusInfo({updateMeeting}, webex, meetingId);
|
|
61
62
|
|
|
62
63
|
locusInfo.init(locus);
|
|
63
64
|
|
|
@@ -149,7 +150,9 @@ describe('plugin-meetings', () => {
|
|
|
149
150
|
visibleDataSets,
|
|
150
151
|
},
|
|
151
152
|
webexRequest: sinon.match.func,
|
|
152
|
-
|
|
153
|
+
callbacks: sinon.match({
|
|
154
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
155
|
+
}),
|
|
153
156
|
debugId: sinon.match.string,
|
|
154
157
|
})
|
|
155
158
|
);
|
|
@@ -159,6 +162,39 @@ describe('plugin-meetings', () => {
|
|
|
159
162
|
assert.isTrue(locusInfo.emitChange);
|
|
160
163
|
});
|
|
161
164
|
|
|
165
|
+
it('passes a generateTrackingId callback that reuses the tracking-id interceptor sequence', async () => {
|
|
166
|
+
webex.sessionId = 'test-session';
|
|
167
|
+
const hashTreeMessage = createHashTreeMessage(['dataset1']);
|
|
168
|
+
|
|
169
|
+
await locusInfo.initialSetup({trigger: 'locus-message', hashTreeMessage});
|
|
170
|
+
|
|
171
|
+
const {generateTrackingId} = HashTreeParserStub.firstCall.args[0].callbacks;
|
|
172
|
+
|
|
173
|
+
// The interceptor for this webex is present in the exposed map -> reuse its sequence.
|
|
174
|
+
const fakeInterceptor = {webex, sequence: 7};
|
|
175
|
+
webexTrackingIdSequenceNumbers.set(fakeInterceptor, 0);
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
assert.equal(generateTrackingId(), 'test-session_7');
|
|
179
|
+
} finally {
|
|
180
|
+
webexTrackingIdSequenceNumbers.delete(fakeInterceptor);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('passes a generateTrackingId callback that falls back to a uuid when no interceptor is registered', async () => {
|
|
185
|
+
webex.sessionId = 'test-session';
|
|
186
|
+
const hashTreeMessage = createHashTreeMessage(['dataset1']);
|
|
187
|
+
|
|
188
|
+
await locusInfo.initialSetup({trigger: 'locus-message', hashTreeMessage});
|
|
189
|
+
|
|
190
|
+
const {generateTrackingId} = HashTreeParserStub.firstCall.args[0].callbacks;
|
|
191
|
+
|
|
192
|
+
assert.match(
|
|
193
|
+
generateTrackingId(),
|
|
194
|
+
/^test-session_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
162
198
|
it('should not initialize the hash tree when triggered from a non-hash tree locus message', async () => {
|
|
163
199
|
const locus = {url: 'http://locus-url.com', participants: []};
|
|
164
200
|
|
|
@@ -199,7 +235,9 @@ describe('plugin-meetings', () => {
|
|
|
199
235
|
},
|
|
200
236
|
metadata,
|
|
201
237
|
webexRequest: sinon.match.func,
|
|
202
|
-
|
|
238
|
+
callbacks: sinon.match({
|
|
239
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
240
|
+
}),
|
|
203
241
|
debugId: sinon.match.string,
|
|
204
242
|
})
|
|
205
243
|
);
|
|
@@ -280,7 +318,9 @@ describe('plugin-meetings', () => {
|
|
|
280
318
|
dataSets: [],
|
|
281
319
|
},
|
|
282
320
|
webexRequest: sinon.match.func,
|
|
283
|
-
|
|
321
|
+
callbacks: sinon.match({
|
|
322
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
323
|
+
}),
|
|
284
324
|
debugId: sinon.match.string,
|
|
285
325
|
metadata: null,
|
|
286
326
|
})
|
|
@@ -356,7 +396,7 @@ describe('plugin-meetings', () => {
|
|
|
356
396
|
},
|
|
357
397
|
});
|
|
358
398
|
|
|
359
|
-
locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].locusInfoUpdateCallback;
|
|
399
|
+
locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].callbacks.locusInfoUpdateCallback;
|
|
360
400
|
|
|
361
401
|
assert.isDefined(locusInfoUpdateCallback);
|
|
362
402
|
|