@webex/internal-plugin-metrics 3.5.0-next.2 → 3.5.0-next.21
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/business-metrics.js +119 -9
- package/dist/business-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +18 -9
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/config.js +13 -3
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/metrics.types.js.map +1 -1
- package/dist/new-metrics.js +5 -2
- package/dist/new-metrics.js.map +1 -1
- package/dist/rtcMetrics/constants.js +11 -0
- package/dist/rtcMetrics/constants.js.map +1 -0
- package/dist/rtcMetrics/index.js +223 -0
- package/dist/rtcMetrics/index.js.map +1 -0
- package/dist/types/business-metrics.d.ts +36 -4
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +6 -1
- package/dist/types/call-diagnostic/config.d.ts +3 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/metrics.types.d.ts +17 -2
- package/dist/types/new-metrics.d.ts +5 -3
- package/dist/types/rtcMetrics/constants.d.ts +4 -0
- package/dist/types/rtcMetrics/index.d.ts +80 -0
- package/package.json +11 -11
- package/src/business-metrics.ts +97 -5
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +1 -1
- package/src/call-diagnostic/call-diagnostic-metrics.ts +17 -9
- package/src/call-diagnostic/config.ts +12 -0
- package/src/index.ts +2 -0
- package/src/metrics.types.ts +95 -23
- package/src/new-metrics.ts +12 -2
- package/src/rtcMetrics/constants.ts +3 -0
- package/src/rtcMetrics/index.ts +205 -0
- package/test/unit/spec/business/business-metrics.ts +69 -2
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +4 -6
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +274 -33
- package/test/unit/spec/new-metrics.ts +18 -3
- package/test/unit/spec/rtcMetrics/index.ts +196 -0
|
@@ -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,
|
|
@@ -30,7 +32,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
30
32
|
const fakeMeeting = {
|
|
31
33
|
id: '1',
|
|
32
34
|
correlationId: 'correlationId',
|
|
33
|
-
sessionCorrelationId: undefined,
|
|
34
35
|
callStateForMetrics: {},
|
|
35
36
|
environment: 'meeting_evn',
|
|
36
37
|
locusUrl: 'locus/url',
|
|
@@ -41,9 +42,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
41
42
|
},
|
|
42
43
|
meetingInfo: {},
|
|
43
44
|
getCurUserType: () => 'host',
|
|
44
|
-
statsAnalyzer: {
|
|
45
|
-
getLocalIpAddress: () => '192.168.1.90',
|
|
46
|
-
},
|
|
47
45
|
};
|
|
48
46
|
|
|
49
47
|
const fakeMeeting2 = {
|
|
@@ -53,9 +51,17 @@ describe('internal-plugin-metrics', () => {
|
|
|
53
51
|
callStateForMetrics: {loginType: 'fakeLoginType'},
|
|
54
52
|
};
|
|
55
53
|
|
|
54
|
+
const fakeMeeting3 = {
|
|
55
|
+
...fakeMeeting,
|
|
56
|
+
id: '3',
|
|
57
|
+
correlationId: 'correlationId3',
|
|
58
|
+
sessionCorrelationId: 'sessionCorrelationId3',
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
const fakeMeetings = {
|
|
57
62
|
1: fakeMeeting,
|
|
58
63
|
2: fakeMeeting2,
|
|
64
|
+
3: fakeMeeting3,
|
|
59
65
|
};
|
|
60
66
|
|
|
61
67
|
let webex;
|
|
@@ -87,8 +93,19 @@ describe('internal-plugin-metrics', () => {
|
|
|
87
93
|
clientName: 'Cantina',
|
|
88
94
|
},
|
|
89
95
|
},
|
|
96
|
+
getBasicMeetingInformation: (id) => fakeMeetings[id],
|
|
90
97
|
meetingCollection: {
|
|
91
|
-
get: (
|
|
98
|
+
get: (meetingId) => {
|
|
99
|
+
return {
|
|
100
|
+
statsAnalyzer: {
|
|
101
|
+
getLocalIpAddress: () => {
|
|
102
|
+
if (meetingId) {
|
|
103
|
+
return '192.168.1.90';
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
92
109
|
},
|
|
93
110
|
geoHintInfo: {
|
|
94
111
|
clientAddress: '1.3.4.5',
|
|
@@ -355,7 +372,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
355
372
|
|
|
356
373
|
assert.deepEqual(res, {
|
|
357
374
|
correlationId: 'correlationId',
|
|
358
|
-
sessionCorrelationId: undefined,
|
|
359
375
|
deviceId: 'deviceUrl',
|
|
360
376
|
locusId: 'url',
|
|
361
377
|
locusStartTime: 'lastActive',
|
|
@@ -368,7 +384,37 @@ describe('internal-plugin-metrics', () => {
|
|
|
368
384
|
});
|
|
369
385
|
});
|
|
370
386
|
|
|
371
|
-
|
|
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', () => {
|
|
372
418
|
cd.device = {
|
|
373
419
|
...cd.device,
|
|
374
420
|
config: {installationId: 'installationId'},
|
|
@@ -397,6 +443,35 @@ describe('internal-plugin-metrics', () => {
|
|
|
397
443
|
});
|
|
398
444
|
});
|
|
399
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
|
+
|
|
400
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', () => {
|
|
401
476
|
const res = cd.getIdentifiers({
|
|
402
477
|
mediaConnections: [
|
|
@@ -450,7 +525,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
450
525
|
|
|
451
526
|
assert.deepEqual(res, {
|
|
452
527
|
correlationId: 'correlationId',
|
|
453
|
-
sessionCorrelationId: undefined,
|
|
454
528
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
455
529
|
globalMeetingId: 'globalMeetingId1',
|
|
456
530
|
deviceId: 'deviceUrl',
|
|
@@ -484,7 +558,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
484
558
|
|
|
485
559
|
assert.deepEqual(res, {
|
|
486
560
|
correlationId: 'correlationId',
|
|
487
|
-
sessionCorrelationId: undefined,
|
|
488
561
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
489
562
|
globalMeetingId: 'globalMeetingId1',
|
|
490
563
|
deviceId: 'deviceUrl',
|
|
@@ -543,7 +616,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
543
616
|
|
|
544
617
|
assert.deepEqual(res, {
|
|
545
618
|
correlationId: 'correlationId',
|
|
546
|
-
sessionCorrelationId: 'unknown',
|
|
547
619
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
548
620
|
deviceId: 'deviceUrl',
|
|
549
621
|
locusUrl: 'locus-url',
|
|
@@ -560,7 +632,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
560
632
|
|
|
561
633
|
assert.deepEqual(res, {
|
|
562
634
|
correlationId: 'correlationId',
|
|
563
|
-
sessionCorrelationId: 'unknown',
|
|
564
635
|
globalMeetingId: 'globalMeetingId1',
|
|
565
636
|
deviceId: 'deviceUrl',
|
|
566
637
|
locusUrl: 'locus-url',
|
|
@@ -576,7 +647,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
576
647
|
|
|
577
648
|
assert.deepEqual(res, {
|
|
578
649
|
correlationId: 'correlationId',
|
|
579
|
-
sessionCorrelationId: 'unknown',
|
|
580
650
|
deviceId: 'deviceUrl',
|
|
581
651
|
locusUrl: 'locus-url',
|
|
582
652
|
orgId: 'orgId',
|
|
@@ -621,7 +691,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
621
691
|
|
|
622
692
|
assert.deepEqual(res, {
|
|
623
693
|
correlationId: 'correlationId',
|
|
624
|
-
sessionCorrelationId: 'unknown',
|
|
625
694
|
locusUrl: 'locus-url',
|
|
626
695
|
deviceId: 'deviceUrl',
|
|
627
696
|
orgId: 'orgId',
|
|
@@ -695,12 +764,14 @@ describe('internal-plugin-metrics', () => {
|
|
|
695
764
|
options,
|
|
696
765
|
});
|
|
697
766
|
|
|
767
|
+
assert.called(getIdentifiersSpy);
|
|
698
768
|
assert.calledWith(getIdentifiersSpy, {
|
|
699
769
|
meeting: fakeMeeting,
|
|
700
770
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
701
771
|
webexConferenceIdStr: undefined,
|
|
702
772
|
sessionCorrelationId: undefined,
|
|
703
773
|
globalMeetingId: undefined,
|
|
774
|
+
sessionCorrelationId: undefined,
|
|
704
775
|
});
|
|
705
776
|
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
706
777
|
assert.calledWith(
|
|
@@ -712,7 +783,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
712
783
|
},
|
|
713
784
|
identifiers: {
|
|
714
785
|
correlationId: 'correlationId',
|
|
715
|
-
sessionCorrelationId: undefined,
|
|
716
786
|
deviceId: 'deviceUrl',
|
|
717
787
|
locusId: 'url',
|
|
718
788
|
locusStartTime: 'lastActive',
|
|
@@ -738,7 +808,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
738
808
|
},
|
|
739
809
|
identifiers: {
|
|
740
810
|
correlationId: 'correlationId',
|
|
741
|
-
sessionCorrelationId: undefined,
|
|
742
811
|
deviceId: 'deviceUrl',
|
|
743
812
|
locusId: 'url',
|
|
744
813
|
locusStartTime: 'lastActive',
|
|
@@ -775,7 +844,142 @@ describe('internal-plugin-metrics', () => {
|
|
|
775
844
|
},
|
|
776
845
|
identifiers: {
|
|
777
846
|
correlationId: 'correlationId',
|
|
778
|
-
|
|
847
|
+
deviceId: 'deviceUrl',
|
|
848
|
+
locusId: 'url',
|
|
849
|
+
locusStartTime: 'lastActive',
|
|
850
|
+
locusUrl: 'locus/url',
|
|
851
|
+
mediaAgentAlias: 'alias',
|
|
852
|
+
mediaAgentGroupId: '1',
|
|
853
|
+
orgId: 'orgId',
|
|
854
|
+
userId: 'userId',
|
|
855
|
+
},
|
|
856
|
+
loginType: 'login-ci',
|
|
857
|
+
name: 'client.alert.displayed',
|
|
858
|
+
userType: 'host',
|
|
859
|
+
isConvergedArchitectureEnabled: undefined,
|
|
860
|
+
webexSubServiceType: undefined,
|
|
861
|
+
},
|
|
862
|
+
eventId: 'my-fake-id',
|
|
863
|
+
origin: {
|
|
864
|
+
origin: 'fake-origin',
|
|
865
|
+
},
|
|
866
|
+
originTime: {
|
|
867
|
+
sent: 'not_defined_yet',
|
|
868
|
+
triggered: now.toISOString(),
|
|
869
|
+
},
|
|
870
|
+
senderCountryCode: 'UK',
|
|
871
|
+
version: 1,
|
|
872
|
+
},
|
|
873
|
+
});
|
|
874
|
+
|
|
875
|
+
const webexLoggerLogCalls = webex.logger.log.getCalls();
|
|
876
|
+
assert.deepEqual(webexLoggerLogCalls[1].args, [
|
|
877
|
+
'call-diagnostic-events -> ',
|
|
878
|
+
'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
|
|
879
|
+
`name: client.alert.displayed`,
|
|
880
|
+
]);
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
it('should submit client event successfully with meetingId which has a sessionCorrelationId', () => {
|
|
884
|
+
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
885
|
+
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
886
|
+
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
887
|
+
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
888
|
+
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
889
|
+
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
890
|
+
const validatorSpy = sinon.spy(cd, 'validator');
|
|
891
|
+
const options = {
|
|
892
|
+
meetingId: fakeMeeting3.id,
|
|
893
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
cd.submitClientEvent({
|
|
897
|
+
name: 'client.alert.displayed',
|
|
898
|
+
options,
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
assert.called(getIdentifiersSpy);
|
|
902
|
+
assert.calledWith(getIdentifiersSpy, {
|
|
903
|
+
meeting: {...fakeMeeting3, sessionCorrelationId: 'sessionCorrelationId3'},
|
|
904
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
905
|
+
webexConferenceIdStr: undefined,
|
|
906
|
+
globalMeetingId: undefined,
|
|
907
|
+
sessionCorrelationId: undefined,
|
|
908
|
+
});
|
|
909
|
+
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
910
|
+
assert.calledWith(
|
|
911
|
+
prepareDiagnosticEventSpy,
|
|
912
|
+
{
|
|
913
|
+
canProceed: true,
|
|
914
|
+
eventData: {
|
|
915
|
+
webClientDomain: 'whatever',
|
|
916
|
+
},
|
|
917
|
+
identifiers: {
|
|
918
|
+
correlationId: 'correlationId3',
|
|
919
|
+
sessionCorrelationId: 'sessionCorrelationId3',
|
|
920
|
+
deviceId: 'deviceUrl',
|
|
921
|
+
locusId: 'url',
|
|
922
|
+
locusStartTime: 'lastActive',
|
|
923
|
+
locusUrl: 'locus/url',
|
|
924
|
+
mediaAgentAlias: 'alias',
|
|
925
|
+
mediaAgentGroupId: '1',
|
|
926
|
+
orgId: 'orgId',
|
|
927
|
+
userId: 'userId',
|
|
928
|
+
},
|
|
929
|
+
loginType: 'login-ci',
|
|
930
|
+
name: 'client.alert.displayed',
|
|
931
|
+
userType: 'host',
|
|
932
|
+
isConvergedArchitectureEnabled: undefined,
|
|
933
|
+
webexSubServiceType: undefined,
|
|
934
|
+
},
|
|
935
|
+
options
|
|
936
|
+
);
|
|
937
|
+
assert.calledWith(submitToCallDiagnosticsSpy, {
|
|
938
|
+
event: {
|
|
939
|
+
canProceed: true,
|
|
940
|
+
eventData: {
|
|
941
|
+
webClientDomain: 'whatever',
|
|
942
|
+
},
|
|
943
|
+
identifiers: {
|
|
944
|
+
correlationId: 'correlationId3',
|
|
945
|
+
sessionCorrelationId: 'sessionCorrelationId3',
|
|
946
|
+
deviceId: 'deviceUrl',
|
|
947
|
+
locusId: 'url',
|
|
948
|
+
locusStartTime: 'lastActive',
|
|
949
|
+
locusUrl: 'locus/url',
|
|
950
|
+
mediaAgentAlias: 'alias',
|
|
951
|
+
mediaAgentGroupId: '1',
|
|
952
|
+
orgId: 'orgId',
|
|
953
|
+
userId: 'userId',
|
|
954
|
+
},
|
|
955
|
+
loginType: 'login-ci',
|
|
956
|
+
name: 'client.alert.displayed',
|
|
957
|
+
userType: 'host',
|
|
958
|
+
isConvergedArchitectureEnabled: undefined,
|
|
959
|
+
webexSubServiceType: undefined,
|
|
960
|
+
},
|
|
961
|
+
eventId: 'my-fake-id',
|
|
962
|
+
origin: {
|
|
963
|
+
origin: 'fake-origin',
|
|
964
|
+
},
|
|
965
|
+
originTime: {
|
|
966
|
+
sent: 'not_defined_yet',
|
|
967
|
+
triggered: now.toISOString(),
|
|
968
|
+
},
|
|
969
|
+
senderCountryCode: 'UK',
|
|
970
|
+
version: 1,
|
|
971
|
+
});
|
|
972
|
+
assert.calledWith(validatorSpy, {
|
|
973
|
+
type: 'ce',
|
|
974
|
+
event: {
|
|
975
|
+
event: {
|
|
976
|
+
canProceed: true,
|
|
977
|
+
eventData: {
|
|
978
|
+
webClientDomain: 'whatever',
|
|
979
|
+
},
|
|
980
|
+
identifiers: {
|
|
981
|
+
correlationId: 'correlationId3',
|
|
982
|
+
sessionCorrelationId: 'sessionCorrelationId3',
|
|
779
983
|
deviceId: 'deviceUrl',
|
|
780
984
|
locusId: 'url',
|
|
781
985
|
locusStartTime: 'lastActive',
|
|
@@ -819,6 +1023,9 @@ describe('internal-plugin-metrics', () => {
|
|
|
819
1023
|
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
820
1024
|
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
821
1025
|
const validatorSpy = sinon.spy(cd, 'validator');
|
|
1026
|
+
sinon.stub(window.navigator, 'userAgent').get(() => userAgent);
|
|
1027
|
+
sinon.stub(bowser, 'getParser').returns(userAgent);
|
|
1028
|
+
|
|
822
1029
|
const options = {
|
|
823
1030
|
meetingId: fakeMeeting.id,
|
|
824
1031
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
@@ -847,7 +1054,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
847
1054
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
848
1055
|
'call-diagnostic-events -> ',
|
|
849
1056
|
'CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data',
|
|
850
|
-
|
|
1057
|
+
`${JSON.stringify(userAgent)}`,
|
|
851
1058
|
]);
|
|
852
1059
|
|
|
853
1060
|
assert.deepEqual(webexLoggerLogCalls[3].args, [
|
|
@@ -1052,7 +1259,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1052
1259
|
},
|
|
1053
1260
|
identifiers: {
|
|
1054
1261
|
correlationId: 'correlationId2',
|
|
1055
|
-
sessionCorrelationId: undefined,
|
|
1056
1262
|
deviceId: 'deviceUrl',
|
|
1057
1263
|
locusId: 'url',
|
|
1058
1264
|
locusStartTime: 'lastActive',
|
|
@@ -1161,7 +1367,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1161
1367
|
},
|
|
1162
1368
|
identifiers: {
|
|
1163
1369
|
correlationId: 'correlationId',
|
|
1164
|
-
sessionCorrelationId: undefined,
|
|
1165
1370
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1166
1371
|
globalMeetingId: 'globalMeetingId1',
|
|
1167
1372
|
deviceId: 'deviceUrl',
|
|
@@ -1240,7 +1445,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1240
1445
|
},
|
|
1241
1446
|
identifiers: {
|
|
1242
1447
|
correlationId: 'correlationId',
|
|
1243
|
-
sessionCorrelationId: undefined,
|
|
1244
1448
|
deviceId: 'deviceUrl',
|
|
1245
1449
|
locusId: 'url',
|
|
1246
1450
|
locusStartTime: 'lastActive',
|
|
@@ -1257,6 +1461,9 @@ describe('internal-plugin-metrics', () => {
|
|
|
1257
1461
|
name: 'other',
|
|
1258
1462
|
category: 'other',
|
|
1259
1463
|
errorCode: 9999,
|
|
1464
|
+
errorData: {
|
|
1465
|
+
errorName: 'Error'
|
|
1466
|
+
},
|
|
1260
1467
|
serviceErrorCode: 9999,
|
|
1261
1468
|
errorDescription: 'UnknownError',
|
|
1262
1469
|
rawErrorMessage: 'bad times',
|
|
@@ -1290,7 +1497,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1290
1497
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1291
1498
|
'call-diagnostic-events -> ',
|
|
1292
1499
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1293
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1500
|
+
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1294
1501
|
]);
|
|
1295
1502
|
});
|
|
1296
1503
|
|
|
@@ -1316,7 +1523,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1316
1523
|
},
|
|
1317
1524
|
identifiers: {
|
|
1318
1525
|
correlationId: 'correlationId',
|
|
1319
|
-
sessionCorrelationId: 'unknown',
|
|
1320
1526
|
deviceId: 'deviceUrl',
|
|
1321
1527
|
locusUrl: 'locus-url',
|
|
1322
1528
|
orgId: 'orgId',
|
|
@@ -1329,6 +1535,9 @@ describe('internal-plugin-metrics', () => {
|
|
|
1329
1535
|
name: 'other',
|
|
1330
1536
|
category: 'other',
|
|
1331
1537
|
errorCode: 9999,
|
|
1538
|
+
errorData: {
|
|
1539
|
+
errorName: 'Error'
|
|
1540
|
+
},
|
|
1332
1541
|
serviceErrorCode: 9999,
|
|
1333
1542
|
errorDescription: 'UnknownError',
|
|
1334
1543
|
rawErrorMessage: 'bad times',
|
|
@@ -1360,7 +1569,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1360
1569
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1361
1570
|
'call-diagnostic-events -> ',
|
|
1362
1571
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1363
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1572
|
+
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1364
1573
|
]);
|
|
1365
1574
|
});
|
|
1366
1575
|
|
|
@@ -1390,7 +1599,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1390
1599
|
},
|
|
1391
1600
|
identifiers: {
|
|
1392
1601
|
correlationId: 'correlationId',
|
|
1393
|
-
sessionCorrelationId: 'unknown',
|
|
1394
1602
|
deviceId: 'deviceUrl',
|
|
1395
1603
|
locusUrl: 'locus-url',
|
|
1396
1604
|
orgId: 'orgId',
|
|
@@ -1470,7 +1678,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1470
1678
|
},
|
|
1471
1679
|
identifiers: {
|
|
1472
1680
|
correlationId: 'correlationId',
|
|
1473
|
-
sessionCorrelationId: undefined,
|
|
1474
1681
|
deviceId: 'deviceUrl',
|
|
1475
1682
|
locusId: 'url',
|
|
1476
1683
|
locusStartTime: 'lastActive',
|
|
@@ -1516,7 +1723,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
1516
1723
|
});
|
|
1517
1724
|
|
|
1518
1725
|
it('should send behavioral event if meetingId provided but meeting is undefined', () => {
|
|
1519
|
-
webex.meetings.
|
|
1726
|
+
webex.meetings.getBasicMeetingInformation = sinon.stub().returns(undefined);
|
|
1727
|
+
|
|
1520
1728
|
cd.submitClientEvent({name: 'client.alert.displayed', options: {meetingId: 'meetingId'}});
|
|
1521
1729
|
assert.calledWith(
|
|
1522
1730
|
webex.internal.metrics.submitClientMetrics,
|
|
@@ -1603,7 +1811,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1603
1811
|
canProceed: true,
|
|
1604
1812
|
identifiers: {
|
|
1605
1813
|
correlationId: 'correlationId',
|
|
1606
|
-
sessionCorrelationId: undefined,
|
|
1607
1814
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1608
1815
|
globalMeetingId: 'globalMeetingId1',
|
|
1609
1816
|
userId: 'userId',
|
|
@@ -1643,7 +1850,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1643
1850
|
canProceed: true,
|
|
1644
1851
|
identifiers: {
|
|
1645
1852
|
correlationId: 'correlationId',
|
|
1646
|
-
sessionCorrelationId: undefined,
|
|
1647
1853
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1648
1854
|
globalMeetingId: 'globalMeetingId1',
|
|
1649
1855
|
userId: 'userId',
|
|
@@ -1689,7 +1895,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1689
1895
|
locusUrl: 'locus/url',
|
|
1690
1896
|
locusId: 'url',
|
|
1691
1897
|
locusStartTime: 'lastActive',
|
|
1692
|
-
sessionCorrelationId: undefined,
|
|
1693
1898
|
},
|
|
1694
1899
|
eventData: {webClientDomain: 'whatever'},
|
|
1695
1900
|
intervals: [{}],
|
|
@@ -1723,7 +1928,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1723
1928
|
});
|
|
1724
1929
|
|
|
1725
1930
|
it('should send behavioral event if meeting is undefined', () => {
|
|
1726
|
-
webex.meetings.
|
|
1931
|
+
webex.meetings.getBasicMeetingInformation = sinon.stub().returns(undefined);
|
|
1727
1932
|
cd.submitMQE({
|
|
1728
1933
|
name: 'client.mediaquality.event',
|
|
1729
1934
|
payload: {
|
|
@@ -2045,6 +2250,9 @@ describe('internal-plugin-metrics', () => {
|
|
|
2045
2250
|
shownToUser: true,
|
|
2046
2251
|
serviceErrorCode: 9999,
|
|
2047
2252
|
errorCode: 9999,
|
|
2253
|
+
errorData: {
|
|
2254
|
+
errorName: 'Error'
|
|
2255
|
+
},
|
|
2048
2256
|
rawErrorMessage: 'bad times',
|
|
2049
2257
|
});
|
|
2050
2258
|
});
|
|
@@ -2188,6 +2396,40 @@ describe('internal-plugin-metrics', () => {
|
|
|
2188
2396
|
});
|
|
2189
2397
|
});
|
|
2190
2398
|
|
|
2399
|
+
it('should generate event error payload correctly for wdm error 4404002', () => {
|
|
2400
|
+
const res = cd.generateClientEventErrorPayload({
|
|
2401
|
+
body: {errorCode: 4404002},
|
|
2402
|
+
message: 'Operation denied due to region restriction',
|
|
2403
|
+
});
|
|
2404
|
+
assert.deepEqual(res, {
|
|
2405
|
+
category: 'expected',
|
|
2406
|
+
errorDescription: 'WdmRestrictedRegion',
|
|
2407
|
+
fatal: true,
|
|
2408
|
+
name: 'other',
|
|
2409
|
+
shownToUser: false,
|
|
2410
|
+
serviceErrorCode: 4404002,
|
|
2411
|
+
errorCode: 13000,
|
|
2412
|
+
rawErrorMessage: 'Operation denied due to region restriction',
|
|
2413
|
+
});
|
|
2414
|
+
});
|
|
2415
|
+
|
|
2416
|
+
it('should generate event error payload correctly for wdm error 4404003', () => {
|
|
2417
|
+
const res = cd.generateClientEventErrorPayload({
|
|
2418
|
+
body: {errorCode: 4404003},
|
|
2419
|
+
message: 'Operation denied due to region restriction',
|
|
2420
|
+
});
|
|
2421
|
+
assert.deepEqual(res, {
|
|
2422
|
+
category: 'expected',
|
|
2423
|
+
errorDescription: 'WdmRestrictedRegion',
|
|
2424
|
+
fatal: true,
|
|
2425
|
+
name: 'other',
|
|
2426
|
+
shownToUser: false,
|
|
2427
|
+
serviceErrorCode: 4404003,
|
|
2428
|
+
errorCode: 13000,
|
|
2429
|
+
rawErrorMessage: 'Operation denied due to region restriction',
|
|
2430
|
+
});
|
|
2431
|
+
});
|
|
2432
|
+
|
|
2191
2433
|
describe('httpStatusCode', () => {
|
|
2192
2434
|
it('should include httpStatusCode for browser media errors', () => {
|
|
2193
2435
|
const res = cd.generateClientEventErrorPayload({
|
|
@@ -2443,7 +2685,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2443
2685
|
locusUrl: 'locus/url',
|
|
2444
2686
|
orgId: 'orgId',
|
|
2445
2687
|
userId: 'userId',
|
|
2446
|
-
sessionCorrelationId: undefined,
|
|
2447
2688
|
},
|
|
2448
2689
|
loginType: 'login-ci',
|
|
2449
2690
|
name: 'client.exit.app',
|
|
@@ -2551,11 +2792,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
2551
2792
|
// The method is called in beforeEach itself. We are just testing it here
|
|
2552
2793
|
it('sets the received deviceInfo to call-diagnostics', () => {
|
|
2553
2794
|
const webexLoggerLogCalls = webex.logger.log.getCalls();
|
|
2554
|
-
const device = {
|
|
2795
|
+
const device = {userId: 'userId', url: 'deviceUrl', orgId: 'orgId'};
|
|
2555
2796
|
|
|
2556
2797
|
assert.deepEqual(webexLoggerLogCalls[0].args, [
|
|
2557
2798
|
'CallDiagnosticMetrics: @setDeviceInfo called',
|
|
2558
|
-
device
|
|
2799
|
+
device,
|
|
2559
2800
|
]);
|
|
2560
2801
|
|
|
2561
2802
|
assert.deepEqual(cd.device, device);
|
|
@@ -11,9 +11,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
11
11
|
newMetrics: NewMetrics,
|
|
12
12
|
},
|
|
13
13
|
meetings: {
|
|
14
|
-
meetingCollection: {
|
|
15
|
-
get: sinon.stub(),
|
|
16
|
-
},
|
|
17
14
|
},
|
|
18
15
|
request: sinon.stub().resolves({}),
|
|
19
16
|
logger: {
|
|
@@ -86,6 +83,24 @@ describe('internal-plugin-metrics', () => {
|
|
|
86
83
|
webex.internal.newMetrics.isReadyToSubmitBusinessEvents();
|
|
87
84
|
assert.isDefined(webex.internal.newMetrics.businessMetrics);
|
|
88
85
|
})
|
|
86
|
+
|
|
87
|
+
it('passes the table through to the business metrics', () => {
|
|
88
|
+
assert.isUndefined(webex.internal.newMetrics.businessMetrics)
|
|
89
|
+
webex.internal.newMetrics.isReadyToSubmitBusinessEvents();
|
|
90
|
+
assert.isDefined(webex.internal.newMetrics.businessMetrics);
|
|
91
|
+
webex.internal.newMetrics.businessMetrics.submitBusinessEvent = sinon.stub();
|
|
92
|
+
webex.internal.newMetrics.submitBusinessEvent({
|
|
93
|
+
name: 'foobar',
|
|
94
|
+
payload: {},
|
|
95
|
+
table: 'test',
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
assert.calledWith(webex.internal.newMetrics.businessMetrics.submitBusinessEvent, {
|
|
99
|
+
name: 'foobar',
|
|
100
|
+
payload: {},
|
|
101
|
+
table: 'test',
|
|
102
|
+
});
|
|
103
|
+
});
|
|
89
104
|
|
|
90
105
|
it('submits Client Event successfully', () => {
|
|
91
106
|
webex.internal.newMetrics.submitClientEvent({
|