public class TimeStampedMeter extends com.codahale.metrics.Meter implements TimeStampedMetric
Meter
class that provides an association of
the Meter
value with time stamps.Constructor and Description |
---|
TimeStampedMeter(MetricRegistry registry,
MeterDescriptor descriptor)
Constructs a
TimeStampedMeter with the specified characteristics
using the specified MetricRegistry . |
TimeStampedMeter(MetricRegistry registry,
MeterDescriptor descriptor,
String uid)
Constructs a
TimeStampedMeter with the specified UID and other
characteristics using the specified MetricRegistry . |
Modifier and Type | Method and Description |
---|---|
MeterDataPoint |
extractDataPoint()
Extract a
MeterDataPoint from this object. |
long |
getCount()
Computes and returns the delta between the current and previous counts,
producing the count for the current time period.
|
MeterDescriptor |
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.
|
long |
getPreviousCount()
Gets the previous count for the rolling counter.
|
long |
getPreviousTimeStamp()
Gets the previous time stamp.
|
double |
getRate()
Gets the rate of marked events for the meter.
|
int |
getSlidingWindowMinutes()
Gets the number of minutes spanned by the sliding time window of this
TimeStampedMeter . |
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.
|
boolean |
isValid()
Indicates whether this
TimeStampedMetric 's current value is a
valid one. |
void |
mark(long events) |
void |
reset()
Prepares the meter for use in a new time period.
|
void |
setDescriptor(MeterDescriptor toSet)
Sets the
MeterDescriptor that specifies characteristics of this
TimeStampedMeter . |
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 TimeStampedMeter(MetricRegistry registry, MeterDescriptor descriptor)
TimeStampedMeter
with the specified characteristics
using the specified MetricRegistry
.registry
- MetricRegistry
to use for allocating this objectdescriptor
- MeterDescriptor
that specifies various
characteristics of the resulting TimeStampedMeter
public TimeStampedMeter(MetricRegistry registry, MeterDescriptor descriptor, String uid)
TimeStampedMeter
with the specified UID and other
characteristics using the specified MetricRegistry
.registry
- MetricRegistry
to use for allocating this objectdescriptor
- MeterDescriptor
that specifies various
characteristics of the resulting TimeStampedMeter
uid
- UID to assign to the resulting TimeStampedMeter
IllegalArgumentException
- if a null value is supplied for either
the MeterDescriptor
or MetricRegistry
argumentpublic MeterDataPoint extractDataPoint()
MeterDataPoint
from this object.extractDataPoint
in interface TimeStampedMetric
MeterDataPoint
public long getCount()
getCount
in interface com.codahale.metrics.Counting
getCount
in interface com.codahale.metrics.Metered
getCount
in class com.codahale.metrics.Meter
public MeterDescriptor getDescriptor()
TimeStampedMetric
MetricDescriptor
that describes this TimeStampedMetric
object.getDescriptor
in interface TimeStampedMetric
MetricDescriptor
that describes this TimeStampedMetric
public long getMsSpanned()
TimeStampedMetric
getMsSpanned
in interface TimeStampedMetric
public long getPreviousCount()
public long getPreviousTimeStamp()
TimeStampedMetric
getPreviousTimeStamp
in interface TimeStampedMetric
public double getRate()
TimeStampedMeter
.public int getSlidingWindowMinutes()
TimeStampedMeter
.protected TimeStampManager getTimeStampManager()
TimeStampManager
that this object uses to manage its
associated time stamps.TimeStampManager
for this objectpublic String getUid()
TimeStampedMetric
getUid
in interface TimeStampedMetric
public long getUpdateTimeStamp()
TimeStampedMetric
getUpdateTimeStamp
in interface TimeStampedMetric
public boolean isValid()
TimeStampedMetric
TimeStampedMetric
's current value is a
valid one. For example, it could be a non-numeric value like Double.NaN,
depending upon type and state of the TimeStampedMetric
.isValid
in interface TimeStampedMetric
true
if valid, false
otherwisepublic void mark(long events)
mark
in class com.codahale.metrics.Meter
public void reset()
reset
in interface TimeStampedMetric
public void setDescriptor(MeterDescriptor toSet)
MeterDescriptor
that specifies characteristics of this
TimeStampedMeter
.toSet
- the MeterDescriptor
for this objectpublic void setPreviousTimeStamp(long time)
TimeStampedMetric
setPreviousTimeStamp
in interface TimeStampedMetric
time
- previous time stamppublic void setUid(String toSet)
TimeStampedMetric
setUid
in interface TimeStampedMetric
toSet
- new UID for this objectpublic void setUpdateTimeStamp(long time)
TimeStampedMetric
setUpdateTimeStamp
in interface TimeStampedMetric
time
- update time stamppublic String toDebugString()
public void updateTimeStamp()
TimeStampedMetric
updateTimeStamp
in interface TimeStampedMetric
Copyright © 2015. All Rights Reserved.