예제 #1
0
 private void reportTimer(MetricName name, Timer timer, long now) {
   if (canSkipMetric(name, timer)) {
     return;
   }
   final Snapshot snapshot = timer.getSnapshot();
   Map<String, Object> fields = new HashMap<>();
   fields.put("count", timer.getCount());
   fields.put("min", convertDuration(snapshot.getMin()));
   fields.put("max", convertDuration(snapshot.getMax()));
   fields.put("mean", convertDuration(snapshot.getMean()));
   fields.put("std-dev", convertDuration(snapshot.getStdDev()));
   fields.put("median", convertDuration(snapshot.getMedian()));
   fields.put("50-percentile", convertDuration(snapshot.getMedian()));
   fields.put("75-percentile", convertDuration(snapshot.get75thPercentile()));
   fields.put("95-percentile", convertDuration(snapshot.get95thPercentile()));
   fields.put("98-percentile", convertDuration(snapshot.get98thPercentile()));
   fields.put("99-percentile", convertDuration(snapshot.get99thPercentile()));
   fields.put("999-percentile", convertDuration(snapshot.get999thPercentile()));
   fields.put("one-minute", convertRate(timer.getOneMinuteRate()));
   fields.put("five-minute", convertRate(timer.getFiveMinuteRate()));
   fields.put("fifteen-minute", convertRate(timer.getFifteenMinuteRate()));
   fields.put("mean-rate", convertRate(timer.getMeanRate()));
   fields.put("run-count", timer.getCount());
   influxDb.appendPoints(
       new InfluxDbPoint(name.getKey(), name.getTags(), String.valueOf(now), fields));
 }
예제 #2
0
 private void reportHistogram(MetricName name, Histogram histogram, long now) {
   if (canSkipMetric(name, histogram)) {
     return;
   }
   final Snapshot snapshot = histogram.getSnapshot();
   Map<String, Object> fields = new HashMap<>();
   fields.put("count", histogram.getCount());
   fields.put("min", snapshot.getMin());
   fields.put("max", snapshot.getMax());
   fields.put("mean", snapshot.getMean());
   fields.put("median", snapshot.getMedian());
   fields.put("std-dev", snapshot.getStdDev());
   fields.put("50-percentile", snapshot.getMedian());
   fields.put("75-percentile", snapshot.get75thPercentile());
   fields.put("95-percentile", snapshot.get95thPercentile());
   fields.put("98-percentile", snapshot.get98thPercentile());
   fields.put("99-percentile", snapshot.get99thPercentile());
   fields.put("999-percentile", snapshot.get999thPercentile());
   fields.put("run-count", histogram.getCount());
   influxDb.appendPoints(
       new InfluxDbPoint(name.getKey(), name.getTags(), String.valueOf(now), fields));
 }