This commit is contained in:
Phillip Webb
2014-10-06 12:03:51 -07:00
parent 09d5812c3b
commit 62eb01f0b8
20 changed files with 262 additions and 217 deletions

View File

@@ -73,7 +73,7 @@ import com.codahale.metrics.MetricRegistry;
* In addition if Codahale's metrics library is on the classpath a {@link MetricRegistry}
* will be created and wired up to the counter and gauge services in addition to the basic
* repository. Users can create Codahale metrics by prefixing their metric names with the
* appropriate type (e.g. "histogram.*", "meter.*") and sending them to the standard
* appropriate type (e.g. "histogram.*", "meter.*") and sending them to the standard
* <code>GaugeService</code> or <code>CounterService</code>.
* </p>
* <p>

View File

@@ -49,18 +49,14 @@ public class RichGaugeReaderPublicMetrics implements PublicMetrics {
return result;
}
private List<Metric<?>> convert(RichGauge richGauge) {
private List<Metric<?>> convert(RichGauge gauge) {
List<Metric<?>> result = new ArrayList<Metric<?>>(6);
result.add(new Metric<Double>(richGauge.getName() + RichGauge.AVG, richGauge
.getAverage()));
result.add(new Metric<Double>(richGauge.getName() + RichGauge.VAL, richGauge.getValue()));
result.add(new Metric<Double>(richGauge.getName() + RichGauge.MIN, richGauge.getMin()));
result.add(new Metric<Double>(richGauge.getName() + RichGauge.MAX, richGauge.getMax()));
result.add(new Metric<Double>(richGauge.getName() + RichGauge.ALPHA, richGauge
.getAlpha()));
result.add(new Metric<Long>(richGauge.getName() + RichGauge.COUNT, richGauge.getCount()));
result.add(new Metric<Double>(gauge.getName() + RichGauge.AVG, gauge.getAverage()));
result.add(new Metric<Double>(gauge.getName() + RichGauge.VAL, gauge.getValue()));
result.add(new Metric<Double>(gauge.getName() + RichGauge.MIN, gauge.getMin()));
result.add(new Metric<Double>(gauge.getName() + RichGauge.MAX, gauge.getMax()));
result.add(new Metric<Double>(gauge.getName() + RichGauge.ALPHA, gauge.getAlpha()));
result.add(new Metric<Long>(gauge.getName() + RichGauge.COUNT, gauge.getCount()));
return result;
}

View File

@@ -32,10 +32,15 @@ import org.springframework.util.Assert;
public final class RichGauge {
public static final String COUNT = ".count";
public static final String MAX = ".max";
public static final String MIN = ".min";
public static final String AVG = ".avg";
public static final String ALPHA = ".alpha";
public static final String VAL = ".val";
private final String name;