allow a global gauge not specific to a host

This commit is contained in:
Brian Gough 2018-05-18 15:09:11 +01:00
parent f1a1002167
commit 00fdea922d
2 changed files with 5 additions and 1 deletions

View file

@ -5,6 +5,7 @@ name = "unknown"
hostname = require('os').hostname() hostname = require('os').hostname()
buildKey = (key)-> "#{name}.#{hostname}.#{key}" buildKey = (key)-> "#{name}.#{hostname}.#{key}"
buildGlobalKey = (key)-> "#{name}.global.#{key}"
destructors = [] destructors = []
@ -42,6 +43,9 @@ module.exports = Metrics =
gauge : (key, value, sampleRate = 1)-> gauge : (key, value, sampleRate = 1)->
statsd.gauge buildKey(key), value, sampleRate statsd.gauge buildKey(key), value, sampleRate
globalGauge: (key, value, sampleRate = 1)->
statsd.gauge buildGlobalKey(key), value, sampleRate
mongodb: require "./mongodb" mongodb: require "./mongodb"
http: require "./http" http: require "./http"
open_sockets: require "./open_sockets" open_sockets: require "./open_sockets"

View file

@ -1,6 +1,6 @@
{ {
"name": "metrics-sharelatex", "name": "metrics-sharelatex",
"version": "1.7.2", "version": "1.8.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",