public final class DynamicTimer extends AbstractMonitor<java.lang.Long> implements CompositeMonitor<java.lang.Long>
BasicTimer
s based on an arbitrary
(name, tagList), or MonitorConfig
. Timers are automatically expired after 15 minutes of
inactivity.config
Modifier and Type | Method and Description |
---|---|
java.util.List<Monitor<?>> |
getMonitors()
Returns a list of sub-monitors for this composite.
|
java.lang.Long |
getValue(int pollerIdx)
Returns the current value for the monitor for the nth poller.
|
static void |
record(MonitorConfig config,
long duration)
Record result to the dynamic timer indicated by the provided config
with a TimeUnit of milliseconds.
|
static void |
record(MonitorConfig config,
long duration,
java.util.concurrent.TimeUnit unit)
Deprecated.
Use
record(MonitorConfig, java.util.concurrent.TimeUnit,
long, java.util.concurrent.TimeUnit) instead.
The new method allows you to be specific about the units used for reporting the timer and
the units in which the duration is measured. |
static void |
record(MonitorConfig config,
java.util.concurrent.TimeUnit reporUnit,
long duration,
java.util.concurrent.TimeUnit durationUnit)
Record a duration to the dynamic timer indicated by the
provided config/reportUnit.
|
static Stopwatch |
start(MonitorConfig config)
Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given config.
|
static Stopwatch |
start(MonitorConfig config,
java.util.concurrent.TimeUnit unit)
Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given config.
|
static Stopwatch |
start(java.lang.String name,
java.lang.String... tags)
Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given name, and sequence of (key,
value) pairs.
|
static Stopwatch |
start(java.lang.String name,
TagList list)
Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given config.
|
static Stopwatch |
start(java.lang.String name,
TagList list,
java.util.concurrent.TimeUnit unit)
Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given config.
|
java.lang.String |
toString() |
getConfig, getValue
public static Stopwatch start(MonitorConfig config, java.util.concurrent.TimeUnit unit)
public static Stopwatch start(MonitorConfig config)
public static void record(MonitorConfig config, long duration)
public static void record(MonitorConfig config, long duration, java.util.concurrent.TimeUnit unit)
record(MonitorConfig, java.util.concurrent.TimeUnit,
long, java.util.concurrent.TimeUnit)
instead.
The new method allows you to be specific about the units used for reporting the timer and
the units in which the duration is measured.public static void record(MonitorConfig config, java.util.concurrent.TimeUnit reporUnit, long duration, java.util.concurrent.TimeUnit durationUnit)
public static Stopwatch start(java.lang.String name, java.lang.String... tags)
public static Stopwatch start(java.lang.String name, TagList list)
public static Stopwatch start(java.lang.String name, TagList list, java.util.concurrent.TimeUnit unit)
public java.util.List<Monitor<?>> getMonitors()
getMonitors
in interface CompositeMonitor<java.lang.Long>
public java.lang.Long getValue(int pollerIdx)
public java.lang.String toString()
toString
in class java.lang.Object