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.defaultInterval
- default metric persistence intervalpublic 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 TimeStampedMetric
s when they first register.listener
- listener to notifypublic SortedMap<MetricDescriptor,TimeStampedCounter> getCounters()
TimeStampedCounter
s from the registry, along
with their MetricDescriptor
s.TimeStampedCounter
spublic SortedMap<MetricDescriptor,TimeStampedCounter> getCounters(MetricFilter filter)
TimeStampedCounter
s from the registry that match
the given MetricFilter
, along with their MetricDescriptor
s.filter
- MetricFilter
to matchTimeStampedCounter
s that match the MetricFilter
public MetricDescriptor.SummaryIntervalMinutes getDefaultInterval()
public Set<MetricDescriptor> getDescriptors()
MetricDescriptor
s of all the TimeStampedMetric
s in the registry.MetricDescriptor
s for all registered TimeStampedMetric
spublic SortedMap<MetricDescriptor,TimeStampedGauge> getGauges()
TimeStampedGauge
s from the registry, along
with their MetricDescriptor
s.TimeStampedGauge
spublic SortedMap<MetricDescriptor,TimeStampedGauge> getGauges(MetricFilter filter)
TimeStampedGauge
s from the registry that match
the given MetricFilter
, along with their MetricDescriptor
s.filter
- MetricFilter
to matchTimeStampedGauge
s that match the MetricFilter
public SortedMap<MetricDescriptor,TimeStampedHistogram> getHistograms()
TimeStampedHistogram
s from the registry,
along with their MetricDescriptor
s.TimeStampedHistogram
spublic SortedMap<MetricDescriptor,TimeStampedHistogram> getHistograms(MetricFilter filter)
TimeStampedHistogram
s from the registry that
match the given MetricFilter
, along with their MetricDescriptor
s.filter
- MetricFilter
to matchTimeStampedHistogram
s that match the
MetricFilter
public SortedMap<MetricDescriptor,TimeStampedMeter> getMeters()
TimeStampedMeter
s from the registry, along
with their MetricDescriptor
s.TimeStampedMeter
spublic SortedMap<MetricDescriptor,TimeStampedMeter> getMeters(MetricFilter filter)
TimeStampedMeter
s from the registry that match
the given MetricFilter
, along with their MetricDescriptor
s.filter
- MetricFilter
to matchTimeStampedMeter
s that match the MetricFilter
public SortedMap<MetricDescriptor,TimeStampedRatioGauge> getRatioGauges()
TimeStampedRatioGauge
s from the registry,
along with their MetricDescriptor
s.TimeStampedRatioGauge
spublic SortedMap<MetricDescriptor,TimeStampedRatioGauge> getRatioGauges(MetricFilter filter)
TimeStampedRatioGauge
s from the registry that
match the given MetricFilter
, along with their MetricDescriptor
s.filter
- MetricFilter
to matchTimeStampedRatioGauge
s that match the
MetricFilter
public SortedMap<MetricDescriptor,TimeStampedRollingCounter> getRollingCounters()
TimeStampedRollingCounter
s from the
registry, along with their MetricDescriptor
s.TimeStampedRollingCounter
spublic SortedMap<MetricDescriptor,TimeStampedRollingCounter> getRollingCounters(MetricFilter filter)
TimeStampedRollingCounter
s from the registry
that match the given MetricFilter
, along with their MetricDescriptor
s.filter
- MetricFilter
to matchTimeStampedRollingCounter
s that match the
MetricFilter
public SortedMap<MetricDescriptor,TimeStampedTimer> getTimers()
TimeStampedTimer
s from the registry, along
with their MetricDescriptor
s.TimeStampedTimer
spublic SortedMap<MetricDescriptor,TimeStampedTimer> getTimers(MetricFilter filter)
TimeStampedTimer
s from the registry that match
the given MetricFilter
, along with their MetricDescriptor
s.filter
- MetricFilter
to matchTimeStampedTimer
s that match the MetricFilter
public Map<MetricDescriptor,TimeStampedMetric> getTimeStampedMetrics()
Map
public Map<TimeStampedMetric,MetricRegistry.PersistTimes> getTimeStamps()
Map
public TimeStampedMetric register(MetricDescriptor descriptor, TimeStampedMetric metric) throws IllegalArgumentException
TimeStampedMetric
, registers it using the provided
MetricDescriptor
.descriptor
- MetricDescriptor
for the TimeStampedMetric
metric
- TimeStampedMetric
to registerTimeStampedMetric
that was registeredIllegalArgumentException
- if the TimeStampedMetric
was
already registeredpublic void registerAll(Collection<TimeStampedMetric> metrics) throws IllegalArgumentException
Collection
of TimeStampedMetric
s, register them.metrics
- TimeStampedMetric
s to registerIllegalArgumentException
- if any of the TimeStampedMetric
s
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 TimeStampedCounter
TimeStampedCounter
public 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 TimeStampedCounter
TimeStampedCounter
public TimeStampedGauge timeStampedGauge(GaugeDescriptor descriptor)
TimeStampedGauge
and registers it using the given
GaugeDescriptor
.descriptor
- GaugeDescriptor
specifying characteristics of
the requested TimeStampedGauge
TimeStampedGauge
public 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 TimeStampedGauge
uid
- UID for the TimeStampedGauge
TimeStampedGauge
public TimeStampedHistogram timeStampedHistogram(HistogramDescriptor descriptor)
TimeStampedHistogram
and registers it using the
given HistogramDescriptor
.descriptor
- HistogramDescriptor
specifying characteristics
of the requested TimeStampedHistogram
TimeStampedHistogram
public 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 TimeStampedHistogram
uid
- UID for the TimeStampedHistogram
TimeStampedHistogram
public TimeStampedMeter timeStampedMeter(MeterDescriptor descriptor)
TimeStampedMeter
and registers it using the given
MeterDescriptor
.descriptor
- MeterDescriptor
specifying characteristics of
the requested TimeStampedMeter
TimeStampedMeter
public 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 TimeStampedMeter
TimeStampedMeter
public TimeStampedRatioGauge timeStampedRatioGauge(RatioGaugeDescriptor descriptor)
TimeStampedRatioGauge
and registers it using the
given RatioGaugeDescriptor
.descriptor
- RatioGaugeDescriptor
specifying characteristics
of the requested TimeStampedRatioGauge
TimeStampedRatioGauge
public 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 TimeStampedRatioGauge
uid
- UID for the TimeStampedRatioGauge
TimeStampedRatioGauge
public TimeStampedRollingCounter timeStampedRollingCounter(RollingCounterDescriptor descriptor)
TimeStampedRollingCounter
and registers it using
the given RollingCounterDescriptor
.descriptor
- RollingCounterDescriptor
specifying
characteristics of the requested TimeStampedRollingCounter
TimeStampedRollingCounter
public 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 TimeStampedRollingCounter
TimeStampedRollingCounter
public TimeStampedTimer timeStampedTimer(TimerDescriptor descriptor)
TimeStampedTimer
and registers it using the given
TimerDescriptor
.descriptor
- TimerDescriptor
specifying characteristics of
the requested TimeStampedTimer
TimeStampedTimer
public 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 TimeStampedTimer
TimeStampedTimer
Copyright © 2016. All Rights Reserved.