maedhroz commented on code in PR #3742:
URL: https://github.com/apache/cassandra/pull/3742#discussion_r1894132851


##########
src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java:
##########
@@ -393,12 +404,62 @@ private void initializeKeyspaces(NodeProbe probe, boolean 
ignore, List<String> t
                 if (table.getTopTombstonePartitionsLastUpdate() != null)
                     statsTable.topTombstonePartitionsLastUpdate = 
millisToDateString(table.getTopTombstonePartitionsLastUpdate());
 
+                if (!isSystemKeyspaces(keyspaceName))
+                {
+                    Object queryLatencyMetric = 
probe.getSaiMetric(keyspaceName, tableName, "QueryLatency");
+                    double QueryLatency = getMetricMean(queryLatencyMetric);
+                    statsTable.saiQueryLatencyMs = QueryLatency > 0 ? 
QueryLatency : Double.NaN;
+
+                    Object PostFilteringReadLatency = 
probe.getSaiMetric(keyspaceName, tableName, "PostFilteringReadLatency");
+                    double postfilteringreadlatency = 
getMetricMean(PostFilteringReadLatency);
+                    statsTable.saiPostFilteringReadLatencyms = 
postfilteringreadlatency > 0 ? postfilteringreadlatency : Double.NaN;
+
+                    Object diskUsedBytes = probe.getSaiMetric(keyspaceName, 
tableName, "DiskUsedBytes");
+                    long saidiskusedbytes = (diskUsedBytes != null) ? (long) 
diskUsedBytes : 0L;
+                    statsTable.saiDiskUsedBytes = 
FileUtils.stringifyFileSize(saidiskusedbytes, humanReadable);
+
+                    Object SSTableIndexesHit = 
probe.getSaiMetric(keyspaceName, tableName, "SSTableIndexesHit");
+                    statsTable.saiSSTableIndexesHit = 
getMetricMean(SSTableIndexesHit);
+
+                    Object IndexSegmentsHit = probe.getSaiMetric(keyspaceName, 
tableName, "IndexSegmentsHit");
+                    statsTable.saiIndexSegmentsHit = 
getMetricMean(IndexSegmentsHit);
+
+                    Object RowsFiltered = probe.getSaiMetric(keyspaceName, 
tableName, "RowsFiltered");
+                    statsTable.saiRowsFiltered = getMetricMean(RowsFiltered);
+
+                    Object totalQueryTimeouts = 
probe.getSaiMetric(keyspaceName, tableName, "TotalQueryTimeouts");
+                    statsTable.saiTotalQueryTimeouts = (totalQueryTimeouts != 
null) ? (Long) totalQueryTimeouts : 0L;
+
+                    Object totalIndexCount = probe.getSaiMetric(keyspaceName, 
tableName, "TotalIndexCount");
+                    int saiTotalIndexCount = (totalIndexCount != null) ? (int) 
totalIndexCount : 0;
+
+                    Object totalQueryableIndexCount = 
probe.getSaiMetric(keyspaceName, tableName, "TotalQueryableIndexCount");
+                    int saiTotalQueryableIndexCount = 
(totalQueryableIndexCount != null) ? (int) totalQueryableIndexCount : 0;
+
+                    statsTable.saiTotalQueryableIndexRatio = 
String.format("%d/%d", saiTotalIndexCount, saiTotalQueryableIndexCount);
+                }
+
                 statsKeyspace.tables.add(statsTable);
             }
             keyspaces.add(statsKeyspace);
         }
     }
 
+    private boolean isSystemKeyspaces(String keyspaceName)
+    {
+        return SchemaConstants.isSystemKeyspace(keyspaceName);

Review Comment:
   nit: Here and in `TableStatsPrinter` we could probably just inline the 
`SchemaConstants.isSystemKeyspace()` call. It's only used once in both classes 
anyway...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to