@webex/internal-plugin-metrics 3.5.0-next.8 → 3.5.0-wxcc.1
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/behavioral/behavioral-metrics.js +199 -0
- package/dist/behavioral/behavioral-metrics.js.map +1 -0
- package/dist/behavioral/config.js +11 -0
- package/dist/behavioral/config.js.map +1 -0
- 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 +7 -15
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js +2 -7
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
- package/dist/call-diagnostic/config.js +3 -13
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/types/behavioral/behavioral-metrics.d.ts +63 -0
- package/dist/types/behavioral/config.d.ts +1 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +1 -6
- package/dist/types/call-diagnostic/config.d.ts +0 -3
- package/dist/types/index.d.ts +1 -2
- package/package.json +11 -11
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +1 -1
- package/src/call-diagnostic/call-diagnostic-metrics.ts +7 -13
- package/src/call-diagnostic/call-diagnostic-metrics.util.ts +5 -11
- package/src/call-diagnostic/config.ts +0 -12
- package/src/index.ts +0 -2
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +1 -2
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +6 -4
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +12 -406
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +3 -7
- package/test/unit/spec/new-metrics.ts +3 -0
- package/test/unit/spec/prelogin-metrics-batcher.ts +1 -3
- package/dist/rtcMetrics/constants.js +0 -11
- package/dist/rtcMetrics/constants.js.map +0 -1
- package/dist/rtcMetrics/index.js +0 -202
- package/dist/rtcMetrics/index.js.map +0 -1
- package/dist/types/rtcMetrics/constants.d.ts +0 -4
- package/dist/types/rtcMetrics/index.d.ts +0 -71
- package/src/rtcMetrics/constants.ts +0 -3
- package/src/rtcMetrics/index.ts +0 -186
- package/test/unit/spec/rtcMetrics/index.ts +0 -155
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import sinon from 'sinon';
|
|
2
|
-
import bowser from 'bowser';
|
|
3
2
|
import {assert} from '@webex/test-helper-chai';
|
|
4
3
|
import {WebexHttpError} from '@webex/webex-core';
|
|
5
4
|
import {BrowserDetection} from '@webex/common';
|
|
6
|
-
import window from 'global/window';
|
|
7
5
|
import {
|
|
8
6
|
CallDiagnosticLatencies,
|
|
9
7
|
CallDiagnosticMetrics,
|
|
@@ -42,6 +40,9 @@ describe('internal-plugin-metrics', () => {
|
|
|
42
40
|
},
|
|
43
41
|
meetingInfo: {},
|
|
44
42
|
getCurUserType: () => 'host',
|
|
43
|
+
statsAnalyzer: {
|
|
44
|
+
getLocalIpAddress: () => '192.168.1.90',
|
|
45
|
+
},
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
const fakeMeeting2 = {
|
|
@@ -51,17 +52,9 @@ describe('internal-plugin-metrics', () => {
|
|
|
51
52
|
callStateForMetrics: {loginType: 'fakeLoginType'},
|
|
52
53
|
};
|
|
53
54
|
|
|
54
|
-
const fakeMeeting3 = {
|
|
55
|
-
...fakeMeeting,
|
|
56
|
-
id: '3',
|
|
57
|
-
correlationId: 'correlationId3',
|
|
58
|
-
sessionCorrelationId: 'sessionCorrelationId3',
|
|
59
|
-
}
|
|
60
|
-
|
|
61
55
|
const fakeMeetings = {
|
|
62
56
|
1: fakeMeeting,
|
|
63
57
|
2: fakeMeeting2,
|
|
64
|
-
3: fakeMeeting3,
|
|
65
58
|
};
|
|
66
59
|
|
|
67
60
|
let webex;
|
|
@@ -93,19 +86,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
93
86
|
clientName: 'Cantina',
|
|
94
87
|
},
|
|
95
88
|
},
|
|
96
|
-
getBasicMeetingInformation: (id) => fakeMeetings[id],
|
|
97
89
|
meetingCollection: {
|
|
98
|
-
get: (
|
|
99
|
-
return {
|
|
100
|
-
statsAnalyzer: {
|
|
101
|
-
getLocalIpAddress: () => {
|
|
102
|
-
if (meetingId) {
|
|
103
|
-
return '192.168.1.90';
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
90
|
+
get: (id) => fakeMeetings[id],
|
|
109
91
|
},
|
|
110
92
|
geoHintInfo: {
|
|
111
93
|
clientAddress: '1.3.4.5',
|
|
@@ -384,94 +366,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
384
366
|
});
|
|
385
367
|
});
|
|
386
368
|
|
|
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
|
-
|
|
475
369
|
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', () => {
|
|
476
370
|
const res = cd.getIdentifiers({
|
|
477
371
|
mediaConnections: [
|
|
@@ -572,42 +466,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
572
466
|
});
|
|
573
467
|
});
|
|
574
468
|
|
|
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
|
-
|
|
611
469
|
it('should build identifiers correctly given webexConferenceIdStr', () => {
|
|
612
470
|
const res = cd.getIdentifiers({
|
|
613
471
|
correlationId: 'correlationId',
|
|
@@ -654,22 +512,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
654
512
|
});
|
|
655
513
|
});
|
|
656
514
|
|
|
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
|
-
|
|
673
515
|
it('should throw Error if correlationId is missing', () => {
|
|
674
516
|
assert.throws(() =>
|
|
675
517
|
cd.getIdentifiers({
|
|
@@ -764,13 +606,12 @@ describe('internal-plugin-metrics', () => {
|
|
|
764
606
|
options,
|
|
765
607
|
});
|
|
766
608
|
|
|
767
|
-
assert.called(getIdentifiersSpy);
|
|
768
609
|
assert.calledWith(getIdentifiersSpy, {
|
|
769
610
|
meeting: fakeMeeting,
|
|
770
611
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
771
612
|
webexConferenceIdStr: undefined,
|
|
772
|
-
globalMeetingId: undefined,
|
|
773
613
|
sessionCorrelationId: undefined,
|
|
614
|
+
globalMeetingId: undefined,
|
|
774
615
|
});
|
|
775
616
|
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
776
617
|
assert.calledWith(
|
|
@@ -879,142 +720,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
879
720
|
]);
|
|
880
721
|
});
|
|
881
722
|
|
|
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
|
-
|
|
1018
723
|
it('should log browser data, but only for the first call diagnostic event', () => {
|
|
1019
724
|
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
1020
725
|
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
@@ -1022,9 +727,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1022
727
|
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
1023
728
|
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
1024
729
|
const validatorSpy = sinon.spy(cd, 'validator');
|
|
1025
|
-
sinon.stub(window.navigator, 'userAgent').get(() => userAgent);
|
|
1026
|
-
sinon.stub(bowser, 'getParser').returns(userAgent);
|
|
1027
|
-
|
|
1028
730
|
const options = {
|
|
1029
731
|
meetingId: fakeMeeting.id,
|
|
1030
732
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
@@ -1053,7 +755,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1053
755
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1054
756
|
'call-diagnostic-events -> ',
|
|
1055
757
|
'CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data',
|
|
1056
|
-
|
|
758
|
+
'{"error":"unable to access window.navigator.userAgent"}',
|
|
1057
759
|
]);
|
|
1058
760
|
|
|
1059
761
|
assert.deepEqual(webexLoggerLogCalls[3].args, [
|
|
@@ -1286,57 +988,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1286
988
|
});
|
|
1287
989
|
});
|
|
1288
990
|
|
|
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
|
-
|
|
1340
991
|
it('it should include errors if provided with meetingId', () => {
|
|
1341
992
|
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
1342
993
|
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
@@ -1460,9 +1111,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1460
1111
|
name: 'other',
|
|
1461
1112
|
category: 'other',
|
|
1462
1113
|
errorCode: 9999,
|
|
1463
|
-
errorData: {
|
|
1464
|
-
errorName: 'Error'
|
|
1465
|
-
},
|
|
1466
1114
|
serviceErrorCode: 9999,
|
|
1467
1115
|
errorDescription: 'UnknownError',
|
|
1468
1116
|
rawErrorMessage: 'bad times',
|
|
@@ -1496,7 +1144,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1496
1144
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1497
1145
|
'call-diagnostic-events -> ',
|
|
1498
1146
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1499
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"
|
|
1147
|
+
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1500
1148
|
]);
|
|
1501
1149
|
});
|
|
1502
1150
|
|
|
@@ -1534,9 +1182,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1534
1182
|
name: 'other',
|
|
1535
1183
|
category: 'other',
|
|
1536
1184
|
errorCode: 9999,
|
|
1537
|
-
errorData: {
|
|
1538
|
-
errorName: 'Error'
|
|
1539
|
-
},
|
|
1540
1185
|
serviceErrorCode: 9999,
|
|
1541
1186
|
errorDescription: 'UnknownError',
|
|
1542
1187
|
rawErrorMessage: 'bad times',
|
|
@@ -1568,7 +1213,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1568
1213
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1569
1214
|
'call-diagnostic-events -> ',
|
|
1570
1215
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1571
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"
|
|
1216
|
+
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1572
1217
|
]);
|
|
1573
1218
|
});
|
|
1574
1219
|
|
|
@@ -1722,8 +1367,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1722
1367
|
});
|
|
1723
1368
|
|
|
1724
1369
|
it('should send behavioral event if meetingId provided but meeting is undefined', () => {
|
|
1725
|
-
webex.meetings.
|
|
1726
|
-
|
|
1370
|
+
webex.meetings.meetingCollection.get = sinon.stub().returns(undefined);
|
|
1727
1371
|
cd.submitClientEvent({name: 'client.alert.displayed', options: {meetingId: 'meetingId'}});
|
|
1728
1372
|
assert.calledWith(
|
|
1729
1373
|
webex.internal.metrics.submitClientMetrics,
|
|
@@ -1927,7 +1571,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1927
1571
|
});
|
|
1928
1572
|
|
|
1929
1573
|
it('should send behavioral event if meeting is undefined', () => {
|
|
1930
|
-
webex.meetings.
|
|
1574
|
+
webex.meetings.meetingCollection.get = sinon.stub().returns(undefined);
|
|
1931
1575
|
cd.submitMQE({
|
|
1932
1576
|
name: 'client.mediaquality.event',
|
|
1933
1577
|
payload: {
|
|
@@ -2249,9 +1893,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2249
1893
|
shownToUser: true,
|
|
2250
1894
|
serviceErrorCode: 9999,
|
|
2251
1895
|
errorCode: 9999,
|
|
2252
|
-
errorData: {
|
|
2253
|
-
errorName: 'Error'
|
|
2254
|
-
},
|
|
2255
1896
|
rawErrorMessage: 'bad times',
|
|
2256
1897
|
});
|
|
2257
1898
|
});
|
|
@@ -2395,40 +2036,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2395
2036
|
});
|
|
2396
2037
|
});
|
|
2397
2038
|
|
|
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
|
-
|
|
2432
2039
|
describe('httpStatusCode', () => {
|
|
2433
2040
|
it('should include httpStatusCode for browser media errors', () => {
|
|
2434
2041
|
const res = cd.generateClientEventErrorPayload({
|
|
@@ -2707,7 +2314,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2707
2314
|
environment: 'meeting_evn',
|
|
2708
2315
|
name: 'endpoint',
|
|
2709
2316
|
networkType: 'unknown',
|
|
2710
|
-
upgradeChannel: 'test',
|
|
2711
2317
|
userAgent,
|
|
2712
2318
|
},
|
|
2713
2319
|
originTime: {
|
|
@@ -2791,11 +2397,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
2791
2397
|
// The method is called in beforeEach itself. We are just testing it here
|
|
2792
2398
|
it('sets the received deviceInfo to call-diagnostics', () => {
|
|
2793
2399
|
const webexLoggerLogCalls = webex.logger.log.getCalls();
|
|
2794
|
-
const device = {userId: 'userId', url: 'deviceUrl', orgId: 'orgId'};
|
|
2400
|
+
const device = { userId: 'userId', url: 'deviceUrl', orgId: 'orgId' };
|
|
2795
2401
|
|
|
2796
2402
|
assert.deepEqual(webexLoggerLogCalls[0].args, [
|
|
2797
2403
|
'CallDiagnosticMetrics: @setDeviceInfo called',
|
|
2798
|
-
device
|
|
2404
|
+
device
|
|
2799
2405
|
]);
|
|
2800
2406
|
|
|
2801
2407
|
assert.deepEqual(cd.device, device);
|
|
@@ -274,7 +274,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
274
274
|
describe('prepareDiagnosticMetricItem', () => {
|
|
275
275
|
let webex: any;
|
|
276
276
|
|
|
277
|
-
const check = (eventName: string, expectedEvent: any
|
|
277
|
+
const check = (eventName: string, expectedEvent: any) => {
|
|
278
278
|
const eventPayload = {event: {name: eventName}};
|
|
279
279
|
const item = prepareDiagnosticMetricItem(webex, {
|
|
280
280
|
eventPayload,
|
|
@@ -286,7 +286,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
286
286
|
origin: {
|
|
287
287
|
buildType: 'prod',
|
|
288
288
|
networkType: 'unknown',
|
|
289
|
-
upgradeChannel: expectedUpgradeChannel
|
|
290
289
|
},
|
|
291
290
|
event: {name: eventName, ...expectedEvent},
|
|
292
291
|
},
|
|
@@ -418,11 +417,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
418
417
|
],
|
|
419
418
|
].forEach(([eventName, expectedEvent]) => {
|
|
420
419
|
it(`returns expected result for ${eventName}`, () => {
|
|
421
|
-
check(eventName as string, expectedEvent
|
|
420
|
+
check(eventName as string, expectedEvent);
|
|
422
421
|
});
|
|
423
422
|
});
|
|
424
423
|
|
|
425
|
-
it('
|
|
424
|
+
it('getBuildType returns correct value', () => {
|
|
426
425
|
const item: any = {
|
|
427
426
|
eventPayload: {
|
|
428
427
|
event: {
|
|
@@ -439,14 +438,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
439
438
|
// just submit any event
|
|
440
439
|
prepareDiagnosticMetricItem(webex, item);
|
|
441
440
|
assert.deepEqual(item.eventPayload.origin.buildType, 'test');
|
|
442
|
-
assert.deepEqual(item.eventPayload.origin.upgradeChannel, 'test');
|
|
443
441
|
|
|
444
442
|
delete item.eventPayload.origin.buildType;
|
|
445
|
-
delete item.eventPayload.origin.upgradeChannel;
|
|
446
443
|
item.eventPayload.event.eventData.markAsTestEvent = false;
|
|
447
444
|
prepareDiagnosticMetricItem(webex, item);
|
|
448
445
|
assert.deepEqual(item.eventPayload.origin.buildType, 'prod');
|
|
449
|
-
assert.deepEqual(item.eventPayload.origin.upgradeChannel, 'gold');
|
|
450
446
|
});
|
|
451
447
|
});
|
|
452
448
|
|
|
@@ -82,7 +82,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
82
82
|
origin: {
|
|
83
83
|
buildType: 'test',
|
|
84
84
|
networkType: 'unknown',
|
|
85
|
-
upgradeChannel: 'test',
|
|
86
85
|
},
|
|
87
86
|
originTime: {
|
|
88
87
|
sent: dateAfterBatcherWait.toISOString(),
|
|
@@ -212,7 +211,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
212
211
|
// item also gets assigned a delay property but the key is a Symbol and haven't been able to test that..
|
|
213
212
|
assert.deepEqual(calls.args[0].eventPayload, {
|
|
214
213
|
event: 'my.event',
|
|
215
|
-
origin: {buildType: 'test', networkType: 'unknown'
|
|
214
|
+
origin: {buildType: 'test', networkType: 'unknown'},
|
|
216
215
|
});
|
|
217
216
|
|
|
218
217
|
assert.deepEqual(calls.args[0].type, ['diagnostic-event']);
|
|
@@ -226,7 +225,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
226
225
|
origin: {
|
|
227
226
|
buildType: 'test',
|
|
228
227
|
networkType: 'unknown',
|
|
229
|
-
upgradeChannel: 'test',
|
|
230
228
|
},
|
|
231
229
|
});
|
|
232
230
|
assert.deepEqual(prepareDiagnosticMetricItemCalls[0].args[1].type, ['diagnostic-event']);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var RTC_METRICS = exports.default = {
|
|
9
|
-
APP_ID: 'FFB51ED5-4319-4C55-8303-B1F2FCCDE231'
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["RTC_METRICS","exports","default","APP_ID"],"sources":["constants.ts"],"sourcesContent":["const RTC_METRICS = {APP_ID: 'FFB51ED5-4319-4C55-8303-B1F2FCCDE231'};\n\nexport {RTC_METRICS as default};\n"],"mappings":";;;;;;;AAAA,IAAMA,WAAW,GAAAC,OAAA,CAAAC,OAAA,GAAG;EAACC,MAAM,EAAE;AAAsC,CAAC"}
|