Interface TaggedMetricRegistry
-
- All Superinterfaces:
TaggedMetricSet
- All Known Implementing Classes:
AbstractTaggedMetricRegistry,DefaultTaggedMetricRegistry,SlidingWindowTaggedMetricRegistry
public interface TaggedMetricRegistry extends TaggedMetricSet
Similar toMetricRegistrybut allows tagging ofMetrics.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddMetrics(java.lang.String safeTagName, java.lang.String safeTagValue, TaggedMetricSet metrics)Adds a set of metrics to this TaggedMetricRegistry's metric set, which are to be uniquely identified by the tags provided.com.codahale.metrics.Countercounter(MetricName metricName)Returns existing or new counter metric for the specified metric name.com.codahale.metrics.Countercounter(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Counter> counterSupplier)default <T> java.util.Optional<com.codahale.metrics.Gauge<T>>gauge(MetricName metricName)Returns existing gauge metric for the specified metric name or empty if none has been registered.<T> com.codahale.metrics.Gauge<T>gauge(MetricName metricName, com.codahale.metrics.Gauge<T> gauge)Returns existing or new gauge metric for the specified metric name.com.codahale.metrics.Histogramhistogram(MetricName metricName)Returns existing or new histogram metric for the specified metric name.com.codahale.metrics.Histogramhistogram(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Histogram> histogramSupplier)com.codahale.metrics.Metermeter(MetricName metricName)Returns existing or new meter metric for the specified metric name.com.codahale.metrics.Metermeter(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Meter> meterSupplier)default voidregisterWithReplacement(MetricName metricName, com.codahale.metrics.Gauge<?> gauge)Registers and returns the specified gauge, replacing any existing gauge with the specified metric name.java.util.Optional<com.codahale.metrics.Metric>remove(MetricName metricName)Removes the tagged metric with the specified metric name.java.util.Optional<TaggedMetricSet>removeMetrics(java.lang.String safeTagName, java.lang.String safeTagValue)Removes a TaggedMetricsSet added via addMetrics from this metrics set.booleanremoveMetrics(java.lang.String safeTagName, java.lang.String safeTagValue, TaggedMetricSet metrics)Removes a TaggedMetricsSet added via addMetrics from this metrics set, if currently registered to this metric set.com.codahale.metrics.Timertimer(MetricName metricName)Returns existing or new timer metric for the specified metric name.com.codahale.metrics.Timertimer(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Timer> timerSupplier)-
Methods inherited from interface com.palantir.tritium.metrics.registry.TaggedMetricSet
forEachMetric, getMetrics
-
-
-
-
Method Detail
-
timer
com.codahale.metrics.Timer timer(MetricName metricName)
Returns existing or new timer metric for the specified metric name.- Parameters:
metricName- metric name- Returns:
- timer metric
-
timer
com.codahale.metrics.Timer timer(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Timer> timerSupplier)
-
meter
com.codahale.metrics.Meter meter(MetricName metricName)
Returns existing or new meter metric for the specified metric name.- Parameters:
metricName- metric name- Returns:
- meter metric
-
meter
com.codahale.metrics.Meter meter(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Meter> meterSupplier)
-
histogram
com.codahale.metrics.Histogram histogram(MetricName metricName)
Returns existing or new histogram metric for the specified metric name.- Parameters:
metricName- metric name- Returns:
- histogram metric
-
histogram
com.codahale.metrics.Histogram histogram(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Histogram> histogramSupplier)
-
gauge
default <T> java.util.Optional<com.codahale.metrics.Gauge<T>> gauge(MetricName metricName)
Returns existing gauge metric for the specified metric name or empty if none has been registered.- Parameters:
metricName- metric name- Returns:
- gauge metric or empty if none exists for this name
-
gauge
<T> com.codahale.metrics.Gauge<T> gauge(MetricName metricName, com.codahale.metrics.Gauge<T> gauge)
Returns existing or new gauge metric for the specified metric name.- Parameters:
metricName- metric namegauge- gauge- Returns:
- gauge metric
In most cases, one typically wants
registerWithReplacement(MetricName, Gauge)as gauges may retain references to large backing data structures (e.g. queue or cache), and if a gauge is being registered with the same name, one is likely replacing that previous data structure and the registry should not retain references to the previous version. If lookup of an existing gauge is desired, one should usegauge(MetricName).
-
registerWithReplacement
default void registerWithReplacement(MetricName metricName, com.codahale.metrics.Gauge<?> gauge)
Registers and returns the specified gauge, replacing any existing gauge with the specified metric name.- Parameters:
metricName- metric namegauge- gauge
-
counter
com.codahale.metrics.Counter counter(MetricName metricName)
Returns existing or new counter metric for the specified metric name.- Parameters:
metricName- metric name- Returns:
- counter metric
-
counter
com.codahale.metrics.Counter counter(MetricName metricName, java.util.function.Supplier<com.codahale.metrics.Counter> counterSupplier)
-
remove
java.util.Optional<com.codahale.metrics.Metric> remove(MetricName metricName)
Removes the tagged metric with the specified metric name.- Parameters:
metricName- metric name- Returns:
- the removed metric
-
addMetrics
void addMetrics(java.lang.String safeTagName, java.lang.String safeTagValue, TaggedMetricSet metrics)Adds a set of metrics to this TaggedMetricRegistry's metric set, which are to be uniquely identified by the tags provided.So, if I have a metric registry with a single metric called 'foo', and I add it with tag (bar, baz), this registry will now contain 'foo', tagged with (bar, baz).
If a metric exists with duplicate tags, then calling
TaggedMetricSet.getMetrics()will be impossible.- Parameters:
safeTagName- a tag key which should be added to all metrics in the metrics setsafeTagValue- a tag value which should be added to all metrics in the metrics setmetrics- the metrics which should be added
-
removeMetrics
java.util.Optional<TaggedMetricSet> removeMetrics(java.lang.String safeTagName, java.lang.String safeTagValue)
Removes a TaggedMetricsSet added via addMetrics from this metrics set.
-
removeMetrics
boolean removeMetrics(java.lang.String safeTagName, java.lang.String safeTagValue, TaggedMetricSet metrics)Removes a TaggedMetricsSet added via addMetrics from this metrics set, if currently registered to this metric set.The value is removed only when
Object.equals(java.lang.Object)for the values returns true, therefore you should generally provide the same instance as a previous call to addMetrics.- Returns:
- true if value was removed
-
-