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

simplify metric for rate limits

GitOrigin-RevId: bba98c7e38846aedcfcf0781003f755e302f7759
This commit is contained in:
Brian Gough 2020-02-12 11:25:46 +00:00 committed by Copybot
parent 401ed57890
commit 80e9afe42c
2 changed files with 4 additions and 7 deletions

View file

@ -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
})
}

View file

@ -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()
}
)