Explorar o código

Merge pull request #2586 from overleaf/bg-simplify-rate-limit-metrics

simplify metric for rate limits

GitOrigin-RevId: bba98c7e38846aedcfcf0781003f755e302f7759
Brian Gough %!s(int64=6) %!d(string=hai) anos
pai
achega
80e9afe42c

+ 1 - 1
services/web/app/src/infrastructure/RateLimiter.js

@@ -27,7 +27,7 @@ const RateLimiter = {
       }
       const allowed = timeLeft === 0
       if (!allowed) {
-        Metrics.inc(`rate-limit-hit.${opts.endpointName}`, 1, {
+        Metrics.inc('rate-limit-hit', 1, {
           path: opts.endpointName
         })
       }

+ 3 - 6
services/web/test/unit/src/infrastructure/RateLimterTests.js

@@ -132,12 +132,9 @@ describe('RateLimiter', function() {
       return this.limiter.addCount(
         { endpointName: this.endpointName },
         (err, should) => {
-          sinon.assert.calledWith(
-            this.Metrics.inc,
-            `rate-limit-hit.${this.endpointName}`,
-            1,
-            { path: this.endpointName }
-          )
+          sinon.assert.calledWith(this.Metrics.inc, `rate-limit-hit`, 1, {
+            path: this.endpointName
+          })
           return done()
         }
       )