mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-03 11:31:45 +00:00
add missing argument to metrics.inc
also track retries rather than attempts (which is always 1 for a successful request)
This commit is contained in:
parent
3caa0e7c05
commit
7036803acf
2 changed files with 13 additions and 13 deletions
|
@ -21,11 +21,11 @@ updateMetric = (method, error, response) ->
|
||||||
error.code
|
error.code
|
||||||
else if response?
|
else if response?
|
||||||
response.statusCode
|
response.statusCode
|
||||||
Metrics.inc method, {status: status}
|
Metrics.inc method, 1, {status: status}
|
||||||
if error?.attempts > 0
|
if error?.attempts > 1
|
||||||
Metrics.inc "#{method}-attempts", {status: 'error'}
|
Metrics.inc "#{method}-retries", 1, {status: 'error'}
|
||||||
if response?.attempts > 0
|
if response?.attempts > 1
|
||||||
Metrics.inc "#{method}-attempts", {status: 'success'}
|
Metrics.inc "#{method}-retries", 1, {status: 'success'}
|
||||||
|
|
||||||
module.exports = PersistenceManager =
|
module.exports = PersistenceManager =
|
||||||
getDoc: (project_id, doc_id, _callback = (error, lines, version, ranges, pathname, projectHistoryId, projectHistoryType) ->) ->
|
getDoc: (project_id, doc_id, _callback = (error, lines, version, ranges, pathname, projectHistoryId, projectHistoryType) ->) ->
|
||||||
|
|
|
@ -73,7 +73,7 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("getDoc", {status: 200}).should.equal true
|
@Metrics.inc.calledWith("getDoc", 1, {status: 200}).should.equal true
|
||||||
|
|
||||||
describe "when request returns an error", ->
|
describe "when request returns an error", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -89,7 +89,7 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("getDoc", {status: "EOOPS"}).should.equal true
|
@Metrics.inc.calledWith("getDoc", 1, {status: "EOOPS"}).should.equal true
|
||||||
|
|
||||||
describe "when the request returns 404", ->
|
describe "when the request returns 404", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -103,7 +103,7 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("getDoc", {status: 404}).should.equal true
|
@Metrics.inc.calledWith("getDoc", 1, {status: 404}).should.equal true
|
||||||
|
|
||||||
describe "when the request returns an error status code", ->
|
describe "when the request returns an error status code", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -117,7 +117,7 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("getDoc", {status: 500}).should.equal true
|
@Metrics.inc.calledWith("getDoc", 1, {status: 500}).should.equal true
|
||||||
|
|
||||||
describe "when request returns an doc without lines", ->
|
describe "when request returns an doc without lines", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -179,7 +179,7 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("setDoc", {status: 200}).should.equal true
|
@Metrics.inc.calledWith("setDoc", 1, {status: 200}).should.equal true
|
||||||
|
|
||||||
describe "when request returns an error", ->
|
describe "when request returns an error", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -195,7 +195,7 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("setDoc", {status: "EOOPS"}).should.equal true
|
@Metrics.inc.calledWith("setDoc", 1, {status: "EOOPS"}).should.equal true
|
||||||
|
|
||||||
describe "when the request returns 404", ->
|
describe "when the request returns 404", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -209,7 +209,7 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("setDoc", {status: 404}).should.equal true
|
@Metrics.inc.calledWith("setDoc", 1, {status: 404}).should.equal true
|
||||||
|
|
||||||
describe "when the request returns an error status code", ->
|
describe "when the request returns an error status code", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -223,4 +223,4 @@ describe "PersistenceManager", ->
|
||||||
@Metrics.Timer::done.called.should.equal true
|
@Metrics.Timer::done.called.should.equal true
|
||||||
|
|
||||||
it "should increment the metric", ->
|
it "should increment the metric", ->
|
||||||
@Metrics.inc.calledWith("setDoc", {status: 500}).should.equal true
|
@Metrics.inc.calledWith("setDoc", 1, {status: 500}).should.equal true
|
||||||
|
|
Loading…
Reference in a new issue