com.netflix.servo.monitor
Class PeakRateCounter

java.lang.Object
  extended by com.netflix.servo.monitor.AbstractMonitor<java.lang.Number>
      extended by com.netflix.servo.monitor.PeakRateCounter
All Implemented Interfaces:
Counter, Monitor<java.lang.Number>, NumericMonitor<java.lang.Number>, ResettableMonitor<java.lang.Number>

public class PeakRateCounter
extends AbstractMonitor<java.lang.Number>
implements Counter, ResettableMonitor<java.lang.Number>

A resettable counter. The value is the maximum count per second within the specified interval until the counter is reset.


Field Summary
 
Fields inherited from class com.netflix.servo.monitor.AbstractMonitor
config
 
Constructor Summary
PeakRateCounter(MonitorConfig config)
           
PeakRateCounter(MonitorConfig config, int intervalSeconds)
          Deprecated. Polling intervals are configured using the system property servo.pollers
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 java.lang.Number getAndResetValue()
          Return the value and reset the monitor state for the default polling interval.
 java.lang.Number getAndResetValue(int pollerIdx)
          Return the value and reset the monitor state for a given polling interval.
 java.lang.Number getValue()
          Returns the current value for the monitor.
 int hashCode()
          
 void increment()
          Update the count by one.
 void increment(long amount)
          Update the count by the specified amount.
 java.lang.String toString()
          
 
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.Monitor
getConfig
 

Constructor Detail

PeakRateCounter

public PeakRateCounter(MonitorConfig config)

PeakRateCounter

@Deprecated
public PeakRateCounter(MonitorConfig config,
                                  int intervalSeconds)
Deprecated. Polling intervals are configured using the system property servo.pollers

Create a new instance with the specified interval.

Parameters:
config - configuration for the monitor
intervalSeconds - ignored
Method Detail

getValue

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

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

getAndResetValue

public java.lang.Number getAndResetValue()
Return the value and reset the monitor state for the default polling interval.

Specified by:
getAndResetValue in interface ResettableMonitor<java.lang.Number>

getAndResetValue

public java.lang.Number getAndResetValue(int pollerIdx)
Return the value and reset the monitor state for a given polling interval. This allows us to support multiple pollers, for example a 10second and 60second poller.

Specified by:
getAndResetValue in interface ResettableMonitor<java.lang.Number>

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

increment

public void increment()
Update the count by one.

Specified by:
increment in interface Counter

increment

public void increment(long amount)
Update the count by the specified amount.

Specified by:
increment in interface Counter