@webex/plugin-meetings 3.12.0-next.102 → 3.12.0-next.104
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/meetings/index.js +25 -0
- package/dist/meetings/index.js.map +1 -1
- package/dist/metrics/constants.js +2 -1
- package/dist/metrics/constants.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/types/meetings/index.d.ts +8 -0
- package/dist/types/metrics/constants.d.ts +1 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +14 -14
- 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/src/meetings/index.ts +35 -1
- package/src/metrics/constants.ts +1 -0
- 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
- package/test/unit/spec/meetings/index.js +104 -0
|
@@ -7,8 +7,7 @@ import sinon from 'sinon';
|
|
|
7
7
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
8
8
|
import testUtils from '../../../utils/testUtils';
|
|
9
9
|
import BreakoutEditLockedError from '@webex/plugin-meetings/src/breakouts/edit-lock-error';
|
|
10
|
-
import breakoutEvent from '../../../../src/breakouts/events'
|
|
11
|
-
|
|
10
|
+
import breakoutEvent from '../../../../src/breakouts/events'
|
|
12
11
|
const getBOResponse = (status: string) => {
|
|
13
12
|
return {
|
|
14
13
|
url: 'url',
|
|
@@ -217,6 +216,21 @@ describe('plugin-meetings', () => {
|
|
|
217
216
|
});
|
|
218
217
|
assert.calledThrice(breakouts.queryPreAssignments);
|
|
219
218
|
});
|
|
219
|
+
|
|
220
|
+
it('wires LLM_CONNECT_RESPONSE to handleLLMBreakoutJoinResponseMetric', () => {
|
|
221
|
+
const handleStub = sinon.stub(Breakouts.prototype, 'handleLLMBreakoutJoinResponseMetric');
|
|
222
|
+
const bo = new Breakouts({}, {parent: webex});
|
|
223
|
+
|
|
224
|
+
const eventInfo = {
|
|
225
|
+
meeting: {id: 'meeting-id'},
|
|
226
|
+
llmLatency: {clientLLMWebSocketConnectTime: 1},
|
|
227
|
+
};
|
|
228
|
+
bo.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, eventInfo);
|
|
229
|
+
|
|
230
|
+
assert.calledOnceWithExactly(handleStub, eventInfo);
|
|
231
|
+
|
|
232
|
+
handleStub.restore();
|
|
233
|
+
});
|
|
220
234
|
});
|
|
221
235
|
|
|
222
236
|
describe('#listenToCurrentSessionTypeChange', () => {
|
|
@@ -374,6 +388,27 @@ describe('plugin-meetings', () => {
|
|
|
374
388
|
assert.calledOnce(breakouts.clearBreakouts);
|
|
375
389
|
});
|
|
376
390
|
|
|
391
|
+
it('preserves the last non-empty breakoutMoveId when a later update omits it', () => {
|
|
392
|
+
breakouts.updateBreakout({
|
|
393
|
+
sessionId: 'sessionId',
|
|
394
|
+
groupId: 'groupId',
|
|
395
|
+
sessionType: 'BREAKOUT',
|
|
396
|
+
status: 'active',
|
|
397
|
+
breakoutMoveId: 'move-id-1',
|
|
398
|
+
});
|
|
399
|
+
assert.equal(breakouts.breakoutMoveId, 'move-id-1');
|
|
400
|
+
|
|
401
|
+
// a later controls update arrives without a replaces entry -> null move id
|
|
402
|
+
breakouts.updateBreakout({
|
|
403
|
+
sessionId: 'sessionId',
|
|
404
|
+
groupId: 'groupId',
|
|
405
|
+
sessionType: 'BREAKOUT',
|
|
406
|
+
status: 'active',
|
|
407
|
+
breakoutMoveId: null,
|
|
408
|
+
});
|
|
409
|
+
assert.equal(breakouts.breakoutMoveId, 'move-id-1');
|
|
410
|
+
});
|
|
411
|
+
|
|
377
412
|
it('updates the current breakout session, call onBreakoutJoinResponse when session changed', () => {
|
|
378
413
|
breakouts.webex.meetings = {
|
|
379
414
|
getMeetingByType: sinon.stub().returns({
|
|
@@ -431,6 +466,111 @@ describe('plugin-meetings', () => {
|
|
|
431
466
|
});
|
|
432
467
|
});
|
|
433
468
|
|
|
469
|
+
describe('#submitLLMBreakoutJoinResponseMetric', () => {
|
|
470
|
+
let onBreakoutJoinResponseSpy;
|
|
471
|
+
|
|
472
|
+
const setupReadyToEmit = () => {
|
|
473
|
+
breakouts.webex.meetings = {
|
|
474
|
+
getMeetingByType: sinon.stub().returns({id: 'meeting-id'}),
|
|
475
|
+
};
|
|
476
|
+
breakouts.webex.internal.newMetrics = {submitClientEvent: sinon.stub()};
|
|
477
|
+
breakouts.webex.internal.llm.getWebSocketUrl = sinon.stub().returns('wss://llm');
|
|
478
|
+
breakouts.breakoutMoveId = 'moveId';
|
|
479
|
+
breakouts.currentBreakoutSession.set({sessionId: 'sessionId', groupId: 'groupId'});
|
|
480
|
+
breakouts.llmBreakoutJoinResponseInfo = {
|
|
481
|
+
breakoutMoveId: 'moveId',
|
|
482
|
+
meeting: {id: 'meeting-id'},
|
|
483
|
+
llmLatency: {clientLLMWebSocketConnectTime: 1},
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
beforeEach(() => {
|
|
488
|
+
onBreakoutJoinResponseSpy = sinon.stub(breakoutEvent, 'onBreakoutJoinResponse');
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
afterEach(() => {
|
|
492
|
+
onBreakoutJoinResponseSpy.restore();
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
it('emits the join response while an active breakout is in progress', () => {
|
|
496
|
+
setupReadyToEmit();
|
|
497
|
+
breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.BREAKOUT);
|
|
498
|
+
breakouts.set('status', BREAKOUTS.STATUS.OPEN);
|
|
499
|
+
|
|
500
|
+
breakouts.submitLLMBreakoutJoinResponseMetric();
|
|
501
|
+
|
|
502
|
+
assert.calledOnce(onBreakoutJoinResponseSpy);
|
|
503
|
+
const eventInfoArg = onBreakoutJoinResponseSpy.getCall(0).args[0];
|
|
504
|
+
assert.equal(eventInfoArg.breakoutMoveId, 'moveId');
|
|
505
|
+
assert.deepEqual(eventInfoArg.llmLatency, {clientLLMWebSocketConnectTime: 1});
|
|
506
|
+
assert.equal(eventInfoArg.llmWebsocketUrl, 'wss://llm');
|
|
507
|
+
assert.equal(eventInfoArg.meeting.id, 'meeting-id');
|
|
508
|
+
assert.equal(eventInfoArg.currentSession.sessionId, 'sessionId');
|
|
509
|
+
assert.equal(eventInfoArg.currentSession.groupId, 'groupId');
|
|
510
|
+
assert.isUndefined(eventInfoArg.error);
|
|
511
|
+
assert.isUndefined(breakouts.llmBreakoutJoinResponseInfo);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
it('emits the join response after returning to the main session', () => {
|
|
515
|
+
setupReadyToEmit();
|
|
516
|
+
breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
|
|
517
|
+
breakouts.currentBreakoutSession.set({sessionType: BREAKOUTS.SESSION_TYPES.MAIN});
|
|
518
|
+
|
|
519
|
+
breakouts.submitLLMBreakoutJoinResponseMetric();
|
|
520
|
+
|
|
521
|
+
assert.calledOnce(onBreakoutJoinResponseSpy);
|
|
522
|
+
const eventInfoArg = onBreakoutJoinResponseSpy.getCall(0).args[0];
|
|
523
|
+
assert.equal(eventInfoArg.breakoutMoveId, 'moveId');
|
|
524
|
+
assert.deepEqual(eventInfoArg.llmLatency, {clientLLMWebSocketConnectTime: 1});
|
|
525
|
+
assert.equal(eventInfoArg.llmWebsocketUrl, 'wss://llm');
|
|
526
|
+
assert.equal(eventInfoArg.meeting.id, 'meeting-id');
|
|
527
|
+
assert.equal(eventInfoArg.currentSession.sessionId, 'sessionId');
|
|
528
|
+
assert.equal(eventInfoArg.currentSession.groupId, 'groupId');
|
|
529
|
+
assert.isUndefined(eventInfoArg.error);
|
|
530
|
+
assert.isUndefined(breakouts.llmBreakoutJoinResponseInfo);
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
it('does not emit without a breakoutMoveId (non-breakout meeting)', () => {
|
|
534
|
+
setupReadyToEmit();
|
|
535
|
+
breakouts.breakoutMoveId = undefined;
|
|
536
|
+
breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
|
|
537
|
+
|
|
538
|
+
breakouts.submitLLMBreakoutJoinResponseMetric();
|
|
539
|
+
|
|
540
|
+
assert.notCalled(onBreakoutJoinResponseSpy);
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
it('does not emit when the LLM latency belongs to a different move id', () => {
|
|
544
|
+
setupReadyToEmit();
|
|
545
|
+
breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
|
|
546
|
+
breakouts.llmBreakoutJoinResponseInfo.breakoutMoveId = 'staleMoveId';
|
|
547
|
+
|
|
548
|
+
breakouts.submitLLMBreakoutJoinResponseMetric();
|
|
549
|
+
|
|
550
|
+
assert.notCalled(onBreakoutJoinResponseSpy);
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
describe('#handleLLMBreakoutJoinResponseMetric', () => {
|
|
555
|
+
it('stores the LLM connect response with the current breakoutMoveId and tries to emit', () => {
|
|
556
|
+
breakouts.breakoutMoveId = 'moveId';
|
|
557
|
+
breakouts.submitLLMBreakoutJoinResponseMetric = sinon.stub();
|
|
558
|
+
|
|
559
|
+
const eventInfo = {
|
|
560
|
+
meeting: {id: 'meeting-id'},
|
|
561
|
+
llmLatency: {clientLLMWebSocketConnectTime: 1},
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
breakouts.handleLLMBreakoutJoinResponseMetric(eventInfo);
|
|
565
|
+
|
|
566
|
+
assert.deepEqual(breakouts.llmBreakoutJoinResponseInfo, {
|
|
567
|
+
...eventInfo,
|
|
568
|
+
breakoutMoveId: 'moveId',
|
|
569
|
+
});
|
|
570
|
+
assert.calledOnce(breakouts.submitLLMBreakoutJoinResponseMetric);
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
|
|
434
574
|
describe('#updateBreakoutSessions', () => {
|
|
435
575
|
const checkBreakout = (breakout, sessionId, state) => {
|
|
436
576
|
assert.deepEqual(breakout.attributes, {
|
|
@@ -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
|
});
|