Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from sharelatex/bg-allow-non-host-specific-metrics
Browse files Browse the repository at this point in the history
allow a global gauge not specific to a host
  • Loading branch information
briangough authored May 21, 2018
2 parents 046d780 + 1fec290 commit e57f1a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions metrics.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name = "unknown"
hostname = require('os').hostname()

buildKey = (key)-> "#{name}.#{hostname}.#{key}"
buildGlobalKey = (key)-> "#{name}.global.#{key}"

destructors = []

Expand Down Expand Up @@ -42,6 +43,9 @@ module.exports = Metrics =
gauge : (key, value, sampleRate = 1)->
statsd.gauge buildKey(key), value, sampleRate

globalGauge: (key, value, sampleRate = 1)->
statsd.gauge buildGlobalKey(key), value, sampleRate

mongodb: require "./mongodb"
http: require "./http"
open_sockets: require "./open_sockets"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metrics-sharelatex",
"version": "1.7.2",
"version": "1.8.0",
"description": "A drop-in metrics and monitoring module for node.js apps",
"repository": {
"type": "git",
Expand Down

0 comments on commit e57f1a8

Please sign in to comment.