From 11925bbf77e6cb2ced94a69cb8f85d7f85a392b2 Mon Sep 17 00:00:00 2001 From: Gary Malouf Date: Thu, 27 Aug 2015 12:40:35 -0400 Subject: [PATCH] Fix bug preventing decimal percentiles (i.e. 99.9) from being sent to stackdriver. --- lib/stackdriver.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/stackdriver.js b/lib/stackdriver.js index 7350203..49f8b8e 100644 --- a/lib/stackdriver.js +++ b/lib/stackdriver.js @@ -366,12 +366,13 @@ StackdriverBackend.prototype.flush = function(timestamp, metrics) { if (this.sendTimerPercentiles) { // send a point for each configured percentile, defaults to just 90th per statsd default for (var i=0; i < this.percentileValues.length; i++) { - if (typeof(metrics.timer_data[timer_key]["upper_" + this.percentileValues[i]]) == 'undefined') { + var normalizedPercentile = this.percentileValues[i].toString().replace(".", "_"); + if (typeof(metrics.timer_data[timer_key]["upper_" + normalizedPercentile]) == 'undefined') { continue; } this.add_point_to_message(stackdriverMessage, { - name : timer_key + "." + this.percentileValues[i] + "_pct", - value : metrics.timer_data[timer_key]["upper_" + this.percentileValues[i]], + name : timer_key + "." + normalizedPercentile + "_pct", + value : metrics.timer_data[timer_key]["upper_" + normalizedPercentile], collected_at: timestamp }); }