mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 04:52:16 +00:00
Ensure gauge values are numeric, not string
This commit is contained in:
parent
d0e1324dba
commit
65fccf8abe
1 changed files with 5 additions and 2 deletions
|
@ -35,6 +35,9 @@ module.exports = Metrics =
|
||||||
sanitizeKey: (key) ->
|
sanitizeKey: (key) ->
|
||||||
key.replace /[^a-zA-Z0-9]/g, "_"
|
key.replace /[^a-zA-Z0-9]/g, "_"
|
||||||
|
|
||||||
|
sanitizeValue: (value) ->
|
||||||
|
parseFloat(value)
|
||||||
|
|
||||||
set : (key, value, sampleRate = 1)->
|
set : (key, value, sampleRate = 1)->
|
||||||
statsd.set buildKey(key), value, sampleRate
|
statsd.set buildKey(key), value, sampleRate
|
||||||
|
|
||||||
|
@ -74,7 +77,7 @@ module.exports = Metrics =
|
||||||
help: key,
|
help: key,
|
||||||
labelNames: ['name','host']
|
labelNames: ['name','host']
|
||||||
})
|
})
|
||||||
gauges[key].set({name: name, host: hostname},value)
|
gauges[key].set({name: name, host: hostname},this.sanitizeValue(value))
|
||||||
|
|
||||||
globalGauge: (key, value, sampleRate = 1)->
|
globalGauge: (key, value, sampleRate = 1)->
|
||||||
statsd.gauge buildGlobalKey(key), value, sampleRate
|
statsd.gauge buildGlobalKey(key), value, sampleRate
|
||||||
|
@ -85,7 +88,7 @@ module.exports = Metrics =
|
||||||
help: key,
|
help: key,
|
||||||
labelNames: ['name','host']
|
labelNames: ['name','host']
|
||||||
})
|
})
|
||||||
gauges[key].set({name: name},value)
|
gauges[key].set({name: name},this.sanitizeValue(value))
|
||||||
|
|
||||||
mongodb: require "./mongodb"
|
mongodb: require "./mongodb"
|
||||||
http: require "./http"
|
http: require "./http"
|
||||||
|
|
Loading…
Reference in a new issue