com.netflix.servo.monitor
Class DynamicTimer

java.lang.Object
  extended by com.netflix.servo.monitor.DynamicTimer
All Implemented Interfaces:
CompositeMonitor<java.lang.Long>, Monitor<java.lang.Long>

public final class DynamicTimer
extends java.lang.Object
implements CompositeMonitor<java.lang.Long>

Utility class that dynamically creates BasicTimers based on an arbitrary (name, tagList), or MonitorConfig. Timers are automatically expired after 15 minutes of inactivity.


Method Summary
 MonitorConfig getConfig()
          Configuration used to identify a monitor and provide metadata used in aggregations.
 java.util.List<Monitor<?>> getMonitors()
          Returns a list of sub-monitors for this composite.
 java.lang.Long getValue()
          Returns the current value for the monitor.
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)
          Record result to the dynamic timer indicated by the provided config.
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()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

start

public 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. The timer uses the specified TimeUnit.


start

public 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. The timer uses a TimeUnit of milliseconds.


record

public static void record(MonitorConfig config,
                          long duration)
Record result to the dynamic timer indicated by the provided config with a TimeUnit of milliseconds.


record

public static void record(MonitorConfig config,
                          long duration,
                          java.util.concurrent.TimeUnit unit)
Record result to the dynamic timer indicated by the provided config.


start

public 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. The timer uses a TimeUnit of milliseconds.


start

public 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. The timer uses a TimeUnit of milliseconds.


start

public 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. The timer uses a TimeUnit of milliseconds.


getMonitors

public java.util.List<Monitor<?>> getMonitors()
Returns a list of sub-monitors for this composite.

Specified by:
getMonitors in interface CompositeMonitor<java.lang.Long>

getValue

public java.lang.Long getValue()
Returns the current value for the monitor.

Specified by:
getValue in interface Monitor<java.lang.Long>

getConfig

public MonitorConfig getConfig()
Configuration used to identify a monitor and provide metadata used in aggregations.

Specified by:
getConfig in interface Monitor<java.lang.Long>

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object