|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.servo.monitor.AbstractMonitor<java.lang.Long>
com.netflix.servo.monitor.StatsMonitor
com.netflix.servo.monitor.StatsTimer
public class StatsTimer
A Timer that provides statistics.
The statistics are collected periodically and are published according to the configuration
specified by the user using a StatsConfig object. Please
make sure that the sampleSize corresponds to roughly the number of samples expected in
a reporting interval. While the statistics collected are accurate for this machine they will not
be correct if they are aggregated across groups of machines. If that is an expected use-case a better
approach is to use buckets that correspond to different times. For example you might have a counter
that tracks how many calls took < 20ms, one for [ 20ms, 500ms ], and one for > 500ms. This bucketing
approach can be easily aggregated.
| Field Summary |
|---|
| Fields inherited from class com.netflix.servo.monitor.StatsMonitor |
|---|
count, defaultExecutor, totalMeasurement |
| Fields inherited from class com.netflix.servo.monitor.AbstractMonitor |
|---|
config |
| Constructor Summary | |
|---|---|
StatsTimer(MonitorConfig baseConfig,
StatsConfig statsConfig)
Creates a new instance of the timer with a unit of milliseconds, using the default executor. |
|
StatsTimer(MonitorConfig baseConfig,
StatsConfig statsConfig,
java.util.concurrent.TimeUnit unit)
Creates a new instance of the timer with a given unit, using the default executor. |
|
StatsTimer(MonitorConfig config,
StatsConfig statsConfig,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.ScheduledExecutorService executor)
Creates a new instance of the timer with a unit of milliseconds, using the ScheduledExecutorService provided by
the user. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
|
long |
getCount()
Get the number of times this timer has been updated |
java.util.concurrent.TimeUnit |
getTimeUnit()
The time unit reported by this timer. |
long |
getTotalTime()
Get the total time recorded for this timer |
int |
hashCode()
|
void |
record(long duration,
java.util.concurrent.TimeUnit timeUnit)
Record a new value that was collected with the given TimeUnit. |
Stopwatch |
start()
Returns a stopwatch that has been started and will automatically record its result to this timer when stopped. |
java.lang.String |
toString()
|
| Methods inherited from class com.netflix.servo.monitor.StatsMonitor |
|---|
getMonitors, getTotalMeasurement, getValue, handleException, record, startComputingStats |
| Methods inherited from class com.netflix.servo.monitor.AbstractMonitor |
|---|
getConfig |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.netflix.servo.monitor.Timer |
|---|
record |
| Methods inherited from interface com.netflix.servo.monitor.Monitor |
|---|
getConfig, getValue |
| Constructor Detail |
|---|
public StatsTimer(MonitorConfig baseConfig,
StatsConfig statsConfig)
public StatsTimer(MonitorConfig baseConfig,
StatsConfig statsConfig,
java.util.concurrent.TimeUnit unit)
public StatsTimer(MonitorConfig config,
StatsConfig statsConfig,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.ScheduledExecutorService executor)
ScheduledExecutorService provided by
the user.
| Method Detail |
|---|
public Stopwatch start()
start in interface Timerpublic java.util.concurrent.TimeUnit getTimeUnit()
getTimeUnit in interface Timer
public void record(long duration,
java.util.concurrent.TimeUnit timeUnit)
record in interface Timerpublic java.lang.String toString()
toString in class StatsMonitorpublic boolean equals(java.lang.Object obj)
equals in class StatsMonitorpublic int hashCode()
hashCode in class StatsMonitorpublic long getCount()
getCount in class StatsMonitorpublic long getTotalTime()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||