mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 13:02:07 -05:00
consolodate on metrics.timing
This commit is contained in:
parent
7fc49d1eb5
commit
5599521c09
1 changed files with 9 additions and 9 deletions
|
@ -56,6 +56,14 @@ module.exports = Metrics =
|
||||||
|
|
||||||
timing: (key, timeSpan, sampleRate)->
|
timing: (key, timeSpan, sampleRate)->
|
||||||
statsd.timing(buildKey(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,"_"),
|
||||||
|
help: key,
|
||||||
|
maxAgeSeconds: 600,
|
||||||
|
ageBuckets: 10
|
||||||
|
})
|
||||||
|
promMetrics[this.key].observe(timeSpan)
|
||||||
|
|
||||||
Timer : class
|
Timer : class
|
||||||
constructor :(key, sampleRate = 1)->
|
constructor :(key, sampleRate = 1)->
|
||||||
|
@ -65,15 +73,7 @@ module.exports = Metrics =
|
||||||
|
|
||||||
done:->
|
done:->
|
||||||
timeSpan = new Date - this.start
|
timeSpan = new Date - this.start
|
||||||
statsd.timing(buildKey(this.key), timeSpan, this.sampleRate)
|
Metrics.timing(this.key, timeSpan, this.sampleRate)
|
||||||
if !promMetrics[this.key]
|
|
||||||
promMetrics[this.key] = new prom.Summary({
|
|
||||||
name: "#{name}_timer_#{this.key}".replace(/\./g,"_"),
|
|
||||||
help: this.key,
|
|
||||||
maxAgeSeconds: 600,
|
|
||||||
ageBuckets: 10
|
|
||||||
})
|
|
||||||
promMetrics[this.key].observe(timeSpan)
|
|
||||||
return timeSpan
|
return timeSpan
|
||||||
|
|
||||||
gauge : (key, value, sampleRate = 1)->
|
gauge : (key, value, sampleRate = 1)->
|
||||||
|
|
Loading…
Reference in a new issue