Skip to content
This repository has been archived by the owner on Feb 1, 2018. It is now read-only.

Commit

Permalink
Merge pull request #12 from AdAgility/support_decimal_metrics
Browse files Browse the repository at this point in the history
Fix bug preventing decimal percentiles (i.e. 99.9) from being sent to…
  • Loading branch information
ekilby committed Aug 27, 2015
2 parents d377d63 + 11925bb commit c6b9ba5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/stackdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down

0 comments on commit c6b9ba5

Please sign in to comment.