Merge pull request #22 from overleaf/bg-allow-options-for-count

allow options for count
This commit is contained in:
Brian Gough 2019-12-16 10:37:02 +00:00 committed by GitHub
commit 38ad3c36f3
2 changed files with 5 additions and 3 deletions

View file

@ -83,9 +83,11 @@ module.exports = Metrics =
if process.env['DEBUG_METRICS'] if process.env['DEBUG_METRICS']
console.log("doing inc", key, opts) console.log("doing inc", key, opts)
count : (key, count, sampleRate = 1)-> count : (key, count, sampleRate = 1, opts = {})->
key = Metrics.buildPromKey(key) key = Metrics.buildPromKey(key)
prom.metric('counter', key).inc({app: appname, host: hostname}, count) opts.app = appname
opts.host = hostname
prom.metric('counter', key).inc(opts, count)
if process.env['DEBUG_METRICS'] if process.env['DEBUG_METRICS']
console.log("doing count/inc", key, opts) console.log("doing count/inc", key, opts)

View file

@ -1,6 +1,6 @@
{ {
"name": "metrics-sharelatex", "name": "metrics-sharelatex",
"version": "2.3.0", "version": "2.4.0",
"description": "A drop-in metrics and monitoring module for node.js apps", "description": "A drop-in metrics and monitoring module for node.js apps",
"repository": { "repository": {
"type": "git", "type": "git",