public class MetricRegistry extends Object
TimeStampedMetric instances.| Modifier and Type | Class and Description |
|---|---|
static class |
MetricRegistry.PersistTimes
Utility class that holds two time stamps that should correspond to a
single metric.
|
| Constructor and Description |
|---|
MetricRegistry()
Creates a new
MetricRegistry with a default metric persistence
interval of SummaryIntervalMinutes.ONE. |
MetricRegistry(MetricDescriptor.SummaryIntervalMinutes defaultInterval)
Creates a new
MetricRegistry with a metric persistence interval
that should be applied to any metrics registered without their own
specific interval being specified. |
public MetricRegistry()
MetricRegistry with a default metric persistence
interval of SummaryIntervalMinutes.ONE.public MetricRegistry(MetricDescriptor.SummaryIntervalMinutes defaultInterval)
MetricRegistry with a metric persistence interval
that should be applied to any metrics registered without their own
specific interval being specified.public void addListener(MetricRegistryListener listener)
MetricRegistryListener to a collection of listeners that
will be notified upon registration of a TimeStampedMetric.
Listeners will be notified in the order in which they are added. Also,
listeners will be notified of all previously-registered TimeStampedMetrics when they first register.listener - listener to notifypublic SortedMap<MetricDescriptor,TimeStampedCounter> getCounters()
TimeStampedCounters from the registry, along
with their MetricDescriptors.TimeStampedCounterspublic SortedMap<MetricDescriptor,TimeStampedCounter> getCounters(MetricFilter filter)
TimeStampedCounters from the registry that match
the given MetricFilter, along with their MetricDescriptors.filter - MetricFilter to matchTimeStampedCounters that match the MetricFilterpublic MetricDescriptor.SummaryIntervalMinutes getDefaultInterval()
public Set<MetricDescriptor> getDescriptors()
MetricDescriptors of all the TimeStampedMetrics in the registry.MetricDescriptors for all registered TimeStampedMetricspublic SortedMap<MetricDescriptor,TimeStampedGauge> getGauges()
TimeStampedGauges from the registry, along
with their MetricDescriptors.TimeStampedGaugespublic SortedMap<MetricDescriptor,TimeStampedGauge> getGauges(MetricFilter filter)
TimeStampedGauges from the registry that match
the given MetricFilter, along with their MetricDescriptors.filter - MetricFilter to matchTimeStampedGauges that match the MetricFilterpublic SortedMap<MetricDescriptor,TimeStampedHistogram> getHistograms()
TimeStampedHistograms from the registry,
along with their MetricDescriptors.TimeStampedHistogramspublic SortedMap<MetricDescriptor,TimeStampedHistogram> getHistograms(MetricFilter filter)
TimeStampedHistograms from the registry that
match the given MetricFilter, along with their MetricDescriptors.filter - MetricFilter to matchTimeStampedHistograms that match the
MetricFilterpublic SortedMap<MetricDescriptor,TimeStampedMeter> getMeters()
TimeStampedMeters from the registry, along
with their MetricDescriptors.TimeStampedMeterspublic SortedMap<MetricDescriptor,TimeStampedMeter> getMeters(MetricFilter filter)
TimeStampedMeters from the registry that match
the given MetricFilter, along with their MetricDescriptors.filter - MetricFilter to matchTimeStampedMeters that match the MetricFilterpublic SortedMap<MetricDescriptor,TimeStampedRatioGauge> getRatioGauges()
TimeStampedRatioGauges from the registry,
along with their MetricDescriptors.TimeStampedRatioGaugespublic SortedMap<MetricDescriptor,TimeStampedRatioGauge> getRatioGauges(MetricFilter filter)
TimeStampedRatioGauges from the registry that
match the given MetricFilter, along with their MetricDescriptors.filter - MetricFilter to matchTimeStampedRatioGauges that match the
MetricFilterpublic SortedMap<MetricDescriptor,TimeStampedRollingCounter> getRollingCounters()
TimeStampedRollingCounters from the
registry, along with their MetricDescriptors.TimeStampedRollingCounterspublic SortedMap<MetricDescriptor,TimeStampedRollingCounter> getRollingCounters(MetricFilter filter)
TimeStampedRollingCounters from the registry
that match the given MetricFilter, along with their MetricDescriptors.filter - MetricFilter to matchTimeStampedRollingCounters that match the
MetricFilterpublic SortedMap<MetricDescriptor,TimeStampedTimer> getTimers()
TimeStampedTimers from the registry, along
with their MetricDescriptors.TimeStampedTimerspublic SortedMap<MetricDescriptor,TimeStampedTimer> getTimers(MetricFilter filter)
TimeStampedTimers from the registry that match
the given MetricFilter, along with their MetricDescriptors.filter - MetricFilter to matchTimeStampedTimers that match the MetricFilterpublic Map<MetricDescriptor,TimeStampedMetric> getTimeStampedMetrics()
Mappublic Map<TimeStampedMetric,MetricRegistry.PersistTimes> getTimeStamps()
Mappublic TimeStampedMetric register(MetricDescriptor descriptor, TimeStampedMetric metric) throws IllegalArgumentException
TimeStampedMetric, registers it using the provided
MetricDescriptor.descriptor - MetricDescriptor for the TimeStampedMetricmetric - TimeStampedMetric to registerTimeStampedMetric that was registeredIllegalArgumentException - if the TimeStampedMetric was
already registeredpublic void registerAll(Collection<TimeStampedMetric> metrics) throws IllegalArgumentException
Collection of TimeStampedMetrics, register them.metrics - TimeStampedMetrics to registerIllegalArgumentException - if any of the TimeStampedMetrics
are already registeredpublic boolean remove(MetricDescriptor descriptor)
TimeStampedMetric corresponding to the specified
MetricDescriptor.descriptor - MetricDescriptor for the TimeStampedMetric to unregisterTimeStampedMetric was removedpublic void removeListener(MetricRegistryListener listener)
MetricRegistryListener from this registry's collection
of listeners.listener - listener to removepublic void removeMatching(MetricFilter filter)
filter - the MetricFilter to matchpublic void setDefaultInterval(MetricDescriptor.SummaryIntervalMinutes toSet)
public TimeStampedCounter timeStampedCounter(CounterDescriptor descriptor)
TimeStampedCounter and registers it using the given
CounterDescriptor.descriptor - CounterDescriptor specifying characteristics of
the requested TimeStampedCounterTimeStampedCounterpublic TimeStampedCounter timeStampedCounter(CounterDescriptor descriptor, String uid)
TimeStampedCounter and registers it with the MetricRegistry using the given CounterDescriptor and UID.descriptor - CounterDescriptor specifying characteristics of
the requested metricuid - UID for the TimeStampedCounterTimeStampedCounterpublic TimeStampedGauge timeStampedGauge(GaugeDescriptor descriptor)
TimeStampedGauge and registers it using the given
GaugeDescriptor.descriptor - GaugeDescriptor specifying characteristics of
the requested TimeStampedGaugeTimeStampedGaugepublic TimeStampedGauge timeStampedGauge(GaugeDescriptor descriptor, String uid)
TimeStampedGauge and registers it with the MetricRegistry using the given GaugeDescriptor and UID.descriptor - GaugeDescriptor specifying characteristics of
the requested TimeStampedGaugeuid - UID for the TimeStampedGaugeTimeStampedGaugepublic TimeStampedHistogram timeStampedHistogram(HistogramDescriptor descriptor)
TimeStampedHistogram and registers it using the
given HistogramDescriptor.descriptor - HistogramDescriptor specifying characteristics
of the requested TimeStampedHistogramTimeStampedHistogrampublic TimeStampedHistogram timeStampedHistogram(HistogramDescriptor descriptor, String uid)
TimeStampedHistogram and registers it with the
MetricRegistry using the given HistogramDescriptor and
UID.descriptor - HistogramDescriptor specifying characteristics
of the requested TimeStampedHistogramuid - UID for the TimeStampedHistogramTimeStampedHistogrampublic TimeStampedMeter timeStampedMeter(MeterDescriptor descriptor)
TimeStampedMeter and registers it using the given
MeterDescriptor.descriptor - MeterDescriptor specifying characteristics of
the requested TimeStampedMeterTimeStampedMeterpublic TimeStampedMeter timeStampedMeter(MeterDescriptor descriptor, String uid)
TimeStampedMeter and registers it with the MetricRegistry using the given MeterDescriptor and UID.descriptor - MeterDescriptor specifying characteristics of
the requested metricuid - UID for the TimeStampedMeterTimeStampedMeterpublic TimeStampedRatioGauge timeStampedRatioGauge(RatioGaugeDescriptor descriptor)
TimeStampedRatioGauge and registers it using the
given RatioGaugeDescriptor.descriptor - RatioGaugeDescriptor specifying characteristics
of the requested TimeStampedRatioGaugeTimeStampedRatioGaugepublic TimeStampedRatioGauge timeStampedRatioGauge(RatioGaugeDescriptor descriptor, String uid)
TimeStampedRatioGauge and registers it with the
MetricRegistry using the given RatioGaugeDescriptor and
UID.descriptor - RatioGaugeDescriptor specifying characteristics
of the requested TimeStampedRatioGaugeuid - UID for the TimeStampedRatioGaugeTimeStampedRatioGaugepublic TimeStampedRollingCounter timeStampedRollingCounter(RollingCounterDescriptor descriptor)
TimeStampedRollingCounter and registers it using
the given RollingCounterDescriptor.descriptor - RollingCounterDescriptor specifying
characteristics of the requested TimeStampedRollingCounterTimeStampedRollingCounterpublic TimeStampedRollingCounter timeStampedRollingCounter(RollingCounterDescriptor descriptor, String uid)
TimeStampedRollingCounter and registers it with the
MetricRegistry using the given RollingCounterDescriptor
and UID.descriptor - RollingCounterDescriptor specifying
characteristics of the requested metricuid - UID for the TimeStampedRollingCounterTimeStampedRollingCounterpublic TimeStampedTimer timeStampedTimer(TimerDescriptor descriptor)
TimeStampedTimer and registers it using the given
TimerDescriptor.descriptor - TimerDescriptor specifying characteristics of
the requested TimeStampedTimerTimeStampedTimerpublic TimeStampedTimer timeStampedTimer(TimerDescriptor descriptor, String uid)
TimeStampedTimer and registers it with the MetricRegistry using the given TimerDescriptor and UID.descriptor - TimerDescriptor specifying characteristics of
the requested metricuid - UID for the TimeStampedTimerTimeStampedTimerCopyright © 2014. All Rights Reserved.