send clsi response codes to graphite

This commit is contained in:
Henry Oswald 2018-07-30 18:16:52 +01:00
parent 3cf060dbac
commit b04c7d2ffe

View file

@ -100,6 +100,7 @@ module.exports = ClsiManager =
timer = new Metrics.Timer("compile.currentBackend") timer = new Metrics.Timer("compile.currentBackend")
request opts, (err, response, body)-> request opts, (err, response, body)->
timer.done() timer.done()
metrics.inc "compile.currentBackend.response.#{response.statusCode}"
if err? if err?
logger.err err:err, project_id:project_id, url:opts?.url, "error making request to clsi" logger.err err:err, project_id:project_id, url:opts?.url, "error making request to clsi"
return callback(err) return callback(err)
@ -111,6 +112,7 @@ module.exports = ClsiManager =
newBackend: (cb)-> newBackend: (cb)->
startTime = new Date() startTime = new Date()
ClsiManager._makeNewBackendRequest project_id, opts, (err, response, body)-> ClsiManager._makeNewBackendRequest project_id, opts, (err, response, body)->
metrics.inc "compile.newBackend.response.#{response.statusCode}"
cb(err, {response:response, body:body, finishTime:new Date() - startTime}) cb(err, {response:response, body:body, finishTime:new Date() - startTime})
}, (err, results)-> }, (err, results)->
timeDifference = results.newBackend?.finishTime - results.currentBackend?.finishTime timeDifference = results.newBackend?.finishTime - results.currentBackend?.finishTime