public class TimeStampedRatioGauge extends com.codahale.metrics.RatioGauge implements TimeStampedMetric
RatioGauge class that provides an association
of the RatioGauge value with time stamps.| Modifier and Type | Field and Description |
|---|---|
static double |
UNINITIALIZED
Value used to indicate that this
TimeStampedRatioGauge has not
yet been initialized. |
| Constructor and Description |
|---|
TimeStampedRatioGauge(MetricRegistry registry,
RatioGaugeDescriptor descriptor)
Constructs a
TimeStampedRatioGauge with the specified
characteristics using the specified MetricRegistry. |
TimeStampedRatioGauge(MetricRegistry registry,
RatioGaugeDescriptor descriptor,
String uid)
Constructs a
TimeStampedRatioGauge with the specified UID and
other characteristics using the specified MetricRegistry. |
| Modifier and Type | Method and Description |
|---|---|
RatioGaugeDataPoint |
extractDataPoint()
Extract a
RatioGaugeDataPoint from this object. |
double |
getDenominator()
Gets the denominator of this
TimeStampedRatioGauge. |
RatioGaugeDescriptor |
getDescriptor()
Gets the
MetricDescriptor that describes this TimeStampedMetric object. |
long |
getMsSpanned()
Determines the number of milliseconds spanned between the latest (update)
time stamp and the oldest (previous) time stamp, accounting for roll-over
of the time stamp.
|
double |
getNumerator()
Gets the numerator of this
TimeStampedRatioGauge. |
long |
getPreviousTimeStamp()
Gets the previous time stamp.
|
protected com.codahale.metrics.RatioGauge.Ratio |
getRatio() |
protected TimeStampManager |
getTimeStampManager()
Gets the
TimeStampManager that this object uses to manage its
associated time stamps. |
String |
getUid()
Gets the UID.
|
long |
getUpdateTimeStamp()
Gets the update time stamp.
|
void |
reset()
Prepares the ratio gauge for use in a new time period by saving the most
recent update time stamp as the previous time stamp.
|
void |
setDenominator(double toSet)
Sets the denominator of this
TimeStampedRatioGauge. |
void |
setDescriptor(RatioGaugeDescriptor toSet)
Sets the
RatioGaugeDescriptor that specifies characteristics of
this TimeStampedRatioGauge. |
void |
setNumerator(double toSet)
Sets the numerator of this
TimeStampedRatioGauge. |
void |
setPreviousTimeStamp(long time)
Sets the previous time stamp.
|
void |
setUid(String toSet)
Sets the UID of this object.
|
void |
setUpdateTimeStamp(long time)
Sets the update time stamp.
|
String |
toDebugString()
Gets a detailed representation of this object to facilitate debugging.
|
String |
toString() |
void |
update(double numerator,
double denominator)
Sets the numerator and denominator of this
TimeStampedRatioGauge. |
void |
updateDenominator(double toSet)
Sets the denominator of this
TimeStampedRatioGauge. |
void |
updateNumerator(double toSet)
Sets the numerator of this
TimeStampedRatioGauge. |
void |
updateTimeStamp()
Convenience method that sets the update time stamp to the current time.
|
public static final double UNINITIALIZED
TimeStampedRatioGauge has not
yet been initialized.public TimeStampedRatioGauge(MetricRegistry registry, RatioGaugeDescriptor descriptor)
TimeStampedRatioGauge with the specified
characteristics using the specified MetricRegistry.registry - MetricRegistry to use for allocating this objectdescriptor - RatioGaugeDescriptor that specifies various
characteristics of the resulting TimeStampedRatioGaugepublic TimeStampedRatioGauge(MetricRegistry registry, RatioGaugeDescriptor descriptor, String uid)
TimeStampedRatioGauge with the specified UID and
other characteristics using the specified MetricRegistry.registry - MetricRegistry to use for allocating this objectdescriptor - RatioGaugeDescriptor that specifies various
characteristics of the resulting TimeStampedRatioGaugeuid - UID to assign to the resulting TimeStampedRatioGaugeIllegalArgumentException - if a null value is supplied for either
the RatioGaugeDescriptor or
MetricRegistry argumentpublic RatioGaugeDataPoint extractDataPoint()
RatioGaugeDataPoint from this object.extractDataPoint in interface TimeStampedMetricRatioGaugeDataPointpublic double getDenominator()
TimeStampedRatioGauge.public RatioGaugeDescriptor getDescriptor()
TimeStampedMetricMetricDescriptor that describes this TimeStampedMetric object.getDescriptor in interface TimeStampedMetricMetricDescriptor that describes this TimeStampedMetricpublic long getMsSpanned()
TimeStampedMetricgetMsSpanned in interface TimeStampedMetricpublic double getNumerator()
TimeStampedRatioGauge.public long getPreviousTimeStamp()
TimeStampedMetricgetPreviousTimeStamp in interface TimeStampedMetricprotected com.codahale.metrics.RatioGauge.Ratio getRatio()
getRatio in class com.codahale.metrics.RatioGaugeprotected TimeStampManager getTimeStampManager()
TimeStampManager that this object uses to manage its
associated time stamps.TimeStampManager for this objectpublic String getUid()
TimeStampedMetricgetUid in interface TimeStampedMetricpublic long getUpdateTimeStamp()
TimeStampedMetricgetUpdateTimeStamp in interface TimeStampedMetricpublic void reset()
reset in interface TimeStampedMetricpublic void setDenominator(double toSet)
TimeStampedRatioGauge.toSet - the denominator for this objectpublic void setDescriptor(RatioGaugeDescriptor toSet)
RatioGaugeDescriptor that specifies characteristics of
this TimeStampedRatioGauge.toSet - the RatioGaugeDescriptor for this objectpublic void setNumerator(double toSet)
TimeStampedRatioGauge.toSet - the numerator for this objectpublic void setPreviousTimeStamp(long time)
TimeStampedMetricsetPreviousTimeStamp in interface TimeStampedMetrictime - previous time stamppublic void setUid(String toSet)
TimeStampedMetricsetUid in interface TimeStampedMetrictoSet - new UID for this objectpublic void setUpdateTimeStamp(long time)
TimeStampedMetricsetUpdateTimeStamp in interface TimeStampedMetrictime - update time stamppublic String toDebugString()
public void update(double numerator,
double denominator)
TimeStampedRatioGauge.numerator - the numerator for this objectdenominator - the denominator for this objectpublic void updateDenominator(double toSet)
TimeStampedRatioGauge.toSet - the denominator for this objectpublic void updateNumerator(double toSet)
TimeStampedRatioGauge.toSet - the numerator for this objectpublic void updateTimeStamp()
TimeStampedMetricupdateTimeStamp in interface TimeStampedMetricCopyright © 2014. All Rights Reserved.