frankgh commented on code in PR #117:
URL: https://github.com/apache/cassandra-sidecar/pull/117#discussion_r1579905030
##########
src/main/java/org/apache/cassandra/sidecar/utils/SSTableImporter.java:
##########
@@ -310,6 +307,31 @@ private void cleanup(ImportOptions options)
cause));
}
+ /**
+ * Aggregates pending imports per host from multiple keyspaces and tables
+ */
+ private void reportPendingImportAggregates()
+ {
+ Map<String, Integer> aggregates = new HashMap<>();
+ for (Map.Entry<ImportKey, ImportQueue> entry :
importQueuePerHost.entrySet())
+ {
+ aggregates.compute(entry.getKey().host, (k, v) ->
entry.getValue().size() + (v == null ? 0 : v));
+ }
+
+ aggregates.forEach((host, count) -> {
+ try
+ {
+ // Report aggregate metrics for the queues
+ InstanceMetadata instance = metadataFetcher.instance(host);
+
instance.metrics().sstableImport().pendingImports.metric.setValue(count);
+ }
+ catch (Exception e)
+ {
+ LOGGER.warn("Unable to report metrics for host={}
pendingImports={}", host, count, e);
+ }
+ });
Review Comment:
I find this not as readable , so that's why I went the other way.
--
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]