public class Metrics extends Object
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 environments you may want to have a look at the reporters provided by the Metrics library which could be more efficient/adapted.
Modifier and Type | Class and Description |
---|---|
class |
Metrics.Errors
Metrics on errors encountered.
|
Modifier and Type | Method and Description |
---|---|
com.yammer.metrics.core.Gauge<Integer> |
getConnectedToHosts()
Returns the number of Cassandra hosts the driver is currently connected to
(that is have at least one connection opened to).
|
Metrics.Errors |
getErrorMetrics()
Returns an object regrouping metrics related to the errors encountered.
|
com.yammer.metrics.core.Gauge<Integer> |
getKnownHosts()
Returns the number of Cassandra hosts currently known by the driver (that is
whether they are currently considered up or down).
|
com.yammer.metrics.core.Gauge<Integer> |
getOpenConnections()
Returns the total number of currently opened connections to Cassandra hosts.
|
com.yammer.metrics.core.MetricsRegistry |
getRegistry()
Returns the registry containing all metrics.
|
com.yammer.metrics.core.Timer |
getRequestsTimer()
Returns metrics on the user requests performed on the Cluster.
|
public com.yammer.metrics.core.MetricsRegistry getRegistry()
The metrics registry allows you to easily use the reporters that ships
with Metrics
or a custom written one. For instance, if metrics
is this
object,
you can easily export the metrics to csv files using:
com.yammer.metrics.reporting.CsvReporter.enable(metrics.getRegistry(), new File("measurements/"), 1, TimeUnit.SECONDS);
public com.yammer.metrics.core.Timer getRequestsTimer()
This metric exposes
Timer
metric object exposing the rate and latency for
user requests.public Metrics.Errors getErrorMetrics()
public com.yammer.metrics.core.Gauge<Integer> getKnownHosts()
public com.yammer.metrics.core.Gauge<Integer> getConnectedToHosts()
public com.yammer.metrics.core.Gauge<Integer> getOpenConnections()
Copyright © 2014. All Rights Reserved.