Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
Add storage data to each report
Browse files Browse the repository at this point in the history
Resolves #30 and corrects a problem with PendingTasks
  • Loading branch information
rkuris committed Dec 16, 2014
1 parent cb14698 commit a2256ac
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/ar/com/threelegs/newrelic/CassandraRing.java
Expand Up @@ -76,12 +76,23 @@ public List<Metric> execute(MBeanServerConnection connection) throws Exception {
// System
Integer cpt = JMXHelper.queryAndGetAttribute(connection,
JMXHelper.getObjectNameByKeys("org.apache.cassandra.metrics", "type=Compaction", "name=PendingTasks"), "Value");
Long mpt = JMXHelper.queryAndGetAttribute(connection, JMXHelper.getObjectNameByKeys("org.apache.cassandra.metrics",
"type=ThreadPools", "path=internal", "scope=MemtablePostFlusher", "name=PendingTasks"), "Value");
Long mpt = JMXHelper.queryAndGetAttribute(connection, JMXHelper.getObjectNameByKeys("org.apache.cassandra.internal",
"type=MemtablePostFlush"), "PendingTasks");

metrics.add(new Metric("Cassandra/hosts/" + host + "/Compaction/PendingTasks", "count", cpt));
metrics.add(new Metric("Cassandra/hosts/" + host + "/MemtableFlush/PendingTasks", "count", mpt));

// Storage
Double load = JMXHelper.queryAndGetAttribute(connection,
JMXHelper.getObjectNameByKeys("org.apache.cassandra.db", "type=StorageService"), "Load");
metrics.add(new Metric("Cassandra/host/" + host + "/Storage/Data", "bytes", load));
metrics.add(new Metric("Cassandra/global/Storage/Data", "bytes", load));

Long commitLog = JMXHelper.queryAndGetAttribute(connection,
JMXHelper.getObjectNameByKeys("org.apache.cassandra.db", "type=Commitlog"), "TotalCommitlogSize");
metrics.add(new Metric("Cassandra/host/" + host + "/Storage/CommitLog", "bytes", commitLog));
metrics.add(new Metric("Cassandra/global/Storage/CommitLog", "bytes", commitLog));

// Cache
Double kchr = JMXHelper.queryAndGetAttribute(connection,
JMXHelper.getObjectNameByKeys("org.apache.cassandra.metrics", "type=Cache", "scope=KeyCache", "name=HitRate"),
Expand Down

0 comments on commit a2256ac

Please sign in to comment.