public boolean convertMetric(String name, int epochSecs, Distribution dist, OpenTsdbClient.MetricsBuffer buffer) { Tuple2<String, StringBuilder> nameAndTags = getNameAndTags(name); if (nameAndTags == null) { return false; } String statName = nameAndTags._1(); StringBuilder tags = nameAndTags._2().append(" ").append(getDefaultTags()); float p50 = dist.histogram().getPercentile(0.5); float p90 = dist.histogram().getPercentile(0.9); float p95 = dist.histogram().getPercentile(0.95); float p99 = dist.histogram().getPercentile(0.99); long max = dist.maximum(); long count = dist.count(); float avg = (float) dist.average(); buffer.addMetric(statName + ".p50", epochSecs, p50, tags.toString()); buffer.addMetric(statName + ".p90", epochSecs, p90, tags.toString()); buffer.addMetric(statName + ".p95", epochSecs, p95, tags.toString()); buffer.addMetric(statName + ".p99", epochSecs, p99, tags.toString()); buffer.addMetric(statName + ".max", epochSecs, max, tags.toString()); buffer.addMetric(statName + ".count", epochSecs, count, tags.toString()); buffer.addMetric(statName + ".avg", epochSecs, avg, tags.toString()); return true; }
public boolean convertMetric(String name, int epochSecs, Distribution dist, OpenTsdbClient.MetricsBuffer buffer) { Tuple2<String, StringBuilder> nameAndTags = getNameAndTags(name); if (nameAndTags == null) { return false; } String statName = nameAndTags._1(); StringBuilder tags = nameAndTags._2().append(" ").append(getDefaultTags()); float p50 = dist.histogram().getPercentile(0.5); float p90 = dist.histogram().getPercentile(0.9); float p95 = dist.histogram().getPercentile(0.95); float p99 = dist.histogram().getPercentile(0.99); long max = dist.maximum(); long count = dist.count(); float avg = (float) dist.average(); buffer.addMetric(statName + ".p50", epochSecs, p50, tags.toString()); buffer.addMetric(statName + ".p90", epochSecs, p90, tags.toString()); buffer.addMetric(statName + ".p95", epochSecs, p95, tags.toString()); buffer.addMetric(statName + ".p99", epochSecs, p99, tags.toString()); buffer.addMetric(statName + ".max", epochSecs, max, tags.toString()); buffer.addMetric(statName + ".count", epochSecs, count, tags.toString()); buffer.addMetric(statName + ".avg", epochSecs, avg, tags.toString()); return true; }