@webex/internal-plugin-metrics 3.12.0-next.8 → 3.12.0-task-refactor.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/call-diagnostic/call-diagnostic-metrics-latencies.js +34 -41
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +0 -5
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js +4 -39
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
- package/dist/call-diagnostic/config.js +1 -3
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/generic-metrics.js +6 -8
- package/dist/generic-metrics.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/metrics.types.js.map +1 -1
- package/dist/new-metrics.js +20 -56
- package/dist/new-metrics.js.map +1 -1
- package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +0 -8
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +20 -34
- package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +2 -23
- package/dist/types/call-diagnostic/config.d.ts +19 -2
- package/dist/types/config.d.ts +15 -15
- package/dist/types/index.d.ts +1 -2
- package/dist/types/metrics.types.d.ts +2 -2
- package/dist/types/new-metrics.d.ts +0 -12
- package/package.json +11 -11
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +44 -89
- package/src/call-diagnostic/call-diagnostic-metrics.ts +0 -6
- package/src/call-diagnostic/call-diagnostic-metrics.util.ts +2 -44
- package/src/call-diagnostic/config.ts +0 -2
- package/src/generic-metrics.ts +6 -6
- package/src/index.ts +0 -2
- package/src/metrics.types.ts +2 -2
- package/src/new-metrics.ts +0 -42
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +11 -38
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +301 -227
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +0 -44
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +3 -65
- package/dist/prelogin-metrics.js +0 -106
- package/dist/prelogin-metrics.js.map +0 -1
- package/dist/types/prelogin-metrics.d.ts +0 -47
- package/src/prelogin-metrics.ts +0 -94
- package/test/unit/spec/prelogin-metrics.ts +0 -132
|
@@ -44,7 +44,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
44
44
|
locusInfo: {
|
|
45
45
|
fullState: {
|
|
46
46
|
lastActive: 'lastActive',
|
|
47
|
-
sessionId: 'locusSessionId',
|
|
48
47
|
},
|
|
49
48
|
},
|
|
50
49
|
meetingInfo: {},
|
|
@@ -432,7 +431,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
432
431
|
correlationId: 'correlationId',
|
|
433
432
|
deviceId: 'deviceUrl',
|
|
434
433
|
locusId: 'url',
|
|
435
|
-
locusSessionId: 'locusSessionId',
|
|
436
434
|
locusStartTime: 'lastActive',
|
|
437
435
|
locusUrl: 'locus/url',
|
|
438
436
|
machineId: 'installationId',
|
|
@@ -462,7 +460,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
462
460
|
correlationId: 'correlationId',
|
|
463
461
|
deviceId: 'deviceUrl',
|
|
464
462
|
locusId: 'url',
|
|
465
|
-
locusSessionId: 'locusSessionId',
|
|
466
463
|
locusStartTime: 'lastActive',
|
|
467
464
|
locusUrl: 'locus/url',
|
|
468
465
|
machineId: 'installationId',
|
|
@@ -493,7 +490,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
493
490
|
sessionCorrelationId: 'sessionCorrelationId',
|
|
494
491
|
deviceId: 'deviceUrl',
|
|
495
492
|
locusId: 'url',
|
|
496
|
-
locusSessionId: 'locusSessionId',
|
|
497
493
|
locusStartTime: 'lastActive',
|
|
498
494
|
locusUrl: 'locus/url',
|
|
499
495
|
machineId: 'installationId',
|
|
@@ -523,7 +519,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
523
519
|
sessionCorrelationId: 'sessionCorrelationId',
|
|
524
520
|
deviceId: 'deviceUrl',
|
|
525
521
|
locusId: 'url',
|
|
526
|
-
locusSessionId: 'locusSessionId',
|
|
527
522
|
locusStartTime: 'lastActive',
|
|
528
523
|
locusUrl: 'locus/url',
|
|
529
524
|
machineId: 'installationId',
|
|
@@ -559,7 +554,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
559
554
|
globalMeetingId: 'globalMeetingId1',
|
|
560
555
|
deviceId: 'deviceUrl',
|
|
561
556
|
locusId: 'url',
|
|
562
|
-
locusSessionId: 'locusSessionId',
|
|
563
557
|
locusStartTime: 'lastActive',
|
|
564
558
|
locusUrl: 'locus/url',
|
|
565
559
|
mediaAgentAlias: 'mediaAgentAlias',
|
|
@@ -592,7 +586,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
592
586
|
globalMeetingId: 'globalMeetingId1',
|
|
593
587
|
deviceId: 'deviceUrl',
|
|
594
588
|
locusId: 'url',
|
|
595
|
-
locusSessionId: 'locusSessionId',
|
|
596
589
|
locusStartTime: 'lastActive',
|
|
597
590
|
locusUrl: 'locus/url',
|
|
598
591
|
mediaAgentAlias: 'mediaAgentAlias',
|
|
@@ -627,7 +620,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
627
620
|
deviceId: 'deviceUrl',
|
|
628
621
|
locusId: 'url',
|
|
629
622
|
locusStartTime: 'lastActive',
|
|
630
|
-
locusSessionId: 'locusSessionId',
|
|
631
623
|
locusUrl: 'locus/url',
|
|
632
624
|
mediaAgentAlias: 'mediaAgentAlias',
|
|
633
625
|
mediaAgentGroupId: 'mediaAgentGroupId',
|
|
@@ -663,7 +655,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
663
655
|
globalMeetingId: 'globalMeetingId1',
|
|
664
656
|
deviceId: 'deviceUrl',
|
|
665
657
|
locusId: 'url',
|
|
666
|
-
locusSessionId: 'locusSessionId',
|
|
667
658
|
locusStartTime: 'lastActive',
|
|
668
659
|
locusUrl: 'locus/url',
|
|
669
660
|
mediaAgentAlias: 'mediaAgentAlias',
|
|
@@ -898,7 +889,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
898
889
|
correlationId: 'correlationId',
|
|
899
890
|
deviceId: 'deviceUrl',
|
|
900
891
|
locusId: 'url',
|
|
901
|
-
locusSessionId: 'locusSessionId',
|
|
902
892
|
locusStartTime: 'lastActive',
|
|
903
893
|
locusUrl: 'locus/url',
|
|
904
894
|
mediaAgentAlias: 'alias',
|
|
@@ -926,7 +916,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
926
916
|
correlationId: 'correlationId',
|
|
927
917
|
deviceId: 'deviceUrl',
|
|
928
918
|
locusId: 'url',
|
|
929
|
-
locusSessionId: 'locusSessionId',
|
|
930
919
|
locusStartTime: 'lastActive',
|
|
931
920
|
locusUrl: 'locus/url',
|
|
932
921
|
mediaAgentAlias: 'alias',
|
|
@@ -965,7 +954,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
965
954
|
correlationId: 'correlationId',
|
|
966
955
|
deviceId: 'deviceUrl',
|
|
967
956
|
locusId: 'url',
|
|
968
|
-
locusSessionId: 'locusSessionId',
|
|
969
957
|
locusStartTime: 'lastActive',
|
|
970
958
|
locusUrl: 'locus/url',
|
|
971
959
|
mediaAgentAlias: 'alias',
|
|
@@ -1040,7 +1028,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1040
1028
|
correlationId: 'correlationId',
|
|
1041
1029
|
deviceId: 'deviceUrl',
|
|
1042
1030
|
locusId: 'url',
|
|
1043
|
-
locusSessionId: 'locusSessionId',
|
|
1044
1031
|
locusStartTime: 'lastActive',
|
|
1045
1032
|
locusUrl: 'locus/url',
|
|
1046
1033
|
mediaAgentAlias: 'alias',
|
|
@@ -1068,7 +1055,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1068
1055
|
correlationId: 'correlationId',
|
|
1069
1056
|
deviceId: 'deviceUrl',
|
|
1070
1057
|
locusId: 'url',
|
|
1071
|
-
locusSessionId: 'locusSessionId',
|
|
1072
1058
|
locusStartTime: 'lastActive',
|
|
1073
1059
|
locusUrl: 'locus/url',
|
|
1074
1060
|
mediaAgentAlias: 'alias',
|
|
@@ -1107,7 +1093,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1107
1093
|
correlationId: 'correlationId',
|
|
1108
1094
|
deviceId: 'deviceUrl',
|
|
1109
1095
|
locusId: 'url',
|
|
1110
|
-
locusSessionId: 'locusSessionId',
|
|
1111
1096
|
locusStartTime: 'lastActive',
|
|
1112
1097
|
locusUrl: 'locus/url',
|
|
1113
1098
|
mediaAgentAlias: 'alias',
|
|
@@ -1183,7 +1168,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1183
1168
|
sessionCorrelationId: 'sessionCorrelationId3',
|
|
1184
1169
|
deviceId: 'deviceUrl',
|
|
1185
1170
|
locusId: 'url',
|
|
1186
|
-
locusSessionId: 'locusSessionId',
|
|
1187
1171
|
locusStartTime: 'lastActive',
|
|
1188
1172
|
locusUrl: 'locus/url',
|
|
1189
1173
|
mediaAgentAlias: 'alias',
|
|
@@ -1212,7 +1196,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1212
1196
|
sessionCorrelationId: 'sessionCorrelationId3',
|
|
1213
1197
|
deviceId: 'deviceUrl',
|
|
1214
1198
|
locusId: 'url',
|
|
1215
|
-
locusSessionId: 'locusSessionId',
|
|
1216
1199
|
locusStartTime: 'lastActive',
|
|
1217
1200
|
locusUrl: 'locus/url',
|
|
1218
1201
|
mediaAgentAlias: 'alias',
|
|
@@ -1252,7 +1235,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1252
1235
|
sessionCorrelationId: 'sessionCorrelationId3',
|
|
1253
1236
|
deviceId: 'deviceUrl',
|
|
1254
1237
|
locusId: 'url',
|
|
1255
|
-
locusSessionId: 'locusSessionId',
|
|
1256
1238
|
locusStartTime: 'lastActive',
|
|
1257
1239
|
locusUrl: 'locus/url',
|
|
1258
1240
|
mediaAgentAlias: 'alias',
|
|
@@ -1327,7 +1309,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1327
1309
|
correlationId: 'correlationId',
|
|
1328
1310
|
deviceId: 'deviceUrl',
|
|
1329
1311
|
locusId: 'url',
|
|
1330
|
-
locusSessionId: 'locusSessionId',
|
|
1331
1312
|
locusStartTime: 'lastActive',
|
|
1332
1313
|
locusUrl: 'locus/url',
|
|
1333
1314
|
mediaAgentAlias: 'alias',
|
|
@@ -1356,7 +1337,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1356
1337
|
correlationId: 'correlationId',
|
|
1357
1338
|
deviceId: 'deviceUrl',
|
|
1358
1339
|
locusId: 'url',
|
|
1359
|
-
locusSessionId: 'locusSessionId',
|
|
1360
1340
|
locusStartTime: 'lastActive',
|
|
1361
1341
|
locusUrl: 'locus/url',
|
|
1362
1342
|
mediaAgentAlias: 'alias',
|
|
@@ -1396,7 +1376,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1396
1376
|
correlationId: 'correlationId',
|
|
1397
1377
|
deviceId: 'deviceUrl',
|
|
1398
1378
|
locusId: 'url',
|
|
1399
|
-
locusSessionId: 'locusSessionId',
|
|
1400
1379
|
locusStartTime: 'lastActive',
|
|
1401
1380
|
locusUrl: 'locus/url',
|
|
1402
1381
|
mediaAgentAlias: 'alias',
|
|
@@ -1471,7 +1450,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1471
1450
|
sessionCorrelationId: 'sessionCorrelationId5',
|
|
1472
1451
|
deviceId: 'deviceUrl',
|
|
1473
1452
|
locusId: 'url',
|
|
1474
|
-
locusSessionId: 'locusSessionId',
|
|
1475
1453
|
locusStartTime: 'lastActive',
|
|
1476
1454
|
locusUrl: 'locus/url',
|
|
1477
1455
|
mediaAgentAlias: 'alias',
|
|
@@ -1502,7 +1480,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1502
1480
|
sessionCorrelationId: 'sessionCorrelationId5',
|
|
1503
1481
|
deviceId: 'deviceUrl',
|
|
1504
1482
|
locusId: 'url',
|
|
1505
|
-
locusSessionId: 'locusSessionId',
|
|
1506
1483
|
locusStartTime: 'lastActive',
|
|
1507
1484
|
locusUrl: 'locus/url',
|
|
1508
1485
|
mediaAgentAlias: 'alias',
|
|
@@ -1544,7 +1521,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1544
1521
|
sessionCorrelationId: 'sessionCorrelationId5',
|
|
1545
1522
|
deviceId: 'deviceUrl',
|
|
1546
1523
|
locusId: 'url',
|
|
1547
|
-
locusSessionId: 'locusSessionId',
|
|
1548
1524
|
locusStartTime: 'lastActive',
|
|
1549
1525
|
locusUrl: 'locus/url',
|
|
1550
1526
|
mediaAgentAlias: 'alias',
|
|
@@ -1935,7 +1911,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1935
1911
|
correlationId: 'correlationId2',
|
|
1936
1912
|
deviceId: 'deviceUrl',
|
|
1937
1913
|
locusId: 'url',
|
|
1938
|
-
locusSessionId: 'locusSessionId',
|
|
1939
1914
|
locusStartTime: 'lastActive',
|
|
1940
1915
|
locusUrl: 'locus/url',
|
|
1941
1916
|
mediaAgentAlias: 'alias',
|
|
@@ -1990,7 +1965,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
1990
1965
|
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1991
1966
|
deviceId: 'deviceUrl',
|
|
1992
1967
|
locusId: 'url',
|
|
1993
|
-
locusSessionId: 'locusSessionId',
|
|
1994
1968
|
locusStartTime: 'lastActive',
|
|
1995
1969
|
locusUrl: 'locus/url',
|
|
1996
1970
|
mediaAgentAlias: 'alias',
|
|
@@ -2132,7 +2106,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2132
2106
|
globalMeetingId: 'globalMeetingId1',
|
|
2133
2107
|
deviceId: 'deviceUrl',
|
|
2134
2108
|
locusId: 'url',
|
|
2135
|
-
locusSessionId: 'locusSessionId',
|
|
2136
2109
|
locusStartTime: 'lastActive',
|
|
2137
2110
|
locusUrl: 'locus/url',
|
|
2138
2111
|
mediaAgentAlias: 'alias',
|
|
@@ -2211,7 +2184,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2211
2184
|
correlationId: 'correlationId',
|
|
2212
2185
|
deviceId: 'deviceUrl',
|
|
2213
2186
|
locusId: 'url',
|
|
2214
|
-
locusSessionId: 'locusSessionId',
|
|
2215
2187
|
locusStartTime: 'lastActive',
|
|
2216
2188
|
locusUrl: 'locus/url',
|
|
2217
2189
|
mediaAgentAlias: 'alias',
|
|
@@ -2451,7 +2423,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2451
2423
|
correlationId: 'correlationId',
|
|
2452
2424
|
deviceId: 'deviceUrl',
|
|
2453
2425
|
locusId: 'url',
|
|
2454
|
-
locusSessionId: 'locusSessionId',
|
|
2455
2426
|
locusStartTime: 'lastActive',
|
|
2456
2427
|
locusUrl: 'locus/url',
|
|
2457
2428
|
mediaAgentAlias: 'alias',
|
|
@@ -2813,7 +2784,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2813
2784
|
orgId: 'orgId',
|
|
2814
2785
|
locusUrl: 'locus/url',
|
|
2815
2786
|
locusId: 'url',
|
|
2816
|
-
locusSessionId: 'locusSessionId',
|
|
2817
2787
|
locusStartTime: 'lastActive',
|
|
2818
2788
|
},
|
|
2819
2789
|
eventData: {webClientDomain: 'whatever'},
|
|
@@ -2853,7 +2823,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2853
2823
|
orgId: 'orgId',
|
|
2854
2824
|
locusUrl: 'locus/url',
|
|
2855
2825
|
locusId: 'url',
|
|
2856
|
-
locusSessionId: 'locusSessionId',
|
|
2857
2826
|
locusStartTime: 'lastActive',
|
|
2858
2827
|
},
|
|
2859
2828
|
eventData: {webClientDomain: 'whatever'},
|
|
@@ -2891,7 +2860,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
2891
2860
|
orgId: 'orgId',
|
|
2892
2861
|
locusUrl: 'locus/url',
|
|
2893
2862
|
locusId: 'url',
|
|
2894
|
-
locusSessionId: 'locusSessionId',
|
|
2895
2863
|
locusStartTime: 'lastActive',
|
|
2896
2864
|
},
|
|
2897
2865
|
eventData: {webClientDomain: 'whatever'},
|
|
@@ -3680,15 +3648,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
3680
3648
|
assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webcast');
|
|
3681
3649
|
});
|
|
3682
3650
|
|
|
3683
|
-
it('returns subServicetype as LargeScaleWebinar when meeting is converged Webinar and enable large scale', () => {
|
|
3684
|
-
fakeMeeting.meetingInfo = {
|
|
3685
|
-
enableEvent: true,
|
|
3686
|
-
enableConvergedArchitecture: true,
|
|
3687
|
-
enableConvergedWebinarLargeScale: true,
|
|
3688
|
-
};
|
|
3689
|
-
assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'LargeScaleWebinar');
|
|
3690
|
-
});
|
|
3691
|
-
|
|
3692
3651
|
it('returns subServicetype as undefined when correct parameters are not found', () => {
|
|
3693
3652
|
fakeMeeting.meetingInfo = {};
|
|
3694
3653
|
assert.deepEqual(cd.getSubServiceType(fakeMeeting), undefined);
|
|
@@ -3742,7 +3701,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
3742
3701
|
correlationId: 'correlationId',
|
|
3743
3702
|
deviceId: 'deviceUrl',
|
|
3744
3703
|
locusId: 'url',
|
|
3745
|
-
locusSessionId: 'locusSessionId',
|
|
3746
3704
|
locusStartTime: 'lastActive',
|
|
3747
3705
|
locusUrl: 'locus/url',
|
|
3748
3706
|
orgId: 'orgId',
|
|
@@ -4146,7 +4104,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
4146
4104
|
orgId: 'orgId',
|
|
4147
4105
|
locusUrl: 'locus/url',
|
|
4148
4106
|
locusId: 'url',
|
|
4149
|
-
locusSessionId: 'locusSessionId',
|
|
4150
4107
|
locusStartTime: 'lastActive',
|
|
4151
4108
|
},
|
|
4152
4109
|
eventData: { webClientDomain: 'whatever'},
|
|
@@ -4184,7 +4141,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
4184
4141
|
locusId: 'url',
|
|
4185
4142
|
locusStartTime: 'lastActive',
|
|
4186
4143
|
locusUrl: 'locus/url',
|
|
4187
|
-
locusSessionId: 'locusSessionId',
|
|
4188
4144
|
orgId: 'orgId',
|
|
4189
4145
|
userId: 'userId',
|
|
4190
4146
|
},
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
ICE_AND_REACHABILITY_FAILED_CLIENT_CODE,
|
|
11
11
|
ICE_FAILED_WITH_TURN_TLS_CLIENT_CODE,
|
|
12
12
|
MISSING_ROAP_ANSWER_CLIENT_CODE,
|
|
13
|
-
BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP,
|
|
14
13
|
} from '../../../../src/call-diagnostic/config';
|
|
15
14
|
import Logger from '@webex/plugin-logger';
|
|
16
15
|
|
|
@@ -27,7 +26,6 @@ const {
|
|
|
27
26
|
isUnauthorizedError,
|
|
28
27
|
generateClientErrorCodeForIceFailure,
|
|
29
28
|
isSdpOfferCreationError,
|
|
30
|
-
isWebrtcApiNotAvailableError,
|
|
31
29
|
} = CallDiagnosticUtils;
|
|
32
30
|
|
|
33
31
|
describe('internal-plugin-metrics', () => {
|
|
@@ -207,29 +205,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
207
205
|
});
|
|
208
206
|
});
|
|
209
207
|
|
|
210
|
-
describe('isWebrtcApiNotAvailableError', () => {
|
|
211
|
-
type TestWebrtcApiNotAvailableError = {
|
|
212
|
-
code: number;
|
|
213
|
-
message: string;
|
|
214
|
-
name: string;
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
const error: TestWebrtcApiNotAvailableError = {
|
|
218
|
-
code: 30007,
|
|
219
|
-
name: 'WebrtcApiNotAvailableError',
|
|
220
|
-
message: 'RTCPeerConnection API is not available in this environment',
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
[
|
|
224
|
-
['WebrtcApiNotAvailableError', error, true],
|
|
225
|
-
['generic error', new Error('this is an error'), false],
|
|
226
|
-
].forEach(([errorType, rawError, expected]) => {
|
|
227
|
-
it(`for ${errorType} rawError returns the correct result`, () => {
|
|
228
|
-
assert.strictEqual(isWebrtcApiNotAvailableError(rawError), expected);
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
|
|
233
208
|
describe('isBrowserMediaErrorName', () => {
|
|
234
209
|
[
|
|
235
210
|
['PermissionDeniedError', true],
|
|
@@ -311,7 +286,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
311
286
|
origin: {
|
|
312
287
|
buildType: 'prod',
|
|
313
288
|
networkType: 'unknown',
|
|
314
|
-
upgradeChannel: expectedUpgradeChannel
|
|
289
|
+
upgradeChannel: expectedUpgradeChannel
|
|
315
290
|
},
|
|
316
291
|
event: {name: eventName, ...expectedEvent},
|
|
317
292
|
},
|
|
@@ -393,7 +368,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
393
368
|
totalJmt: undefined,
|
|
394
369
|
clientJmt: undefined,
|
|
395
370
|
downloadTime: undefined,
|
|
396
|
-
clickToInterstitialWithUserDelay:
|
|
371
|
+
clickToInterstitialWithUserDelay: undefined,
|
|
397
372
|
totalJMTWithUserDelay: undefined,
|
|
398
373
|
},
|
|
399
374
|
},
|
|
@@ -430,6 +405,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
430
405
|
totalMediaJMT: undefined,
|
|
431
406
|
interstitialToMediaOKJMT: undefined,
|
|
432
407
|
callInitMediaEngineReady: undefined,
|
|
408
|
+
stayLobbyTime: undefined,
|
|
433
409
|
totalMediaJMTWithUserDelay: undefined,
|
|
434
410
|
totalJMTWithUserDelay: undefined,
|
|
435
411
|
},
|
|
@@ -446,14 +422,6 @@ describe('internal-plugin-metrics', () => {
|
|
|
446
422
|
},
|
|
447
423
|
},
|
|
448
424
|
],
|
|
449
|
-
[
|
|
450
|
-
'client.lobby.exited',
|
|
451
|
-
{
|
|
452
|
-
joinTimes: {
|
|
453
|
-
stayLobbyTime: undefined,
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
],
|
|
457
425
|
].forEach(([eventName, expectedEvent]) => {
|
|
458
426
|
it(`returns expected result for ${eventName}`, () => {
|
|
459
427
|
check(eventName as string, expectedEvent, 'gold');
|
|
@@ -717,34 +685,4 @@ describe('internal-plugin-metrics', () => {
|
|
|
717
685
|
});
|
|
718
686
|
});
|
|
719
687
|
});
|
|
720
|
-
|
|
721
|
-
describe('isBrowserMediaError', () => {
|
|
722
|
-
it('should return true if error name is in BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP', () => {
|
|
723
|
-
// Use a known browser media error name from the config map
|
|
724
|
-
const errorName = Object.keys(BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP)[0];
|
|
725
|
-
const error = {name: errorName};
|
|
726
|
-
assert.isTrue(CallDiagnosticUtils.isBrowserMediaError(error));
|
|
727
|
-
});
|
|
728
|
-
|
|
729
|
-
it('should return false if error name is not in BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP', () => {
|
|
730
|
-
const error = {name: 'SomeOtherError'};
|
|
731
|
-
assert.isFalse(CallDiagnosticUtils.isBrowserMediaError(error));
|
|
732
|
-
});
|
|
733
|
-
});
|
|
734
|
-
|
|
735
|
-
describe('getBrowserMediaErrorCode', () => {
|
|
736
|
-
it('should return correct error code for known error name', () => {
|
|
737
|
-
const errorName = Object.keys(BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP)[0];
|
|
738
|
-
const error = {name: errorName};
|
|
739
|
-
assert.strictEqual(
|
|
740
|
-
CallDiagnosticUtils.getBrowserMediaErrorCode(error),
|
|
741
|
-
BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP[errorName]
|
|
742
|
-
);
|
|
743
|
-
});
|
|
744
|
-
|
|
745
|
-
it('should return undefined for unknown error name', () => {
|
|
746
|
-
const error = {name: 'UnknownError'};
|
|
747
|
-
assert.isUndefined(CallDiagnosticUtils.getBrowserMediaErrorCode(error));
|
|
748
|
-
});
|
|
749
|
-
});
|
|
750
688
|
});
|
package/dist/prelogin-metrics.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
|
4
|
-
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
5
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
6
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
7
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
8
|
-
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
9
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
10
|
-
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
11
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
12
|
-
value: true
|
|
13
|
-
});
|
|
14
|
-
exports.default = void 0;
|
|
15
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
17
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
|
18
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
19
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
20
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
21
|
-
var _genericMetrics = _interopRequireDefault(require("./generic-metrics"));
|
|
22
|
-
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
25
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
-
/**
|
|
27
|
-
* @description Util class to handle PreLogin Metrics
|
|
28
|
-
* @export
|
|
29
|
-
* @class PreLoginMetrics
|
|
30
|
-
*/
|
|
31
|
-
var PreLoginMetrics = exports.default = /*#__PURE__*/function (_GenericMetrics) {
|
|
32
|
-
/**
|
|
33
|
-
* Constructor
|
|
34
|
-
* @param {PreLoginMetricsBatcher} preLoginMetricsBatcher - Pre-login metrics batcher
|
|
35
|
-
* @param {any} attrs - Attributes
|
|
36
|
-
* @param {any} options - Options
|
|
37
|
-
* @constructor
|
|
38
|
-
*/
|
|
39
|
-
function PreLoginMetrics(preLoginMetricsBatcher) {
|
|
40
|
-
var _this;
|
|
41
|
-
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
42
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
43
|
-
(0, _classCallCheck2.default)(this, PreLoginMetrics);
|
|
44
|
-
_this = _callSuper(this, PreLoginMetrics, [attrs, options]);
|
|
45
|
-
(0, _defineProperty2.default)(_this, "preLoginMetricsBatcher", void 0);
|
|
46
|
-
_this.preLoginMetricsBatcher = preLoginMetricsBatcher;
|
|
47
|
-
return _this;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Submit a business metric to our metrics endpoint.
|
|
52
|
-
* Routes to the correct table with the correct schema payload by table.
|
|
53
|
-
* @see https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Business+metrics++-%3E+ROMA
|
|
54
|
-
* @param {Object} options - The options object
|
|
55
|
-
* @param {string} options.name - Name of the metric
|
|
56
|
-
* @param {string} options.preLoginId - ID to identify pre-login user
|
|
57
|
-
* @param {EventPayload} options.payload - User payload of the metric
|
|
58
|
-
* @param {EventPayload} [options.metadata] - Optional metadata to include outside of eventPayload.value
|
|
59
|
-
* @returns {Promise<void>} Promise that resolves when the metric is submitted
|
|
60
|
-
*/
|
|
61
|
-
(0, _inherits2.default)(PreLoginMetrics, _GenericMetrics);
|
|
62
|
-
return (0, _createClass2.default)(PreLoginMetrics, [{
|
|
63
|
-
key: "submitPreLoginEvent",
|
|
64
|
-
value: function submitPreLoginEvent(_ref) {
|
|
65
|
-
var name = _ref.name,
|
|
66
|
-
preLoginId = _ref.preLoginId,
|
|
67
|
-
payload = _ref.payload,
|
|
68
|
-
metadata = _ref.metadata;
|
|
69
|
-
if (!metadata) {
|
|
70
|
-
metadata = {};
|
|
71
|
-
}
|
|
72
|
-
if (!metadata.appType) {
|
|
73
|
-
metadata.appType = 'Web Client';
|
|
74
|
-
}
|
|
75
|
-
var finalEvent = this.buildEvent(name, preLoginId, payload, metadata);
|
|
76
|
-
this.preLoginMetricsBatcher.savePreLoginId(preLoginId);
|
|
77
|
-
return this.preLoginMetricsBatcher.request(finalEvent);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Builds a formatted event object for metrics submission.
|
|
82
|
-
* @param {string} metricName - Metric name
|
|
83
|
-
* @param {string} preLoginId - Pre-login user identifier
|
|
84
|
-
* @param {EventPayload} payload - Metric payload data
|
|
85
|
-
* @param {EventPayload} metadata - Additional metadata to include in the event
|
|
86
|
-
* @returns {object} Formatted metrics event object with type, eventPayload, and timestamp
|
|
87
|
-
*/
|
|
88
|
-
}, {
|
|
89
|
-
key: "buildEvent",
|
|
90
|
-
value: function buildEvent(metricName, preLoginId, payload, metadata) {
|
|
91
|
-
return {
|
|
92
|
-
type: ['business'],
|
|
93
|
-
eventPayload: {
|
|
94
|
-
metricName: metricName,
|
|
95
|
-
browserDetails: this.getBrowserDetails(),
|
|
96
|
-
context: this.getContext(),
|
|
97
|
-
timestamp: new Date().getTime(),
|
|
98
|
-
value: _objectSpread(_objectSpread({
|
|
99
|
-
preLoginId: preLoginId
|
|
100
|
-
}, metadata), payload)
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}]);
|
|
105
|
-
}(_genericMetrics.default);
|
|
106
|
-
//# sourceMappingURL=prelogin-metrics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_genericMetrics","_interopRequireDefault","require","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","Boolean","prototype","valueOf","call","PreLoginMetrics","exports","_GenericMetrics","preLoginMetricsBatcher","_this","attrs","undefined","options","_classCallCheck2","_inherits2","_createClass2","key","value","submitPreLoginEvent","_ref","name","preLoginId","payload","metadata","appType","finalEvent","buildEvent","savePreLoginId","request","metricName","type","eventPayload","browserDetails","getBrowserDetails","context","getContext","timestamp","Date","getTime","GenericMetrics"],"sources":["prelogin-metrics.ts"],"sourcesContent":["import GenericMetrics from './generic-metrics';\nimport {BusinessEvent, EventPayload} from './metrics.types';\nimport PreLoginMetricsBatcher from './prelogin-metrics-batcher';\n\n/**\n * @description Util class to handle PreLogin Metrics\n * @export\n * @class PreLoginMetrics\n */\nexport default class PreLoginMetrics extends GenericMetrics {\n private preLoginMetricsBatcher: typeof PreLoginMetricsBatcher;\n\n /**\n * Constructor\n * @param {PreLoginMetricsBatcher} preLoginMetricsBatcher - Pre-login metrics batcher\n * @param {any} attrs - Attributes\n * @param {any} options - Options\n * @constructor\n */\n constructor(\n preLoginMetricsBatcher: typeof PreLoginMetricsBatcher,\n attrs: any = {},\n options: {parent?: any} = {}\n ) {\n super(attrs, options);\n this.preLoginMetricsBatcher = preLoginMetricsBatcher;\n }\n\n /**\n * Submit a business metric to our metrics endpoint.\n * Routes to the correct table with the correct schema payload by table.\n * @see https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Business+metrics++-%3E+ROMA\n * @param {Object} options - The options object\n * @param {string} options.name - Name of the metric\n * @param {string} options.preLoginId - ID to identify pre-login user\n * @param {EventPayload} options.payload - User payload of the metric\n * @param {EventPayload} [options.metadata] - Optional metadata to include outside of eventPayload.value\n * @returns {Promise<void>} Promise that resolves when the metric is submitted\n */\n public submitPreLoginEvent({\n name,\n preLoginId,\n payload,\n metadata,\n }: {\n name: string;\n preLoginId: string;\n payload: EventPayload;\n metadata?: EventPayload;\n }): Promise<void> {\n if (!metadata) {\n metadata = {};\n }\n if (!metadata.appType) {\n metadata.appType = 'Web Client';\n }\n\n const finalEvent = this.buildEvent(name, preLoginId, payload, metadata);\n\n this.preLoginMetricsBatcher.savePreLoginId(preLoginId);\n\n return this.preLoginMetricsBatcher.request(finalEvent);\n }\n\n /**\n * Builds a formatted event object for metrics submission.\n * @param {string} metricName - Metric name\n * @param {string} preLoginId - Pre-login user identifier\n * @param {EventPayload} payload - Metric payload data\n * @param {EventPayload} metadata - Additional metadata to include in the event\n * @returns {object} Formatted metrics event object with type, eventPayload, and timestamp\n */\n private buildEvent(\n metricName: string,\n preLoginId: string,\n payload: EventPayload,\n metadata: EventPayload\n ): BusinessEvent {\n return {\n type: ['business'],\n eventPayload: {\n metricName,\n browserDetails: this.getBrowserDetails(),\n context: this.getContext(),\n timestamp: new Date().getTime(),\n value: {\n preLoginId,\n ...metadata,\n ...payload,\n },\n },\n };\n }\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import GenericMetrics from './generic-metrics';
|
|
2
|
-
import { EventPayload } from './metrics.types';
|
|
3
|
-
import PreLoginMetricsBatcher from './prelogin-metrics-batcher';
|
|
4
|
-
/**
|
|
5
|
-
* @description Util class to handle PreLogin Metrics
|
|
6
|
-
* @export
|
|
7
|
-
* @class PreLoginMetrics
|
|
8
|
-
*/
|
|
9
|
-
export default class PreLoginMetrics extends GenericMetrics {
|
|
10
|
-
private preLoginMetricsBatcher;
|
|
11
|
-
/**
|
|
12
|
-
* Constructor
|
|
13
|
-
* @param {PreLoginMetricsBatcher} preLoginMetricsBatcher - Pre-login metrics batcher
|
|
14
|
-
* @param {any} attrs - Attributes
|
|
15
|
-
* @param {any} options - Options
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
|
-
constructor(preLoginMetricsBatcher: typeof PreLoginMetricsBatcher, attrs?: any, options?: {
|
|
19
|
-
parent?: any;
|
|
20
|
-
});
|
|
21
|
-
/**
|
|
22
|
-
* Submit a business metric to our metrics endpoint.
|
|
23
|
-
* Routes to the correct table with the correct schema payload by table.
|
|
24
|
-
* @see https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Business+metrics++-%3E+ROMA
|
|
25
|
-
* @param {Object} options - The options object
|
|
26
|
-
* @param {string} options.name - Name of the metric
|
|
27
|
-
* @param {string} options.preLoginId - ID to identify pre-login user
|
|
28
|
-
* @param {EventPayload} options.payload - User payload of the metric
|
|
29
|
-
* @param {EventPayload} [options.metadata] - Optional metadata to include outside of eventPayload.value
|
|
30
|
-
* @returns {Promise<void>} Promise that resolves when the metric is submitted
|
|
31
|
-
*/
|
|
32
|
-
submitPreLoginEvent({ name, preLoginId, payload, metadata, }: {
|
|
33
|
-
name: string;
|
|
34
|
-
preLoginId: string;
|
|
35
|
-
payload: EventPayload;
|
|
36
|
-
metadata?: EventPayload;
|
|
37
|
-
}): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Builds a formatted event object for metrics submission.
|
|
40
|
-
* @param {string} metricName - Metric name
|
|
41
|
-
* @param {string} preLoginId - Pre-login user identifier
|
|
42
|
-
* @param {EventPayload} payload - Metric payload data
|
|
43
|
-
* @param {EventPayload} metadata - Additional metadata to include in the event
|
|
44
|
-
* @returns {object} Formatted metrics event object with type, eventPayload, and timestamp
|
|
45
|
-
*/
|
|
46
|
-
private buildEvent;
|
|
47
|
-
}
|
package/src/prelogin-metrics.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import GenericMetrics from './generic-metrics';
|
|
2
|
-
import {BusinessEvent, EventPayload} from './metrics.types';
|
|
3
|
-
import PreLoginMetricsBatcher from './prelogin-metrics-batcher';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @description Util class to handle PreLogin Metrics
|
|
7
|
-
* @export
|
|
8
|
-
* @class PreLoginMetrics
|
|
9
|
-
*/
|
|
10
|
-
export default class PreLoginMetrics extends GenericMetrics {
|
|
11
|
-
private preLoginMetricsBatcher: typeof PreLoginMetricsBatcher;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Constructor
|
|
15
|
-
* @param {PreLoginMetricsBatcher} preLoginMetricsBatcher - Pre-login metrics batcher
|
|
16
|
-
* @param {any} attrs - Attributes
|
|
17
|
-
* @param {any} options - Options
|
|
18
|
-
* @constructor
|
|
19
|
-
*/
|
|
20
|
-
constructor(
|
|
21
|
-
preLoginMetricsBatcher: typeof PreLoginMetricsBatcher,
|
|
22
|
-
attrs: any = {},
|
|
23
|
-
options: {parent?: any} = {}
|
|
24
|
-
) {
|
|
25
|
-
super(attrs, options);
|
|
26
|
-
this.preLoginMetricsBatcher = preLoginMetricsBatcher;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Submit a business metric to our metrics endpoint.
|
|
31
|
-
* Routes to the correct table with the correct schema payload by table.
|
|
32
|
-
* @see https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Business+metrics++-%3E+ROMA
|
|
33
|
-
* @param {Object} options - The options object
|
|
34
|
-
* @param {string} options.name - Name of the metric
|
|
35
|
-
* @param {string} options.preLoginId - ID to identify pre-login user
|
|
36
|
-
* @param {EventPayload} options.payload - User payload of the metric
|
|
37
|
-
* @param {EventPayload} [options.metadata] - Optional metadata to include outside of eventPayload.value
|
|
38
|
-
* @returns {Promise<void>} Promise that resolves when the metric is submitted
|
|
39
|
-
*/
|
|
40
|
-
public submitPreLoginEvent({
|
|
41
|
-
name,
|
|
42
|
-
preLoginId,
|
|
43
|
-
payload,
|
|
44
|
-
metadata,
|
|
45
|
-
}: {
|
|
46
|
-
name: string;
|
|
47
|
-
preLoginId: string;
|
|
48
|
-
payload: EventPayload;
|
|
49
|
-
metadata?: EventPayload;
|
|
50
|
-
}): Promise<void> {
|
|
51
|
-
if (!metadata) {
|
|
52
|
-
metadata = {};
|
|
53
|
-
}
|
|
54
|
-
if (!metadata.appType) {
|
|
55
|
-
metadata.appType = 'Web Client';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const finalEvent = this.buildEvent(name, preLoginId, payload, metadata);
|
|
59
|
-
|
|
60
|
-
this.preLoginMetricsBatcher.savePreLoginId(preLoginId);
|
|
61
|
-
|
|
62
|
-
return this.preLoginMetricsBatcher.request(finalEvent);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Builds a formatted event object for metrics submission.
|
|
67
|
-
* @param {string} metricName - Metric name
|
|
68
|
-
* @param {string} preLoginId - Pre-login user identifier
|
|
69
|
-
* @param {EventPayload} payload - Metric payload data
|
|
70
|
-
* @param {EventPayload} metadata - Additional metadata to include in the event
|
|
71
|
-
* @returns {object} Formatted metrics event object with type, eventPayload, and timestamp
|
|
72
|
-
*/
|
|
73
|
-
private buildEvent(
|
|
74
|
-
metricName: string,
|
|
75
|
-
preLoginId: string,
|
|
76
|
-
payload: EventPayload,
|
|
77
|
-
metadata: EventPayload
|
|
78
|
-
): BusinessEvent {
|
|
79
|
-
return {
|
|
80
|
-
type: ['business'],
|
|
81
|
-
eventPayload: {
|
|
82
|
-
metricName,
|
|
83
|
-
browserDetails: this.getBrowserDetails(),
|
|
84
|
-
context: this.getContext(),
|
|
85
|
-
timestamp: new Date().getTime(),
|
|
86
|
-
value: {
|
|
87
|
-
preLoginId,
|
|
88
|
-
...metadata,
|
|
89
|
-
...payload,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|