@@ -142,6 +142,21 @@ private void updateStats(NodeInfo nodeInfo, String metricName, Double value) {
142
142
}
143
143
}
144
144
145
+
146
+ if (metricName .startsWith ("org:apache:cassandra:metrics:compaction:pendingtasksbytablename:" )) {
147
+ int pathLength = "org:apache:cassandra:metrics:compaction:pendingtasksbytablename:" .length ();
148
+ int keyspacePos = metricName .indexOf (':' , pathLength );
149
+ int tablePos = metricName .indexOf (':' , keyspacePos + 1 );
150
+ String keyspaceName = metricName .substring (pathLength , keyspacePos );
151
+ String tableName = tablePos > 0 ? metricName .substring (keyspacePos + 1 , tablePos ) : "" ;
152
+
153
+ if (nodeInfo .keyspaces .contains (keyspaceName ) && nodeInfo .tables .contains (tableName )) {
154
+ this .stats .labels (concat (new String [] {nodeInfo .clusterName , nodeInfo .datacenterName , keyspaceName , tableName , metricName }, additionalLabelValues )).set (value );
155
+ return ;
156
+ }
157
+ }
158
+
159
+
145
160
this .stats .labels (concat ( new String [] { nodeInfo .clusterName , nodeInfo .datacenterName , "" , "" , metricName }, additionalLabelValues )).set (value );
146
161
}
147
162
@@ -297,6 +312,16 @@ private void updateMetric(MBeanServerConnection beanConn, MBeanInfo mBeanInfo, N
297
312
//Most beans declared as Object are Double in disguise
298
313
if (first >= '0' && first <= '9' ) {
299
314
updateStats (nodeInfo , mBeanInfo .metricName , Double .valueOf (str ));
315
+
316
+ } else if (first == '{' && mBeanInfo .metricName .equalsIgnoreCase ("org:apache:cassandra:metrics:compaction:pendingtasksbytablename:value" )) {
317
+ HashMap <String , HashMap <String , Integer >> pendingTasks = (HashMap <String , HashMap <String , Integer >>) value ;
318
+ for (String keyspace : pendingTasks .keySet ()) {
319
+ for (String table : pendingTasks .get (keyspace ).keySet ()) {
320
+ String labels = String .join (":" , keyspace , table , "value" );
321
+ String metricName = mBeanInfo .metricName .replace ("value" , labels );
322
+ updateStats (nodeInfo , metricName , pendingTasks .get (keyspace ).get (table ).doubleValue ());
323
+ }
324
+ }
300
325
301
326
// https://books.google.fr/books?id=BvsVuph6ehMC&pg=PA82
302
327
// EstimatedHistogram are object for JMX but are long[] behind
0 commit comments