@webex/internal-plugin-metrics 3.12.0-mobius-socket.1 → 3.12.0-next.10

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.
@@ -154,7 +154,7 @@ export type BuildClientEventFetchRequestOptions = (args: {
154
154
  payload?: RecursivePartial<ClientEvent['payload']>;
155
155
  options?: SubmitClientEventOptions;
156
156
  }) => Promise<any>;
157
- export type PreComputedLatencies = 'internal.client.pageJMT' | 'internal.download.time' | 'internal.get.cluster.time' | 'internal.click.to.interstitial' | 'internal.click.to.interstitial.with.user.delay' | 'internal.refresh.captcha.time' | 'internal.exchange.ci.token.time' | 'internal.get.u2c.time' | 'internal.call.init.join.req' | 'internal.other.app.api.time' | 'internal.api.fetch.intelligence.models';
157
+ export type PreComputedLatencies = 'internal.client.pageJMT' | 'internal.download.time' | 'internal.get.cluster.time' | 'internal.click.to.interstitial' | 'internal.click.to.interstitial.with.user.delay' | 'internal.click.to.interstitial.for.client.jmt' | 'internal.refresh.captcha.time' | 'internal.exchange.ci.token.time' | 'internal.get.u2c.time' | 'internal.call.init.join.req' | 'internal.other.app.api.time' | 'internal.api.fetch.intelligence.models';
158
158
  export interface IdType {
159
159
  meetingId?: string;
160
160
  callId?: string;
package/package.json CHANGED
@@ -24,23 +24,23 @@
24
24
  "@sinonjs/fake-timers": "^6.0.1",
25
25
  "@webex/babel-config-legacy": "0.0.0",
26
26
  "@webex/eslint-config-legacy": "0.0.0",
27
- "@webex/event-dictionary-ts": "^1.0.2073",
27
+ "@webex/event-dictionary-ts": "^1.0.2138",
28
28
  "@webex/jest-config-legacy": "0.0.0",
29
29
  "@webex/legacy-tools": "0.0.0",
30
- "@webex/test-helper-chai": "3.12.0-mobius-socket.0",
31
- "@webex/test-helper-mocha": "3.12.0-mobius-socket.0",
32
- "@webex/test-helper-mock-webex": "3.12.0-mobius-socket.0",
33
- "@webex/test-helper-test-users": "3.12.0-mobius-socket.0",
30
+ "@webex/test-helper-chai": "3.11.0-next.1",
31
+ "@webex/test-helper-mocha": "3.11.0-next.1",
32
+ "@webex/test-helper-mock-webex": "3.11.0-next.1",
33
+ "@webex/test-helper-test-users": "3.11.0-next.1",
34
34
  "eslint": "^8.24.0",
35
35
  "prettier": "^2.7.1",
36
36
  "sinon": "^9.2.4"
37
37
  },
38
38
  "dependencies": {
39
- "@webex/common": "3.12.0-mobius-socket.0",
40
- "@webex/common-timers": "3.12.0-mobius-socket.0",
41
- "@webex/test-helper-chai": "3.12.0-mobius-socket.0",
42
- "@webex/test-helper-mock-webex": "3.12.0-mobius-socket.0",
43
- "@webex/webex-core": "3.12.0-mobius-socket.1",
39
+ "@webex/common": "3.11.0-next.1",
40
+ "@webex/common-timers": "3.11.0-next.1",
41
+ "@webex/test-helper-chai": "3.11.0-next.1",
42
+ "@webex/test-helper-mock-webex": "3.11.0-next.1",
43
+ "@webex/webex-core": "3.12.0-next.10",
44
44
  "ip-anonymize": "^0.1.0",
45
45
  "lodash": "^4.17.21",
46
46
  "uuid": "^3.3.2"
@@ -53,5 +53,5 @@
53
53
  "test:style": "eslint ./src/**/*.*",
54
54
  "test:unit": "webex-legacy-tools test --unit --runner mocha"
55
55
  },
56
- "version": "3.12.0-mobius-socket.1"
56
+ "version": "3.12.0-next.10"
57
57
  }
@@ -193,7 +193,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
193
193
  */
194
194
  public getShowInterstitialTime() {
195
195
  return this.getDiffBetweenTimestamps(
196
- 'client.interstitial-window.start-launch',
196
+ 'internal.client.meeting.interstitial-window.showed',
197
197
  'internal.client.interstitial-window.click.joinbutton'
198
198
  );
199
199
  }
@@ -303,7 +303,39 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
303
303
  * @returns - latency
304
304
  */
305
305
  public getStayLobbyTime() {
306
- return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.lobby.exited');
306
+ return this.getDiffBetweenTimestamps('client.lobby.entered', 'client.lobby.exited');
307
+ }
308
+
309
+ /**
310
+ * Stay lobby time capped by a certain timestamp.
311
+ * This is to handle the case where the target end timestamp could happen before the lobby is exited,
312
+ * for example media-engine.ready or client.ice.end
313
+ * This is supposed to be called AFTER the end timestamp happens
314
+ * @param endTimestampKey name of the target end event
315
+ * @returns - latency
316
+ */
317
+ public getStayLobbyTimeCappedBy(endTimestampKey: MetricEventNames) {
318
+ const lobbyStartTimestamp = this.latencyTimestamps.get('client.lobby.entered'); // might not exist (some meetings don't have lobby)
319
+
320
+ if (typeof lobbyStartTimestamp !== 'number') {
321
+ // no lobby in the meeting, stayLobbyTime is 0
322
+ return 0;
323
+ }
324
+
325
+ const lobbyEndTimestamp = this.latencyTimestamps.get('client.lobby.exited'); // might not exist (if user still in lobby at the time of measurement)
326
+ const maximumEndTimestamp = this.latencyTimestamps.get(endTimestampKey); // must exist
327
+
328
+ if (typeof maximumEndTimestamp !== 'number') {
329
+ // the provided timestamp to be used as a cap should exist, return undefined if it doesn't
330
+ return undefined;
331
+ }
332
+
333
+ const endTimestamp =
334
+ typeof lobbyEndTimestamp === 'number'
335
+ ? Math.min(lobbyEndTimestamp, maximumEndTimestamp)
336
+ : maximumEndTimestamp;
337
+
338
+ return clamp(endTimestamp - lobbyStartTimestamp, 0, this.MAX_INTEGER);
307
339
  }
308
340
 
309
341
  /**
@@ -390,11 +422,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
390
422
  * @returns - latency
391
423
  */
392
424
  public getCallInitMediaEngineReady() {
393
- return this.getDiffBetweenTimestamps(
394
- 'internal.client.interstitial-window.click.joinbutton',
395
- 'client.media-engine.ready',
396
- {maximum: 1200000}
397
- );
425
+ return this.getInterstitialToMediaOKJMT();
398
426
  }
399
427
 
400
428
  /**
@@ -402,20 +430,21 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
402
430
  * @returns - latency
403
431
  */
404
432
  public getInterstitialToMediaOKJMT() {
405
- const interstitialJoinClickTimestamp = this.latencyTimestamps.get(
406
- 'internal.client.interstitial-window.click.joinbutton'
433
+ const interstitialClickJoinToIceEnd = this.getDiffBetweenTimestamps(
434
+ 'internal.client.interstitial-window.click.joinbutton',
435
+ 'client.ice.end'
407
436
  );
437
+ const stayLobbyTimeCappedByIceEnd = this.getStayLobbyTimeCappedBy('client.ice.end');
408
438
 
409
- // get the first timestamp
410
- const connectedMedia = this.latencyTimestamps.get('client.ice.end');
411
-
412
- const lobbyTimeLatency = this.getStayLobbyTime();
413
- const lobbyTime = typeof lobbyTimeLatency === 'number' ? lobbyTimeLatency : 0;
414
-
415
- if (interstitialJoinClickTimestamp && connectedMedia) {
416
- const interstitialToMediaOKJmt = connectedMedia - interstitialJoinClickTimestamp - lobbyTime;
417
-
418
- return clamp(interstitialToMediaOKJmt, 0, this.MAX_INTEGER);
439
+ if (
440
+ typeof interstitialClickJoinToIceEnd === 'number' &&
441
+ typeof stayLobbyTimeCappedByIceEnd === 'number'
442
+ ) {
443
+ return clamp(
444
+ interstitialClickJoinToIceEnd - stayLobbyTimeCappedByIceEnd,
445
+ 0,
446
+ this.MAX_INTEGER
447
+ );
419
448
  }
420
449
 
421
450
  return undefined;
@@ -427,10 +456,20 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
427
456
  */
428
457
  public getTotalJMT() {
429
458
  const clickToInterstitial = this.getClickToInterstitial();
430
- const interstitialToJoinOk = this.getInterstitialToJoinOK();
459
+ const interstitialClickJoinToJoinLocusResponse = this.getDiffBetweenTimestamps(
460
+ 'internal.client.interstitial-window.click.joinbutton',
461
+ 'client.locus.join.response'
462
+ );
431
463
 
432
- if (typeof clickToInterstitial === 'number' && typeof interstitialToJoinOk === 'number') {
433
- return clamp(clickToInterstitial + interstitialToJoinOk, 0, this.MAX_INTEGER);
464
+ if (
465
+ typeof clickToInterstitial === 'number' &&
466
+ typeof interstitialClickJoinToJoinLocusResponse === 'number'
467
+ ) {
468
+ return clamp(
469
+ clickToInterstitial + interstitialClickJoinToJoinLocusResponse,
470
+ 0,
471
+ this.MAX_INTEGER
472
+ );
434
473
  }
435
474
 
436
475
  return undefined;
@@ -442,13 +481,20 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
442
481
  */
443
482
  public getTotalJMTWithUserDelay() {
444
483
  const clickToInterstitialWithUserDelay = this.getClickToInterstitialWithUserDelay();
445
- const interstitialToJoinOk = this.getInterstitialToJoinOK();
484
+ const interstitialShowedToJoinLocusResponse = this.getDiffBetweenTimestamps(
485
+ 'internal.client.meeting.interstitial-window.showed',
486
+ 'client.locus.join.response'
487
+ );
446
488
 
447
489
  if (
448
490
  typeof clickToInterstitialWithUserDelay === 'number' &&
449
- typeof interstitialToJoinOk === 'number'
491
+ typeof interstitialShowedToJoinLocusResponse === 'number'
450
492
  ) {
451
- return clamp(clickToInterstitialWithUserDelay + interstitialToJoinOk, 0, this.MAX_INTEGER);
493
+ return clamp(
494
+ clickToInterstitialWithUserDelay + interstitialShowedToJoinLocusResponse,
495
+ 0,
496
+ this.MAX_INTEGER
497
+ );
452
498
  }
453
499
 
454
500
  return undefined;
@@ -475,22 +521,26 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
475
521
  */
476
522
  public getTotalMediaJMT() {
477
523
  const clickToInterstitial = this.getClickToInterstitial();
478
- const interstitialToJoinOk = this.getInterstitialToJoinOK();
479
- const joinConfJMT = this.getJoinConfJMT();
480
- const lobbyTimeLatency = this.getStayLobbyTime();
481
- const lobbyTime = typeof lobbyTimeLatency === 'number' ? lobbyTimeLatency : 0;
482
-
483
- if (clickToInterstitial && interstitialToJoinOk && joinConfJMT) {
484
- const totalMediaJMT = clamp(
485
- clickToInterstitial + interstitialToJoinOk + joinConfJMT,
524
+ const interstitialClickJoinToMediaEngineReady = this.getDiffBetweenTimestamps(
525
+ 'internal.client.interstitial-window.click.joinbutton',
526
+ 'client.media-engine.ready'
527
+ );
528
+ const stayLobbyTimeCappedByMediaEngineReady = this.getStayLobbyTimeCappedBy(
529
+ 'client.media-engine.ready'
530
+ );
531
+
532
+ if (
533
+ typeof clickToInterstitial === 'number' &&
534
+ typeof interstitialClickJoinToMediaEngineReady === 'number' &&
535
+ typeof stayLobbyTimeCappedByMediaEngineReady === 'number'
536
+ ) {
537
+ return clamp(
538
+ clickToInterstitial +
539
+ interstitialClickJoinToMediaEngineReady -
540
+ stayLobbyTimeCappedByMediaEngineReady,
486
541
  0,
487
- Infinity
542
+ this.MAX_INTEGER
488
543
  );
489
- if (this.getMeeting()?.allowMediaInLobby) {
490
- return clamp(totalMediaJMT, 0, this.MAX_INTEGER);
491
- }
492
-
493
- return clamp(totalMediaJMT - lobbyTime, 0, this.MAX_INTEGER);
494
544
  }
495
545
 
496
546
  return undefined;
@@ -502,12 +552,17 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
502
552
  */
503
553
  public getTotalMediaJMTWithUserDelay() {
504
554
  const clickToInterstitialWithUserDelay = this.getClickToInterstitialWithUserDelay();
505
- const interstitialToJoinOk = this.getInterstitialToJoinOK();
506
- const joinConfJMT = this.getJoinConfJMT();
555
+ const interstitialShowedToMediaEngineReady = this.getDiffBetweenTimestamps(
556
+ 'internal.client.meeting.interstitial-window.showed',
557
+ 'client.media-engine.ready'
558
+ );
507
559
 
508
- if (clickToInterstitialWithUserDelay && interstitialToJoinOk && joinConfJMT) {
560
+ if (
561
+ typeof clickToInterstitialWithUserDelay === 'number' &&
562
+ typeof interstitialShowedToMediaEngineReady === 'number'
563
+ ) {
509
564
  return clamp(
510
- clickToInterstitialWithUserDelay + interstitialToJoinOk + joinConfJMT,
565
+ clickToInterstitialWithUserDelay + interstitialShowedToMediaEngineReady,
511
566
  0,
512
567
  this.MAX_INTEGER
513
568
  );
@@ -521,11 +576,23 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
521
576
  * @returns - latency
522
577
  */
523
578
  public getClientJMT() {
524
- const interstitialToJoinOk = this.getInterstitialToJoinOK();
525
- const joinConfJMT = this.getJoinConfJMT();
579
+ const clickToInterstitialForClientJmt = this.precomputedLatencies.get(
580
+ 'internal.click.to.interstitial.for.client.jmt'
581
+ );
582
+ const interstitialJoinToLocusJoinRequest = this.getDiffBetweenTimestamps(
583
+ 'internal.client.interstitial-window.click.joinbutton',
584
+ 'client.locus.join.request'
585
+ );
526
586
 
527
- if (typeof interstitialToJoinOk === 'number' && typeof joinConfJMT === 'number') {
528
- return clamp(interstitialToJoinOk - joinConfJMT, 0, this.MAX_INTEGER);
587
+ if (
588
+ typeof clickToInterstitialForClientJmt === 'number' &&
589
+ typeof interstitialJoinToLocusJoinRequest === 'number'
590
+ ) {
591
+ return clamp(
592
+ clickToInterstitialForClientJmt + interstitialJoinToLocusJoinRequest,
593
+ 0,
594
+ this.MAX_INTEGER
595
+ );
529
596
  }
530
597
 
531
598
  return undefined;
@@ -190,6 +190,11 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
190
190
 
191
191
  // if ConvergedArchitecture enable and isConvergedWebinarWebcast -- then webcast
192
192
  if (meetingInfo?.enableConvergedArchitecture && meetingInfo?.enableEvent) {
193
+ // if enableConvergedWebinarLargeScale - then large scale webinar
194
+ if (meetingInfo?.enableConvergedWebinarLargeScale) {
195
+ return WEBEX_SUB_SERVICE_TYPES.LARGE_SCALE_WEBINAR;
196
+ }
197
+
193
198
  return meetingInfo?.isConvergedWebinarWebcast
194
199
  ? WEBEX_SUB_SERVICE_TYPES.WEBCAST
195
200
  : WEBEX_SUB_SERVICE_TYPES.WEBINAR;
@@ -284,7 +284,8 @@ export const prepareDiagnosticMetricItem = (webex: any, item: any) => {
284
284
  devicePairingType: webex.devicemanager.getPairedMethod(),
285
285
  deviceURL: pairedDevice.url,
286
286
  isPersonalDevice: pairedDevice.mode === 'personal',
287
- productName: pairedDevice.devices[0]?.productName,
287
+ productName:
288
+ pairedDevice.devices?.length > 0 ? pairedDevice.devices[0]?.productName : undefined,
288
289
  };
289
290
  item.eventPayload.event.pairingState = 'paired';
290
291
  item.eventPayload.event.pairedDevice = devicePayload;
@@ -26,6 +26,7 @@ export const WEBEX_SUB_SERVICE_TYPES: Record<string, ClientSubServiceType> = {
26
26
  SCHEDULED_MEETING: 'ScheduledMeeting',
27
27
  WEBINAR: 'Webinar',
28
28
  WEBCAST: 'Webcast',
29
+ LARGE_SCALE_WEBINAR: 'LargeScaleWebinar',
29
30
  };
30
31
 
31
32
  // Found in https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
@@ -319,6 +319,7 @@ export type PreComputedLatencies =
319
319
  | 'internal.get.cluster.time'
320
320
  | 'internal.click.to.interstitial'
321
321
  | 'internal.click.to.interstitial.with.user.delay'
322
+ | 'internal.click.to.interstitial.for.client.jmt'
322
323
  | 'internal.refresh.captcha.time'
323
324
  | 'internal.exchange.ci.token.time'
324
325
  | 'internal.get.u2c.time'
@@ -346,6 +346,9 @@ describe('plugin-metrics', () => {
346
346
  webex.internal.newMetrics.callDiagnosticLatencies.getStayLobbyTime = sinon
347
347
  .stub()
348
348
  .returns(1);
349
+ webex.internal.newMetrics.callDiagnosticLatencies.getStayLobbyTimeCappedBy = sinon
350
+ .stub()
351
+ .returns(1);
349
352
  webex.internal.newMetrics.callDiagnosticLatencies.getTotalMediaJMTWithUserDelay = sinon
350
353
  .stub()
351
354
  .returns(43);
@@ -366,9 +369,9 @@ describe('plugin-metrics', () => {
366
369
  assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
367
370
  name: 'client.media-engine.ready',
368
371
  joinTimes: {
369
- totalMediaJMT: 61,
372
+ totalMediaJMT: 44,
370
373
  interstitialToMediaOKJMT: 22,
371
- callInitMediaEngineReady: 10,
374
+ callInitMediaEngineReady: 22,
372
375
  totalMediaJMTWithUserDelay: 43,
373
376
  totalJMTWithUserDelay: 64,
374
377
  },