sklaha commented on code in PR #249:
URL: https://github.com/apache/cassandra-sidecar/pull/249#discussion_r2291629630


##########
adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/CassandraMetricsOperations.java:
##########
@@ -250,4 +295,186 @@ private List<ClientConnectionEntry> 
statsToEntries(Stream<ConnectedClientStats>
                                          stat.authenticationMode,
                                          stat.authenticationMetadata);
     }
+
+    /**
+     * Represents the metrics related to compaction stats that are supported 
by the Sidecar
+     */
+    public enum CompactionStatsMetrics
+    {
+        TOTAL_COMPACTIONS_COMPLETED("TotalCompactionsCompleted", 
MetricType.COUNTER),
+        BYTES_COMPACTED("BytesCompacted", MetricType.COUNTER),
+        COMPACTIONS_ABORTED("CompactionsAborted", MetricType.COUNTER),
+        COMPACTIONS_REDUCED("CompactionsReduced", MetricType.COUNTER),
+        SSTABLES_DROPPED_FROM_COMPACTION("SSTablesDroppedFromCompaction", 
MetricType.COUNTER),
+        PENDING_TASKS_BY_TABLE_NAME("PendingTasksByTableName", 
MetricType.GAUGE);
+
+        private final String metricName;
+        private final MetricType type;
+
+        CompactionStatsMetrics(String metricName, MetricType type)
+        {
+            this.metricName = metricName;
+            this.type = type;
+        }
+
+        String metricName()
+        {
+            return metricName;
+        }
+    }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public CompactionStatsResponse compactionStats()
+    {
+        // Get compaction manager and storage service proxies
+        CompactionManagerJmxOperations compactionManager = 
jmxClient.proxy(CompactionManagerJmxOperations.class, 
COMPACTION_MANAGER_OBJ_NAME);

Review Comment:
   Would you like to have a separate class which will have the business logic? 
Or would like like me to keep the business logic here and move the data 
retrieval to somewhere else? Please note that we compaction stats require 
multiple JMX objects like storage, compaction, metrics for the data.



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to