mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 12:13:43 -05:00
add status label to gauges
This commit is contained in:
parent
816c49daf2
commit
286eb747ad
2 changed files with 7 additions and 7 deletions
|
@ -135,27 +135,27 @@ module.exports = Metrics =
|
||||||
Metrics.timing(this.key, timeSpan, this.sampleRate, this.opts)
|
Metrics.timing(this.key, timeSpan, this.sampleRate, this.opts)
|
||||||
return timeSpan
|
return timeSpan
|
||||||
|
|
||||||
gauge : (key, value, sampleRate = 1)->
|
gauge : (key, value, sampleRate = 1, opts)->
|
||||||
key = Metrics.buildPromKey(key)
|
key = Metrics.buildPromKey(key)
|
||||||
if !promMetrics[key]?
|
if !promMetrics[key]?
|
||||||
promMetrics[key] = new prom.Gauge({
|
promMetrics[key] = new prom.Gauge({
|
||||||
name: key,
|
name: key,
|
||||||
help: key,
|
help: key,
|
||||||
labelNames: ['app','host']
|
labelNames: ['app','host', 'status']
|
||||||
})
|
})
|
||||||
promMetrics[key].set({app: appname, host: hostname}, this.sanitizeValue(value))
|
promMetrics[key].set({app: appname, host: hostname, status: opts?.status}, this.sanitizeValue(value))
|
||||||
if process.env['DEBUG_METRICS']
|
if process.env['DEBUG_METRICS']
|
||||||
console.log("doing gauge", key, opts)
|
console.log("doing gauge", key, opts)
|
||||||
|
|
||||||
globalGauge: (key, value, sampleRate = 1)->
|
globalGauge: (key, value, sampleRate = 1, opts)->
|
||||||
key = Metrics.buildPromKey(key)
|
key = Metrics.buildPromKey(key)
|
||||||
if !promMetrics[key]?
|
if !promMetrics[key]?
|
||||||
promMetrics[key] = new prom.Gauge({
|
promMetrics[key] = new prom.Gauge({
|
||||||
name: key,
|
name: key,
|
||||||
help: key,
|
help: key,
|
||||||
labelNames: ['app','host']
|
labelNames: ['app','host', 'status']
|
||||||
})
|
})
|
||||||
promMetrics[key].set({app: appname},this.sanitizeValue(value))
|
promMetrics[key].set({app: appname, status: opts?.status},this.sanitizeValue(value))
|
||||||
|
|
||||||
mongodb: require "./mongodb"
|
mongodb: require "./mongodb"
|
||||||
http: require "./http"
|
http: require "./http"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "metrics-sharelatex",
|
"name": "metrics-sharelatex",
|
||||||
"version": "2.1.2",
|
"version": "2.2.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",
|
||||||
|
|
Loading…
Reference in a new issue