File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ module.exports.getRequestParams = function getParams(req) {
31
31
// Custom dimension 2: Query params
32
32
cd2 : req . originalUrl . split ( '?' ) [ 1 ] ,
33
33
// Custom metric 1: RateLimit usage in percent
34
- cm1 : ( req . user . remaining / req . user . limit ) * 100 ,
34
+ cm1 : parseInt ( ( 100 - ( ( req . user . remaining / req . user . limit ) * 100 ) ) , 10 ) ,
35
35
} ;
36
36
37
37
if ( req . user . type === 'token' ) {
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ describe('Params', () => {
12
12
key : 'abc123' ,
13
13
provider : 'DNT' ,
14
14
app : 'UT.no' ,
15
- limit : 1000 ,
16
- remaining : 999 ,
15
+ limit : 500 ,
16
+ remaining : 450 ,
17
17
reset : 1487940909 ,
18
18
penalty : 1 ,
19
19
} ,
@@ -26,7 +26,7 @@ describe('Params', () => {
26
26
cg1 : 'turer' ,
27
27
cd1 : 'turer' ,
28
28
cd2 : 'limit=50' ,
29
- cm1 : 99.9 ,
29
+ cm1 : 10 ,
30
30
uid : 'DNT' ,
31
31
an : 'UT.no' ,
32
32
aid : undefined ,
You can’t perform that action at this time.
0 commit comments