com.netflix.servo.monitor
Class MaxGauge

java.lang.Object
  extended by com.netflix.servo.monitor.AbstractMonitor<java.lang.Long>
      extended by com.netflix.servo.monitor.MaxGauge
All Implemented Interfaces:
Gauge<java.lang.Long>, Monitor<java.lang.Long>, NumericMonitor<java.lang.Long>, ResettableMonitor<java.lang.Long>

public class MaxGauge
extends AbstractMonitor<java.lang.Long>
implements Gauge<java.lang.Long>, ResettableMonitor<java.lang.Long>

Gauge that keeps track of the maximum value seen since the last reset. Updates should be non-negative, the reset value is 0.


Field Summary
 
Fields inherited from class com.netflix.servo.monitor.AbstractMonitor
config
 
Constructor Summary
MaxGauge(MonitorConfig config)
          Creates a new instance of the gauge.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 java.lang.Long getAndResetValue()
          Return the value and reset the monitor state for the default polling interval.
 java.lang.Long getAndResetValue(int idx)
          Return the value and reset the monitor state for a given polling interval.
 java.lang.Long getValue()
          Returns the current value for the monitor.
 int hashCode()
          
 java.lang.String toString()
          
 void update(long v)
          Update the max if the provided value is larger than the current max.
 
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

MaxGauge

public MaxGauge(MonitorConfig config)
Creates a new instance of the gauge.

Method Detail

update

public void update(long v)
Update the max if the provided value is larger than the current max.


getValue

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

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

getAndResetValue

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

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

getAndResetValue

public java.lang.Long getAndResetValue(int idx)
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.Long>

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