From b2f49351c0df84917c99220ca29fb02c5524887a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 5 Dec 2018 11:03:40 +0000 Subject: [PATCH] few tidy up changes --- libraries/metrics/metrics.coffee | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libraries/metrics/metrics.coffee b/libraries/metrics/metrics.coffee index c96db21c67..9f8df741dd 100644 --- a/libraries/metrics/metrics.coffee +++ b/libraries/metrics/metrics.coffee @@ -41,15 +41,13 @@ module.exports = Metrics = ) buildPromKey: (key = "")-> - Metrics.sanitizeKey key - - sanitizeKey: (key) -> key.replace /[^a-zA-Z0-9]/g, "_" sanitizeValue: (value) -> parseFloat(value) set : (key, value, sampleRate = 1)-> + console.log("counts are not currently supported") inc : (key, sampleRate = 1, opts = {})-> key = Metrics.buildPromKey(key) @@ -78,7 +76,7 @@ module.exports = Metrics = console.log("doing count/inc", key, opts) timing: (key, timeSpan, sampleRate, opts = {})-> - key = Metrics.sanitizeKey("timer_" + key) + key = Metrics.buildPromKey("timer_" + key) if !promMetrics[key]? promMetrics[key] = new prom.Summary({ name: key, @@ -95,7 +93,7 @@ module.exports = Metrics = Timer : class constructor :(key, sampleRate = 1, opts)-> this.start = new Date() - key = Metrics.sanitizeKey(key) + key = Metrics.buildPromKey(key) this.key = key this.sampleRate = sampleRate this.opts = opts