com.netflix.servo.monitor
Class ContextualCounter

java.lang.Object
  extended by com.netflix.servo.monitor.AbstractContextualMonitor<java.lang.Number,Counter>
      extended by com.netflix.servo.monitor.ContextualCounter
All Implemented Interfaces:
CompositeMonitor<java.lang.Number>, Counter, Monitor<java.lang.Number>, NumericMonitor<java.lang.Number>

public class ContextualCounter
extends AbstractContextualMonitor<java.lang.Number,Counter>
implements Counter

Composite that maintains separate simple counters for each distinct set of tags returned by the tagging context.


Field Summary
 
Fields inherited from class com.netflix.servo.monitor.AbstractContextualMonitor
baseConfig, context, monitors, newMonitor
 
Constructor Summary
ContextualCounter(MonitorConfig config, TaggingContext context, com.google.common.base.Function<MonitorConfig,Counter> newMonitor)
          Create a new instance of the counter.
 
Method Summary
 java.lang.Number getValue()
          Returns the current value for the monitor.
 void increment()
          Update the count by one.
 void increment(long amount)
          Update the count by the specified amount.
 
Methods inherited from class com.netflix.servo.monitor.AbstractContextualMonitor
getConfig, getMonitorForCurrentContext, getMonitors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.netflix.servo.monitor.Monitor
getConfig
 

Constructor Detail

ContextualCounter

public ContextualCounter(MonitorConfig config,
                         TaggingContext context,
                         com.google.common.base.Function<MonitorConfig,Counter> newMonitor)
Create a new instance of the counter.

Parameters:
config - shared configuration
context - provider for context specific tags
newMonitor - function to create new counters
Method Detail

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

getValue

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

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