public class TimeStampedRollingCounter extends Object implements TimeStampedMetric
| Constructor and Description |
|---|
TimeStampedRollingCounter(MetricRegistry registry,
RollingCounterDescriptor descriptor)
Constructs a
TimeStampedRollingCounter with the specified
characteristics using the specified MetricRegistry. |
TimeStampedRollingCounter(MetricRegistry registry,
RollingCounterDescriptor descriptor,
String uid)
Constructs a
TimeStampedRollingCounter with the specified UID and
other characteristics using the specified MetricRegistry. |
| Modifier and Type | Method and Description |
|---|---|
RollingCounterDataPoint |
extractDataPoint()
Extract a
RollingCounterDataPoint from this object. |
long |
getDelta()
Computes and returns the delta between the latest and previous value
snapshots.
|
RollingCounterDescriptor |
getDescriptor()
Gets the
MetricDescriptor that describes this TimeStampedMetric object. |
long |
getLatestSnapshot()
Gets the latest value snapshot for the rolling counter.
|
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.
|
long |
getPreviousSnapshot()
Gets the previous value snapshot for the rolling counter.
|
long |
getPreviousTimeStamp()
Gets the previous time stamp.
|
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 rolling counter for use in a new time period by saving the
most recent value snapshot as the previous snapshot, and saving the most
recent time stamp as the previous time stamp.
|
void |
setDescriptor(RollingCounterDescriptor toSet)
Sets the
RollingCounterDescriptor that specifies characteristics
of this TimeStampedRollingCounter. |
void |
setLatestSnapshot(long toSet)
Sets the latest value snapshot for the rolling counter.
|
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 |
updateTimeStamp()
Convenience method that sets the update time stamp to the current time.
|
public TimeStampedRollingCounter(MetricRegistry registry, RollingCounterDescriptor descriptor)
TimeStampedRollingCounter with the specified
characteristics using the specified MetricRegistry.registry - MetricRegistry to use for allocating this objectdescriptor - RollingCounterDescriptor that specifies various
characteristics of the resulting TimeStampedRollingCounterpublic TimeStampedRollingCounter(MetricRegistry registry, RollingCounterDescriptor descriptor, String uid)
TimeStampedRollingCounter with the specified UID and
other characteristics using the specified MetricRegistry.registry - MetricRegistry to use for allocating this objectdescriptor - RollingCounterDescriptor that specifies various
characteristics of the resulting TimeStampedRollingCounteruid - UID to assign to the resulting TimeStampedRollingCounterIllegalArgumentException - if a null value is supplied for either
the RollingCounterDescriptor or
MetricRegistry argumentpublic RollingCounterDataPoint extractDataPoint()
RollingCounterDataPoint from this object.extractDataPoint in interface TimeStampedMetricRollingCounterDataPointpublic long getDelta()
public RollingCounterDescriptor getDescriptor()
TimeStampedMetricMetricDescriptor that describes this TimeStampedMetric object.getDescriptor in interface TimeStampedMetricMetricDescriptor that describes this TimeStampedMetricpublic long getLatestSnapshot()
public long getMsSpanned()
TimeStampedMetricgetMsSpanned in interface TimeStampedMetricpublic long getPreviousTimeStamp()
TimeStampedMetricgetPreviousTimeStamp in interface TimeStampedMetricpublic long getPreviousSnapshot()
protected 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 setDescriptor(RollingCounterDescriptor toSet)
RollingCounterDescriptor that specifies characteristics
of this TimeStampedRollingCounter.toSet - the RollingCounterDescriptor for this objectpublic void setLatestSnapshot(long toSet)
toSet - latest snapshotpublic 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 updateTimeStamp()
TimeStampedMetricupdateTimeStamp in interface TimeStampedMetricCopyright © 2014. All Rights Reserved.