From 6406c5b6e9197e6f504ea0c549b1f810d72d9545 Mon Sep 17 00:00:00 2001 From: AWSHurneyt Date: Wed, 4 Oct 2023 16:25:41 -0700 Subject: [PATCH] Troubleshooting. Signed-off-by: AWSHurneyt --- .../main/kotlin/org/opensearch/alerting/InputService.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt b/alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt index 16bc62aa1..cad0b9448 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt @@ -121,20 +121,23 @@ class InputService( } is ClusterMetricsInput -> { logger.debug("ClusterMetricsInput clusterMetricType: ${input.clusterMetricType}") - logger.info("hurneyt ClusterMetricsInput::clustersAliases = ${input.clusters}") if (input.clusters.isNotEmpty()) { + logger.info("hurneyt ClusterMetricsInput HAS REMOTE CLUSTERS") client.threadPool().threadContext.stashContext().use { scope.launch { + val responseMap = mutableMapOf>() input.clusters.forEach { cluster -> logger.info("hurneyt ClusterMetricsInput::cluster = $cluster") val targetClient = CrossClusterMonitorUtils.getClientForCluster(cluster, client, clusterService) val response = executeTransportAction(input, targetClient) // Not all supported API reference the cluster name in their response. - // Mapping each response to the cluster name. - results += mapOf(cluster to response.toMap()) + // Mapping each response to the cluster name before adding to results. + // Not adding this same logic for local-only monitors to avoid breaking existing monitors. + responseMap[cluster] = response.toMap() } + results += responseMap } } } else {