From dc8a339a7e3179a68db9d9b5e6ffdcb5f5b5f90e Mon Sep 17 00:00:00 2001 From: David Schlosnagle Date: Wed, 6 Dec 2017 10:29:03 -0500 Subject: [PATCH] JavaDoc TaggedMetricRegistry API --- .../registry/DefaultTaggedMetricRegistry.java | 20 ++++---- .../registry/TaggedMetricRegistry.java | 46 +++++++++++++++++-- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/DefaultTaggedMetricRegistry.java b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/DefaultTaggedMetricRegistry.java index 7fa1df8ee..cb071aecd 100644 --- a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/DefaultTaggedMetricRegistry.java +++ b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/DefaultTaggedMetricRegistry.java @@ -46,28 +46,28 @@ public static TaggedMetricRegistry getDefault() { } @Override - public Counter counter(MetricName metric) { - return getOrAdd(metric, Counter.class, Counter::new); + public Counter counter(MetricName metricName) { + return getOrAdd(metricName, Counter.class, Counter::new); } @Override - public Gauge gauge(MetricName metric, Gauge gauge) { - return getOrAdd(metric, Gauge.class, () -> gauge); + public Gauge gauge(MetricName metricName, Gauge gauge) { + return getOrAdd(metricName, Gauge.class, () -> gauge); } @Override - public Histogram histogram(MetricName metric) { - return getOrAdd(metric, Histogram.class, () -> new Histogram(new ExponentiallyDecayingReservoir())); + public Histogram histogram(MetricName metricName) { + return getOrAdd(metricName, Histogram.class, () -> new Histogram(new ExponentiallyDecayingReservoir())); } @Override - public Meter meter(MetricName metric) { - return getOrAdd(metric, Meter.class, Meter::new); + public Meter meter(MetricName metricName) { + return getOrAdd(metricName, Meter.class, Meter::new); } @Override - public Timer timer(MetricName metric) { - return getOrAdd(metric, Timer.class, Timer::new); + public Timer timer(MetricName metricName) { + return getOrAdd(metricName, Timer.class, Timer::new); } @Override diff --git a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/TaggedMetricRegistry.java b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/TaggedMetricRegistry.java index c6880daba..1b73ebcdc 100644 --- a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/TaggedMetricRegistry.java +++ b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/TaggedMetricRegistry.java @@ -29,16 +29,52 @@ */ public interface TaggedMetricRegistry { - Timer timer(MetricName metric); + /** + * Returns existing or new timer metric for the specified metric name. + * + * @param metricName metric name + * @return timer metric + */ + Timer timer(MetricName metricName); - Meter meter(MetricName metric); + /** + * Returns existing or new meter metric for the specified metric name. + * + * @param metricName metric name + * @return meter metric + */ + Meter meter(MetricName metricName); - Histogram histogram(MetricName metric); + /** + * Returns existing or new histogram metric for the specified metric name. + * + * @param metricName metric name + * @return histogram metric + */ + Histogram histogram(MetricName metricName); + /** + * Returns existing or new gauge metric for the specified metric name. + * + * @param metricName metric name + * @param gauge gauge + * @return gauge metric + */ // This differs from MetricRegistry and takes the Gauge directly rather than a Supplier - Gauge gauge(MetricName metric, Gauge gauge); + Gauge gauge(MetricName metricName, Gauge gauge); - Counter counter(MetricName metric); + /** + * Returns existing or new counter metric for the specified metric name. + * + * @param metricName metric name + * @return counter metric + */ + Counter counter(MetricName metricName); + /** + * Returns a map of registered metrics. + * + * @return map of registered metrics + */ Map getMetrics(); }