com.netflix.servo.publish
Class MonitorRegistryMetricPoller

java.lang.Object
  extended by com.netflix.servo.publish.MonitorRegistryMetricPoller
All Implemented Interfaces:
MetricPoller

public final class MonitorRegistryMetricPoller
extends java.lang.Object
implements MetricPoller

Poller for fetching Monitor metrics from a monitor registry.


Constructor Summary
MonitorRegistryMetricPoller()
          Creates a new instance using DefaultMonitorRegistry.
MonitorRegistryMetricPoller(MonitorRegistry registry)
          Creates a new instance using the specified registry.
MonitorRegistryMetricPoller(MonitorRegistry registry, long cacheTTL, java.util.concurrent.TimeUnit unit)
          Creates a new instance using the specified registry and a time limiter.
MonitorRegistryMetricPoller(MonitorRegistry registry, long cacheTTL, java.util.concurrent.TimeUnit unit, boolean useLimiter)
          Creates a new instance using the specified registry.
 
Method Summary
 java.util.List<Metric> poll(MetricFilter filter)
          Fetch the current values for a set of metrics that match the provided filter.
 java.util.List<Metric> poll(MetricFilter filter, boolean reset)
          Fetch the current values for a set of metrics that match the provided filter.
 void shutdown()
          Shutsdown the thread executor used for time limiting the get value calls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitorRegistryMetricPoller

public MonitorRegistryMetricPoller()
Creates a new instance using DefaultMonitorRegistry.


MonitorRegistryMetricPoller

public MonitorRegistryMetricPoller(MonitorRegistry registry)
Creates a new instance using the specified registry.

Parameters:
registry - registry to query for annotated objects

MonitorRegistryMetricPoller

public MonitorRegistryMetricPoller(MonitorRegistry registry,
                                   long cacheTTL,
                                   java.util.concurrent.TimeUnit unit)
Creates a new instance using the specified registry and a time limiter.

Parameters:
registry - registry to query for annotated objects
cacheTTL - how long to cache the filtered monitor list from the registry
unit - time unit for the cache ttl

MonitorRegistryMetricPoller

public MonitorRegistryMetricPoller(MonitorRegistry registry,
                                   long cacheTTL,
                                   java.util.concurrent.TimeUnit unit,
                                   boolean useLimiter)
Creates a new instance using the specified registry.

Parameters:
registry - registry to query for annotated objects
cacheTTL - how long to cache the filtered monitor list from the registry
unit - time unit for the cache ttl
useLimiter - whether to use a time limiter for getting the values from the monitors
Method Detail

poll

public java.util.List<Metric> poll(MetricFilter filter)
Fetch the current values for a set of metrics that match the provided filter. This method should be cheap, thread-safe, and interruptible so that it can be called frequently to collect metrics at a regular interval.

Specified by:
poll in interface MetricPoller
Parameters:
filter - retricts the set of metrics
Returns:
list of current metric values

poll

public java.util.List<Metric> poll(MetricFilter filter,
                                   boolean reset)
Fetch the current values for a set of metrics that match the provided filter. This method should be cheap, thread-safe, and interruptible so that it can be called frequently to collect metrics at a regular interval.

Specified by:
poll in interface MetricPoller
Parameters:
filter - retricts the set of metrics
reset - should this poller trigger a reset for ResettableMonitor
Returns:
list of current metric values

shutdown

public void shutdown()
Shutsdown the thread executor used for time limiting the get value calls. It is a good idea to call this and explicitly cleanup the thread. In most cases the threads will be cleaned up when the executor is garbage collected if shutdown is not called explicitly.