add count to prom

This commit is contained in:
Henry Oswald 2018-11-21 10:28:32 +00:00
parent d01ff95b46
commit f63b84983d

View file

@ -58,6 +58,14 @@ module.exports = Metrics =
count : (key, count, sampleRate = 1)->
statsd.count buildKey(key), count, sampleRate
key = Metrics.buildPromKey(key)
if !promMetrics[key]?
promMetrics[key] = new prom.Counter({
name: key,
help: key,
labelNames: ['name','host']
})
promMetrics[key].inc({name: name, host: hostname}, count)
timing: (key, timeSpan, sampleRate)->
statsd.timing(buildKey(key), timeSpan, sampleRate)