@webex/internal-plugin-metrics 3.4.0 → 3.5.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.
Files changed (69) hide show
  1. package/dist/behavioral-metrics.js +63 -0
  2. package/dist/behavioral-metrics.js.map +1 -0
  3. package/dist/business-metrics.js +169 -0
  4. package/dist/business-metrics.js.map +1 -0
  5. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +1 -1
  6. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  7. package/dist/call-diagnostic/call-diagnostic-metrics.js +27 -11
  8. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  9. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +14 -4
  10. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
  11. package/dist/call-diagnostic/config.js +13 -3
  12. package/dist/call-diagnostic/config.js.map +1 -1
  13. package/dist/{behavioral/behavioral-metrics.js → generic-metrics.js} +77 -92
  14. package/dist/generic-metrics.js.map +1 -0
  15. package/dist/index.js +22 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/metrics.js +1 -1
  18. package/dist/metrics.types.js.map +1 -1
  19. package/dist/new-metrics.js +124 -24
  20. package/dist/new-metrics.js.map +1 -1
  21. package/dist/operational-metrics.js +56 -0
  22. package/dist/operational-metrics.js.map +1 -0
  23. package/dist/rtcMetrics/constants.js +11 -0
  24. package/dist/rtcMetrics/constants.js.map +1 -0
  25. package/dist/rtcMetrics/index.js +202 -0
  26. package/dist/rtcMetrics/index.js.map +1 -0
  27. package/dist/types/behavioral-metrics.d.ts +25 -0
  28. package/dist/types/business-metrics.d.ts +47 -0
  29. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +27 -6
  30. package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +2 -1
  31. package/dist/types/call-diagnostic/config.d.ts +3 -0
  32. package/dist/types/generic-metrics.d.ts +63 -0
  33. package/dist/types/index.d.ts +5 -2
  34. package/dist/types/metrics.types.d.ts +27 -14
  35. package/dist/types/new-metrics.d.ts +42 -9
  36. package/dist/types/operational-metrics.d.ts +19 -0
  37. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  38. package/dist/types/rtcMetrics/index.d.ts +71 -0
  39. package/package.json +12 -12
  40. package/src/behavioral-metrics.ts +40 -0
  41. package/src/business-metrics.ts +118 -0
  42. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +1 -1
  43. package/src/call-diagnostic/call-diagnostic-metrics.ts +30 -9
  44. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +17 -4
  45. package/src/call-diagnostic/config.ts +12 -0
  46. package/src/generic-metrics.ts +146 -0
  47. package/src/index.ts +7 -1
  48. package/src/metrics.types.ts +32 -16
  49. package/src/new-metrics.ts +100 -13
  50. package/src/operational-metrics.ts +24 -0
  51. package/src/rtcMetrics/constants.ts +3 -0
  52. package/src/rtcMetrics/index.ts +186 -0
  53. package/test/unit/spec/behavioral/behavioral-metrics.ts +51 -10
  54. package/test/unit/spec/business/business-metrics.ts +182 -0
  55. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +2 -1
  56. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +4 -6
  57. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +418 -12
  58. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +22 -8
  59. package/test/unit/spec/new-metrics.ts +32 -3
  60. package/test/unit/spec/operational/operational-metrics.ts +115 -0
  61. package/test/unit/spec/prelogin-metrics-batcher.ts +3 -1
  62. package/test/unit/spec/rtcMetrics/index.ts +155 -0
  63. package/dist/behavioral/behavioral-metrics.js.map +0 -1
  64. package/dist/behavioral/config.js +0 -11
  65. package/dist/behavioral/config.js.map +0 -1
  66. package/dist/types/behavioral/behavioral-metrics.d.ts +0 -63
  67. package/dist/types/behavioral/config.d.ts +0 -1
  68. package/src/behavioral/behavioral-metrics.ts +0 -179
  69. package/src/behavioral/config.ts +0 -3
@@ -12,12 +12,10 @@ describe('internal-plugin-metrics', () => {
12
12
  sinon.useFakeTimers(now.getTime());
13
13
  const webex = {
14
14
  meetings: {
15
- meetingCollection: {
16
- get: (id: string) => {
17
- if (id === 'meeting-id') {
18
- return {id: 'meeting-id', allowMediaInLobby: true};
19
- }
20
- },
15
+ getBasicMeetingInformation: (id: string) => {
16
+ if (id === 'meeting-id') {
17
+ return {id: 'meeting-id', allowMediaInLobby: true};
18
+ }
21
19
  },
22
20
  },
23
21
  };
@@ -1,7 +1,9 @@
1
1
  import sinon from 'sinon';
2
+ import bowser from 'bowser';
2
3
  import {assert} from '@webex/test-helper-chai';
3
4
  import {WebexHttpError} from '@webex/webex-core';
4
5
  import {BrowserDetection} from '@webex/common';
6
+ import window from 'global/window';
5
7
  import {
6
8
  CallDiagnosticLatencies,
7
9
  CallDiagnosticMetrics,
@@ -40,9 +42,6 @@ describe('internal-plugin-metrics', () => {
40
42
  },
41
43
  meetingInfo: {},
42
44
  getCurUserType: () => 'host',
43
- statsAnalyzer: {
44
- getLocalIpAddress: () => '192.168.1.90',
45
- },
46
45
  };
47
46
 
48
47
  const fakeMeeting2 = {
@@ -52,9 +51,17 @@ describe('internal-plugin-metrics', () => {
52
51
  callStateForMetrics: {loginType: 'fakeLoginType'},
53
52
  };
54
53
 
54
+ const fakeMeeting3 = {
55
+ ...fakeMeeting,
56
+ id: '3',
57
+ correlationId: 'correlationId3',
58
+ sessionCorrelationId: 'sessionCorrelationId3',
59
+ }
60
+
55
61
  const fakeMeetings = {
56
62
  1: fakeMeeting,
57
63
  2: fakeMeeting2,
64
+ 3: fakeMeeting3,
58
65
  };
59
66
 
60
67
  let webex;
@@ -86,8 +93,19 @@ describe('internal-plugin-metrics', () => {
86
93
  clientName: 'Cantina',
87
94
  },
88
95
  },
96
+ getBasicMeetingInformation: (id) => fakeMeetings[id],
89
97
  meetingCollection: {
90
- get: (id) => fakeMeetings[id],
98
+ get: (meetingId) => {
99
+ return {
100
+ statsAnalyzer: {
101
+ getLocalIpAddress: () => {
102
+ if (meetingId) {
103
+ return '192.168.1.90';
104
+ }
105
+ },
106
+ }
107
+ }
108
+ },
91
109
  },
92
110
  geoHintInfo: {
93
111
  clientAddress: '1.3.4.5',
@@ -366,12 +384,101 @@ describe('internal-plugin-metrics', () => {
366
384
  });
367
385
  });
368
386
 
387
+ [undefined, null, '', false, 0].forEach((sessionCorrelationId) => {
388
+ it(`should build identifiers correctly and not add session correlation id if it is falsy: ${sessionCorrelationId}`, () => {
389
+ cd.device = {
390
+ ...cd.device,
391
+ config: {installationId: 'installationId'},
392
+ };
393
+
394
+ const res = cd.getIdentifiers({
395
+ mediaConnections: [
396
+ {mediaAgentAlias: 'mediaAgentAlias', mediaAgentGroupId: 'mediaAgentGroupId'},
397
+ ],
398
+ meeting: {...fakeMeeting, sessionCorrelationId},
399
+ sessionCorrelationId: sessionCorrelationId as any,
400
+ });
401
+
402
+ assert.deepEqual(res, {
403
+ correlationId: 'correlationId',
404
+ deviceId: 'deviceUrl',
405
+ locusId: 'url',
406
+ locusStartTime: 'lastActive',
407
+ locusUrl: 'locus/url',
408
+ machineId: 'installationId',
409
+ mediaAgentAlias: 'mediaAgentAlias',
410
+ mediaAgentGroupId: 'mediaAgentGroupId',
411
+ orgId: 'orgId',
412
+ userId: 'userId',
413
+ });
414
+ });
415
+ });
416
+
417
+ it('should build identifiers correctly with sessionCorrelationID as a param', () => {
418
+ cd.device = {
419
+ ...cd.device,
420
+ config: {installationId: 'installationId'},
421
+ };
422
+
423
+ const res = cd.getIdentifiers({
424
+ mediaConnections: [
425
+ {mediaAgentAlias: 'mediaAgentAlias', mediaAgentGroupId: 'mediaAgentGroupId'},
426
+ ],
427
+ meeting: fakeMeeting,
428
+ sessionCorrelationId: 'sessionCorrelationId',
429
+ });
430
+
431
+ assert.deepEqual(res, {
432
+ correlationId: 'correlationId',
433
+ sessionCorrelationId: 'sessionCorrelationId',
434
+ deviceId: 'deviceUrl',
435
+ locusId: 'url',
436
+ locusStartTime: 'lastActive',
437
+ locusUrl: 'locus/url',
438
+ machineId: 'installationId',
439
+ mediaAgentAlias: 'mediaAgentAlias',
440
+ mediaAgentGroupId: 'mediaAgentGroupId',
441
+ orgId: 'orgId',
442
+ userId: 'userId',
443
+ });
444
+ });
445
+
446
+ it('should build identifiers correctly with sessionCorrelationID as a param and a meeting with session correlation id, and the param should take precedence', () => {
447
+ cd.device = {
448
+ ...cd.device,
449
+ config: {installationId: 'installationId'},
450
+ };
451
+
452
+ const res = cd.getIdentifiers({
453
+ mediaConnections: [
454
+ {mediaAgentAlias: 'mediaAgentAlias', mediaAgentGroupId: 'mediaAgentGroupId'},
455
+ ],
456
+ meeting: {...fakeMeeting, sessionCorrelationId: 'sessionCorrelationId1'},
457
+ sessionCorrelationId: 'sessionCorrelationId',
458
+ });
459
+
460
+ assert.deepEqual(res, {
461
+ correlationId: 'correlationId',
462
+ sessionCorrelationId: 'sessionCorrelationId',
463
+ deviceId: 'deviceUrl',
464
+ locusId: 'url',
465
+ locusStartTime: 'lastActive',
466
+ locusUrl: 'locus/url',
467
+ machineId: 'installationId',
468
+ mediaAgentAlias: 'mediaAgentAlias',
469
+ mediaAgentGroupId: 'mediaAgentGroupId',
470
+ orgId: 'orgId',
471
+ userId: 'userId',
472
+ });
473
+ });
474
+
369
475
  it('should build identifiers correctly with a meeting that has meetingInfo with a webexConferenceIdStr and globalMeetingId, and that should take precedence over the options passed to it', () => {
370
476
  const res = cd.getIdentifiers({
371
477
  mediaConnections: [
372
478
  {mediaAgentAlias: 'mediaAgentAlias', mediaAgentGroupId: 'mediaAgentGroupId'},
373
479
  ],
374
480
  webexConferenceIdStr: 'webexConferenceIdStr',
481
+ sessionCorrelationId: 'sessionCorrelationId',
375
482
  globalMeetingId: 'globalMeetingId',
376
483
  meeting: {
377
484
  ...fakeMeeting,
@@ -386,6 +493,7 @@ describe('internal-plugin-metrics', () => {
386
493
  assert.deepEqual(res, {
387
494
  correlationId: 'correlationId',
388
495
  webexConferenceIdStr: 'webexConferenceIdStr1',
496
+ sessionCorrelationId: 'sessionCorrelationId',
389
497
  globalMeetingId: 'globalMeetingId1',
390
498
  deviceId: 'deviceUrl',
391
499
  locusId: 'url',
@@ -464,6 +572,42 @@ describe('internal-plugin-metrics', () => {
464
572
  });
465
573
  });
466
574
 
575
+ it('should build identifiers correctly with a meeting that has sessionCorrelationId', () => {
576
+ const res = cd.getIdentifiers({
577
+ mediaConnections: [
578
+ {mediaAgentAlias: 'mediaAgentAlias', mediaAgentGroupId: 'mediaAgentGroupId'},
579
+ ],
580
+ webexConferenceIdStr: 'webexConferenceIdStr',
581
+ globalMeetingId: 'globalMeetingId',
582
+ meeting: {
583
+ ...fakeMeeting,
584
+ sessionCorrelationId: 'sessionCorrelationId1',
585
+ meetingInfo: {
586
+ ...fakeMeeting.meetingInfo,
587
+ confIdStr: 'webexConferenceIdStr1',
588
+ meetingId: 'globalMeetingId1',
589
+ siteName: 'siteName1',
590
+ },
591
+ },
592
+ });
593
+
594
+ assert.deepEqual(res, {
595
+ correlationId: 'correlationId',
596
+ sessionCorrelationId: 'sessionCorrelationId1',
597
+ webexConferenceIdStr: 'webexConferenceIdStr1',
598
+ globalMeetingId: 'globalMeetingId1',
599
+ deviceId: 'deviceUrl',
600
+ locusId: 'url',
601
+ locusStartTime: 'lastActive',
602
+ locusUrl: 'locus/url',
603
+ mediaAgentAlias: 'mediaAgentAlias',
604
+ mediaAgentGroupId: 'mediaAgentGroupId',
605
+ orgId: 'orgId',
606
+ userId: 'userId',
607
+ webexSiteName: 'siteName1',
608
+ });
609
+ });
610
+
467
611
  it('should build identifiers correctly given webexConferenceIdStr', () => {
468
612
  const res = cd.getIdentifiers({
469
613
  correlationId: 'correlationId',
@@ -510,6 +654,22 @@ describe('internal-plugin-metrics', () => {
510
654
  });
511
655
  });
512
656
 
657
+ it('should build identifiers correctly given sessionCorrelationId', () => {
658
+ const res = cd.getIdentifiers({
659
+ correlationId: 'correlationId',
660
+ sessionCorrelationId: 'sessionCorrelationId',
661
+ });
662
+
663
+ assert.deepEqual(res, {
664
+ correlationId: 'correlationId',
665
+ sessionCorrelationId: 'sessionCorrelationId',
666
+ deviceId: 'deviceUrl',
667
+ locusUrl: 'locus-url',
668
+ orgId: 'orgId',
669
+ userId: 'userId',
670
+ });
671
+ });
672
+
513
673
  it('should throw Error if correlationId is missing', () => {
514
674
  assert.throws(() =>
515
675
  cd.getIdentifiers({
@@ -604,11 +764,13 @@ describe('internal-plugin-metrics', () => {
604
764
  options,
605
765
  });
606
766
 
767
+ assert.called(getIdentifiersSpy);
607
768
  assert.calledWith(getIdentifiersSpy, {
608
769
  meeting: fakeMeeting,
609
770
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
610
771
  webexConferenceIdStr: undefined,
611
772
  globalMeetingId: undefined,
773
+ sessionCorrelationId: undefined,
612
774
  });
613
775
  assert.notCalled(generateClientEventErrorPayloadSpy);
614
776
  assert.calledWith(
@@ -717,6 +879,142 @@ describe('internal-plugin-metrics', () => {
717
879
  ]);
718
880
  });
719
881
 
882
+ it('should submit client event successfully with meetingId which has a sessionCorrelationId', () => {
883
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
884
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
885
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
886
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
887
+ const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
888
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
889
+ const validatorSpy = sinon.spy(cd, 'validator');
890
+ const options = {
891
+ meetingId: fakeMeeting3.id,
892
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
893
+ };
894
+
895
+ cd.submitClientEvent({
896
+ name: 'client.alert.displayed',
897
+ options,
898
+ });
899
+
900
+ assert.called(getIdentifiersSpy);
901
+ assert.calledWith(getIdentifiersSpy, {
902
+ meeting: {...fakeMeeting3, sessionCorrelationId: 'sessionCorrelationId3'},
903
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
904
+ webexConferenceIdStr: undefined,
905
+ globalMeetingId: undefined,
906
+ sessionCorrelationId: undefined,
907
+ });
908
+ assert.notCalled(generateClientEventErrorPayloadSpy);
909
+ assert.calledWith(
910
+ prepareDiagnosticEventSpy,
911
+ {
912
+ canProceed: true,
913
+ eventData: {
914
+ webClientDomain: 'whatever',
915
+ },
916
+ identifiers: {
917
+ correlationId: 'correlationId3',
918
+ sessionCorrelationId: 'sessionCorrelationId3',
919
+ deviceId: 'deviceUrl',
920
+ locusId: 'url',
921
+ locusStartTime: 'lastActive',
922
+ locusUrl: 'locus/url',
923
+ mediaAgentAlias: 'alias',
924
+ mediaAgentGroupId: '1',
925
+ orgId: 'orgId',
926
+ userId: 'userId',
927
+ },
928
+ loginType: 'login-ci',
929
+ name: 'client.alert.displayed',
930
+ userType: 'host',
931
+ isConvergedArchitectureEnabled: undefined,
932
+ webexSubServiceType: undefined,
933
+ },
934
+ options
935
+ );
936
+ assert.calledWith(submitToCallDiagnosticsSpy, {
937
+ event: {
938
+ canProceed: true,
939
+ eventData: {
940
+ webClientDomain: 'whatever',
941
+ },
942
+ identifiers: {
943
+ correlationId: 'correlationId3',
944
+ sessionCorrelationId: 'sessionCorrelationId3',
945
+ deviceId: 'deviceUrl',
946
+ locusId: 'url',
947
+ locusStartTime: 'lastActive',
948
+ locusUrl: 'locus/url',
949
+ mediaAgentAlias: 'alias',
950
+ mediaAgentGroupId: '1',
951
+ orgId: 'orgId',
952
+ userId: 'userId',
953
+ },
954
+ loginType: 'login-ci',
955
+ name: 'client.alert.displayed',
956
+ userType: 'host',
957
+ isConvergedArchitectureEnabled: undefined,
958
+ webexSubServiceType: undefined,
959
+ },
960
+ eventId: 'my-fake-id',
961
+ origin: {
962
+ origin: 'fake-origin',
963
+ },
964
+ originTime: {
965
+ sent: 'not_defined_yet',
966
+ triggered: now.toISOString(),
967
+ },
968
+ senderCountryCode: 'UK',
969
+ version: 1,
970
+ });
971
+ assert.calledWith(validatorSpy, {
972
+ type: 'ce',
973
+ event: {
974
+ event: {
975
+ canProceed: true,
976
+ eventData: {
977
+ webClientDomain: 'whatever',
978
+ },
979
+ identifiers: {
980
+ correlationId: 'correlationId3',
981
+ sessionCorrelationId: 'sessionCorrelationId3',
982
+ deviceId: 'deviceUrl',
983
+ locusId: 'url',
984
+ locusStartTime: 'lastActive',
985
+ locusUrl: 'locus/url',
986
+ mediaAgentAlias: 'alias',
987
+ mediaAgentGroupId: '1',
988
+ orgId: 'orgId',
989
+ userId: 'userId',
990
+ },
991
+ loginType: 'login-ci',
992
+ name: 'client.alert.displayed',
993
+ userType: 'host',
994
+ isConvergedArchitectureEnabled: undefined,
995
+ webexSubServiceType: undefined,
996
+ },
997
+ eventId: 'my-fake-id',
998
+ origin: {
999
+ origin: 'fake-origin',
1000
+ },
1001
+ originTime: {
1002
+ sent: 'not_defined_yet',
1003
+ triggered: now.toISOString(),
1004
+ },
1005
+ senderCountryCode: 'UK',
1006
+ version: 1,
1007
+ },
1008
+ });
1009
+
1010
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
1011
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
1012
+ 'call-diagnostic-events -> ',
1013
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1014
+ `name: client.alert.displayed`,
1015
+ ]);
1016
+ });
1017
+
720
1018
  it('should log browser data, but only for the first call diagnostic event', () => {
721
1019
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
722
1020
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
@@ -724,6 +1022,9 @@ describe('internal-plugin-metrics', () => {
724
1022
  const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
725
1023
  const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
726
1024
  const validatorSpy = sinon.spy(cd, 'validator');
1025
+ sinon.stub(window.navigator, 'userAgent').get(() => userAgent);
1026
+ sinon.stub(bowser, 'getParser').returns(userAgent);
1027
+
727
1028
  const options = {
728
1029
  meetingId: fakeMeeting.id,
729
1030
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
@@ -752,7 +1053,7 @@ describe('internal-plugin-metrics', () => {
752
1053
  assert.deepEqual(webexLoggerLogCalls[2].args, [
753
1054
  'call-diagnostic-events -> ',
754
1055
  'CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data',
755
- '{"error":"unable to access window.navigator.userAgent"}',
1056
+ `${JSON.stringify(userAgent)}`,
756
1057
  ]);
757
1058
 
758
1059
  assert.deepEqual(webexLoggerLogCalls[3].args, [
@@ -762,7 +1063,7 @@ describe('internal-plugin-metrics', () => {
762
1063
  ]);
763
1064
  });
764
1065
 
765
- it('should submit client event successfully with correlationId, webexConferenceIdStr and globalMeetingId', () => {
1066
+ it('should submit client event successfully with correlationId, webexConferenceIdStr, sessionCorrelationId, and globalMeetingId', () => {
766
1067
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
767
1068
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
768
1069
  const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
@@ -773,6 +1074,7 @@ describe('internal-plugin-metrics', () => {
773
1074
  correlationId: 'correlationId',
774
1075
  webexConferenceIdStr: 'webexConferenceIdStr1',
775
1076
  globalMeetingId: 'globalMeetingId1',
1077
+ sessionCorrelationId: 'sessionCorrelationId1'
776
1078
  };
777
1079
 
778
1080
  cd.submitClientEvent({
@@ -784,6 +1086,7 @@ describe('internal-plugin-metrics', () => {
784
1086
  correlationId: 'correlationId',
785
1087
  webexConferenceIdStr: 'webexConferenceIdStr1',
786
1088
  globalMeetingId: 'globalMeetingId1',
1089
+ sessionCorrelationId: 'sessionCorrelationId1',
787
1090
  preLoginId: undefined,
788
1091
  });
789
1092
 
@@ -798,6 +1101,7 @@ describe('internal-plugin-metrics', () => {
798
1101
  identifiers: {
799
1102
  correlationId: 'correlationId',
800
1103
  webexConferenceIdStr: 'webexConferenceIdStr1',
1104
+ sessionCorrelationId: 'sessionCorrelationId1',
801
1105
  globalMeetingId: 'globalMeetingId1',
802
1106
  deviceId: 'deviceUrl',
803
1107
  locusUrl: 'locus-url',
@@ -818,6 +1122,7 @@ describe('internal-plugin-metrics', () => {
818
1122
  identifiers: {
819
1123
  correlationId: 'correlationId',
820
1124
  webexConferenceIdStr: 'webexConferenceIdStr1',
1125
+ sessionCorrelationId: 'sessionCorrelationId1',
821
1126
  globalMeetingId: 'globalMeetingId1',
822
1127
  deviceId: 'deviceUrl',
823
1128
  locusUrl: 'locus-url',
@@ -863,6 +1168,7 @@ describe('internal-plugin-metrics', () => {
863
1168
  webexConferenceIdStr: 'webexConferenceIdStr1',
864
1169
  globalMeetingId: 'globalMeetingId1',
865
1170
  preLoginId: 'myPreLoginId',
1171
+ sessionCorrelationId: 'sessionCorrelationId1'
866
1172
  };
867
1173
 
868
1174
  cd.submitClientEvent({
@@ -875,6 +1181,7 @@ describe('internal-plugin-metrics', () => {
875
1181
  webexConferenceIdStr: 'webexConferenceIdStr1',
876
1182
  globalMeetingId: 'globalMeetingId1',
877
1183
  preLoginId: 'myPreLoginId',
1184
+ sessionCorrelationId: 'sessionCorrelationId1'
878
1185
  });
879
1186
 
880
1187
  assert.notCalled(generateClientEventErrorPayloadSpy);
@@ -887,6 +1194,7 @@ describe('internal-plugin-metrics', () => {
887
1194
  },
888
1195
  identifiers: {
889
1196
  correlationId: 'correlationId',
1197
+ sessionCorrelationId: 'sessionCorrelationId1',
890
1198
  webexConferenceIdStr: 'webexConferenceIdStr1',
891
1199
  globalMeetingId: 'globalMeetingId1',
892
1200
  deviceId: 'deviceUrl',
@@ -913,6 +1221,7 @@ describe('internal-plugin-metrics', () => {
913
1221
  canProceed: true,
914
1222
  identifiers: {
915
1223
  correlationId: 'correlationId',
1224
+ sessionCorrelationId: 'sessionCorrelationId1',
916
1225
  userId: 'myPreLoginId',
917
1226
  deviceId: 'deviceUrl',
918
1227
  orgId: 'orgId',
@@ -977,6 +1286,57 @@ describe('internal-plugin-metrics', () => {
977
1286
  });
978
1287
  });
979
1288
 
1289
+ it('should use meeting loginType if present and meetingId provided, with sessionCorrelationId', () => {
1290
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1291
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1292
+ const options = {
1293
+ meetingId: fakeMeeting2.id,
1294
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1295
+ sessionCorrelationId: 'sessionCorrelationId1'
1296
+ };
1297
+
1298
+ cd.submitClientEvent({
1299
+ name: 'client.alert.displayed',
1300
+ options,
1301
+ });
1302
+
1303
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1304
+ event: {
1305
+ canProceed: true,
1306
+ eventData: {
1307
+ webClientDomain: 'whatever',
1308
+ },
1309
+ identifiers: {
1310
+ correlationId: 'correlationId2',
1311
+ sessionCorrelationId: 'sessionCorrelationId1',
1312
+ deviceId: 'deviceUrl',
1313
+ locusId: 'url',
1314
+ locusStartTime: 'lastActive',
1315
+ locusUrl: 'locus/url',
1316
+ mediaAgentAlias: 'alias',
1317
+ mediaAgentGroupId: '1',
1318
+ orgId: 'orgId',
1319
+ userId: 'userId',
1320
+ },
1321
+ loginType: 'fakeLoginType',
1322
+ name: 'client.alert.displayed',
1323
+ userType: 'host',
1324
+ isConvergedArchitectureEnabled: undefined,
1325
+ webexSubServiceType: undefined,
1326
+ },
1327
+ eventId: 'my-fake-id',
1328
+ origin: {
1329
+ origin: 'fake-origin',
1330
+ },
1331
+ originTime: {
1332
+ sent: 'not_defined_yet',
1333
+ triggered: now.toISOString(),
1334
+ },
1335
+ senderCountryCode: 'UK',
1336
+ version: 1,
1337
+ });
1338
+ });
1339
+
980
1340
  it('it should include errors if provided with meetingId', () => {
981
1341
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
982
1342
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
@@ -1100,6 +1460,9 @@ describe('internal-plugin-metrics', () => {
1100
1460
  name: 'other',
1101
1461
  category: 'other',
1102
1462
  errorCode: 9999,
1463
+ errorData: {
1464
+ errorName: 'Error'
1465
+ },
1103
1466
  serviceErrorCode: 9999,
1104
1467
  errorDescription: 'UnknownError',
1105
1468
  rawErrorMessage: 'bad times',
@@ -1133,7 +1496,7 @@ describe('internal-plugin-metrics', () => {
1133
1496
  assert.deepEqual(webexLoggerLogCalls[2].args, [
1134
1497
  'call-diagnostic-events -> ',
1135
1498
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
1136
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
1499
+ `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
1137
1500
  ]);
1138
1501
  });
1139
1502
 
@@ -1171,6 +1534,9 @@ describe('internal-plugin-metrics', () => {
1171
1534
  name: 'other',
1172
1535
  category: 'other',
1173
1536
  errorCode: 9999,
1537
+ errorData: {
1538
+ errorName: 'Error'
1539
+ },
1174
1540
  serviceErrorCode: 9999,
1175
1541
  errorDescription: 'UnknownError',
1176
1542
  rawErrorMessage: 'bad times',
@@ -1202,7 +1568,7 @@ describe('internal-plugin-metrics', () => {
1202
1568
  assert.deepEqual(webexLoggerLogCalls[2].args, [
1203
1569
  'call-diagnostic-events -> ',
1204
1570
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
1205
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
1571
+ `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
1206
1572
  ]);
1207
1573
  });
1208
1574
 
@@ -1356,7 +1722,8 @@ describe('internal-plugin-metrics', () => {
1356
1722
  });
1357
1723
 
1358
1724
  it('should send behavioral event if meetingId provided but meeting is undefined', () => {
1359
- webex.meetings.meetingCollection.get = sinon.stub().returns(undefined);
1725
+ webex.meetings.getBasicMeetingInformation = sinon.stub().returns(undefined);
1726
+
1360
1727
  cd.submitClientEvent({name: 'client.alert.displayed', options: {meetingId: 'meetingId'}});
1361
1728
  assert.calledWith(
1362
1729
  webex.internal.metrics.submitClientMetrics,
@@ -1417,6 +1784,7 @@ describe('internal-plugin-metrics', () => {
1417
1784
  meetingId: fakeMeeting.id,
1418
1785
  webexConferenceIdStr: 'webexConferenceIdStr1',
1419
1786
  globalMeetingId: 'globalMeetingId1',
1787
+ sessionCorrelationId: 'sessionCorrelationId1'
1420
1788
  };
1421
1789
 
1422
1790
  cd.submitMQE({
@@ -1559,7 +1927,7 @@ describe('internal-plugin-metrics', () => {
1559
1927
  });
1560
1928
 
1561
1929
  it('should send behavioral event if meeting is undefined', () => {
1562
- webex.meetings.meetingCollection.get = sinon.stub().returns(undefined);
1930
+ webex.meetings.getBasicMeetingInformation = sinon.stub().returns(undefined);
1563
1931
  cd.submitMQE({
1564
1932
  name: 'client.mediaquality.event',
1565
1933
  payload: {
@@ -1881,6 +2249,9 @@ describe('internal-plugin-metrics', () => {
1881
2249
  shownToUser: true,
1882
2250
  serviceErrorCode: 9999,
1883
2251
  errorCode: 9999,
2252
+ errorData: {
2253
+ errorName: 'Error'
2254
+ },
1884
2255
  rawErrorMessage: 'bad times',
1885
2256
  });
1886
2257
  });
@@ -2024,6 +2395,40 @@ describe('internal-plugin-metrics', () => {
2024
2395
  });
2025
2396
  });
2026
2397
 
2398
+ it('should generate event error payload correctly for wdm error 4404002', () => {
2399
+ const res = cd.generateClientEventErrorPayload({
2400
+ body: {errorCode: 4404002},
2401
+ message: 'Operation denied due to region restriction',
2402
+ });
2403
+ assert.deepEqual(res, {
2404
+ category: 'expected',
2405
+ errorDescription: 'WdmRestrictedRegion',
2406
+ fatal: true,
2407
+ name: 'other',
2408
+ shownToUser: false,
2409
+ serviceErrorCode: 4404002,
2410
+ errorCode: 13000,
2411
+ rawErrorMessage: 'Operation denied due to region restriction',
2412
+ });
2413
+ });
2414
+
2415
+ it('should generate event error payload correctly for wdm error 4404003', () => {
2416
+ const res = cd.generateClientEventErrorPayload({
2417
+ body: {errorCode: 4404003},
2418
+ message: 'Operation denied due to region restriction',
2419
+ });
2420
+ assert.deepEqual(res, {
2421
+ category: 'expected',
2422
+ errorDescription: 'WdmRestrictedRegion',
2423
+ fatal: true,
2424
+ name: 'other',
2425
+ shownToUser: false,
2426
+ serviceErrorCode: 4404003,
2427
+ errorCode: 13000,
2428
+ rawErrorMessage: 'Operation denied due to region restriction',
2429
+ });
2430
+ });
2431
+
2027
2432
  describe('httpStatusCode', () => {
2028
2433
  it('should include httpStatusCode for browser media errors', () => {
2029
2434
  const res = cd.generateClientEventErrorPayload({
@@ -2302,6 +2707,7 @@ describe('internal-plugin-metrics', () => {
2302
2707
  environment: 'meeting_evn',
2303
2708
  name: 'endpoint',
2304
2709
  networkType: 'unknown',
2710
+ upgradeChannel: 'test',
2305
2711
  userAgent,
2306
2712
  },
2307
2713
  originTime: {
@@ -2385,11 +2791,11 @@ describe('internal-plugin-metrics', () => {
2385
2791
  // The method is called in beforeEach itself. We are just testing it here
2386
2792
  it('sets the received deviceInfo to call-diagnostics', () => {
2387
2793
  const webexLoggerLogCalls = webex.logger.log.getCalls();
2388
- const device = { userId: 'userId', url: 'deviceUrl', orgId: 'orgId' };
2794
+ const device = {userId: 'userId', url: 'deviceUrl', orgId: 'orgId'};
2389
2795
 
2390
2796
  assert.deepEqual(webexLoggerLogCalls[0].args, [
2391
2797
  'CallDiagnosticMetrics: @setDeviceInfo called',
2392
- device
2798
+ device,
2393
2799
  ]);
2394
2800
 
2395
2801
  assert.deepEqual(cd.device, device);