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


##########
src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java:
##########
@@ -393,12 +404,59 @@ private void initializeKeyspaces(NodeProbe probe, boolean 
ignore, List<String> t
                 if (table.getTopTombstonePartitionsLastUpdate() != null)
                     statsTable.topTombstonePartitionsLastUpdate = 
millisToDateString(table.getTopTombstonePartitionsLastUpdate());
 
+                if (!SchemaConstants.isSystemKeyspace(keyspaceName))
+                {
+                    if (table.hasStorageAttachedIndex())
+                    {
+                        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");
+                        statsTable.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", statsTable.saiTotalIndexCount, 
saiTotalQueryableIndexCount);

Review Comment:
   It prints the ratio up to 3 decimal places, which might not be the most 
suitable format. Please let me know if I’m referring to the wrong function.
   ```
   /**
        * Formats a ratio value for display, rounds it to three decimal places.
        * For example, "10.000", "1.000", "0.050", "0.001", "0.000", "NaN".
        * @param ratio   Ratio to print.
        */
       public static String prettyPrintRatio(double ratio)
       {
           return String.format("%.3f", ratio);
       }
   ```



-- 
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