com.twitter.common.metrics
Class ScopedMetrics

java.lang.Object
  extended by com.twitter.common.metrics.ScopedMetrics
All Implemented Interfaces:
MetricRegistry

public class ScopedMetrics
extends Object
implements MetricRegistry

A metric registry that is a 'child' of another metric registry.


Method Summary
<T extends Number>
void
register(Gauge<T> gauge)
          Registers a new gauge.
 AtomicLong registerLong(String gaugeName)
          Creates a gauge and returns an AtomicLong that can be modified to update the value.
 MetricRegistry scope(String scopeName)
          Returns or creates a sub-scope of this metric registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

scope

public MetricRegistry scope(String scopeName)
Description copied from interface: MetricRegistry
Returns or creates a sub-scope of this metric registry.

Specified by:
scope in interface MetricRegistry
Parameters:
scopeName - Name for the sub-scope.
Returns:
A possibly-new metric registry, whose metrics will be 'children' of this scope.

register

public <T extends Number> void register(Gauge<T> gauge)
Description copied from interface: MetricRegistry
Registers a new gauge.

Specified by:
register in interface MetricRegistry
Type Parameters:
T - Number type of the gauge's values.
Parameters:
gauge - Gauge to register.

registerLong

public AtomicLong registerLong(String gaugeName)
Description copied from interface: MetricRegistry
Creates a gauge and returns an AtomicLong that can be modified to update the value.

Specified by:
registerLong in interface MetricRegistry
Parameters:
gaugeName - Name to associate with the gauge.
Returns:
Handle to modify the gauge value.