com.twitter.common.metrics
Class Gauges

java.lang.Object
  extended by com.twitter.common.metrics.Gauges

public final class Gauges
extends Object

Convenience functions for working with Gauges.


Method Summary
static Supplier<Number> asSupplier(Gauge gauge)
          Creates a supplier that serves as an accessor for gauge values.
static void registerSize(MetricRegistry registry, String name, Collection collection)
          Registers the size of a collection as a gauge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asSupplier

public static Supplier<Number> asSupplier(Gauge gauge)
Creates a supplier that serves as an accessor for gauge values.

Parameters:
gauge - Gauge to turn into a supplier.
Returns:
Supplier of values from gauge.

registerSize

public static void registerSize(MetricRegistry registry,
                                String name,
                                Collection collection)
Registers the size of a collection as a gauge.

Parameters:
registry - Registry to register the gauge with.
name - Name for the gauge.
collection - Collection to register size of.