fix metrics.this

This commit is contained in:
Henry Oswald 2018-11-21 08:50:33 +00:00
parent 5599521c09
commit cf920a86f7

View file

@ -56,14 +56,16 @@ module.exports = Metrics =
timing: (key, timeSpan, sampleRate)->
statsd.timing(buildKey(key), timeSpan, sampleRate)
if !promMetrics[this.key]
promMetrics[this.key] = new prom.Summary({
name: "#{name}_timer_#{this.key}".replace(/\./g,"_"),
if !promMetrics[key]
k = "#{name}_timer_#{key}".replace(/\./g,"_")
console.log("sending timing", k)
promMetrics[key] = new prom.Summary({
name: k,
help: key,
maxAgeSeconds: 600,
ageBuckets: 10
})
promMetrics[this.key].observe(timeSpan)
promMetrics[key].observe(timeSpan)
Timer : class
constructor :(key, sampleRate = 1)->