com.datastax.driver.core
Class Metrics

java.lang.Object
  extended by com.datastax.driver.core.Metrics

public class Metrics
extends Object

Metrics exposed by the driver.

The metrics exposed by this class use the Metrics library and you should refer its documentation for details on how to handle the exposed metric objects.

By default, metrics are exposed through JMX, which is very useful for development and browsing, but for production environment you may want to have a look at the reporters provided by the Metrics library which could be more efficient/adapted.


Nested Class Summary
 class Metrics.Errors
          Metrics on errors encountered.
 
Method Summary
 com.yammer.metrics.core.Gauge<Integer> getConnectedToHosts()
          The number of Cassandra hosts the driver is currently connected to (i.e.
 Metrics.Errors getErrorMetrics()
          An object regrouping metrics related to the errors encountered.
 com.yammer.metrics.core.Gauge<Integer> getKnownHosts()
          The number of Cassandra hosts currently known by the driver (whether they are currently considered up or down).
 com.yammer.metrics.core.Gauge<Integer> getOpenConnections()
          The total number of currently opened connections to Cassandra hosts.
 com.yammer.metrics.core.MetricsRegistry getRegistry()
          The registry containing all metrics.
 com.yammer.metrics.core.Timer getRequestsTimer()
          Metrics on the user requests performed on the Cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRegistry

public com.yammer.metrics.core.MetricsRegistry getRegistry()
The registry containing all metrics.

The metrics registry allows you to easily use the reporters that ships with Metrics or a custom written one. For instance, you can easily export metrics to csv files using:

     com.yammer.metrics.reporting.CsvReporter.enable(new File("measurements/"), 1, TimeUnit.SECONDS);
 

Returns:
the registry containing all metrics.

getRequestsTimer

public com.yammer.metrics.core.Timer getRequestsTimer()
Metrics on the user requests performed on the Cluster.

This metric exposes

Returns:
a Timer metric object exposing the rate and latency for user requests.

getErrorMetrics

public Metrics.Errors getErrorMetrics()
An object regrouping metrics related to the errors encountered.

Returns:
an object regrouping metrics related to the errors encountered.

getKnownHosts

public com.yammer.metrics.core.Gauge<Integer> getKnownHosts()
The number of Cassandra hosts currently known by the driver (whether they are currently considered up or down).

Returns:
the number of Cassandra hosts currently known by the driver.

getConnectedToHosts

public com.yammer.metrics.core.Gauge<Integer> getConnectedToHosts()
The number of Cassandra hosts the driver is currently connected to (i.e. have at least one connection opened to).

Returns:
the number of Cassandra hosts the driver is currently connected to.

getOpenConnections

public com.yammer.metrics.core.Gauge<Integer> getOpenConnections()
The total number of currently opened connections to Cassandra hosts.

Returns:
The total number of currently opened connections to Cassandra hosts.


Copyright © 2013. All Rights Reserved.