sarankk commented on code in PR #111:
URL: https://github.com/apache/cassandra-sidecar/pull/111#discussion_r1561838832
##########
src/main/java/org/apache/cassandra/sidecar/utils/SSTableImporter.java:
##########
@@ -159,16 +159,45 @@ protected ImportQueue initializeQueue(String key)
*/
private void processPendingImports(Long timerId)
{
- for (ImportQueue queue : importQueuePerHost.values())
+ for (Map.Entry<String, ImportQueue> entry :
importQueuePerHost.entrySet())
{
+ ImportQueue queue = entry.getValue();
if (!queue.isEmpty())
{
+ recordPendingImports(hostFromKey(entry.getKey()),
entry.getValue().size());
executorPools.internal()
.executeBlocking(p ->
maybeDrainImportQueue(queue));
}
}
}
+ private void recordPendingImports(String host, int pendingImports)
+ {
+ if (host != null)
+ {
+ metadataFetcher.instance(host)
+ .metrics()
+
.sstableImport().pendingImports.metric.setValue(pendingImports);
+ }
+ }
+
+ /**
+ * Host is extracted from key for publishing Cassandra instance specific
metrics related to {@link ImportQueue}
+ *
+ * @param key a key for one of the import queues
+ * @return host for which the import queue is maintained
+ */
+ protected String hostFromKey(String key)
+ {
+ String[] keyParts = key.split("\\$");
Review Comment:
As discussed will capture the metric while draining the queue
--
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]