From 6af76f0ea73df6e6f83d7d67753795cc6ec2ae67 Mon Sep 17 00:00:00 2001 From: AWSHurneyt Date: Mon, 5 Feb 2024 02:47:58 -0800 Subject: [PATCH] Troubleshooting. Signed-off-by: AWSHurneyt --- .../main/kotlin/org/opensearch/alerting/InputService.kt | 7 ++++--- 1 file changed, 4 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 604b0ae75..c4342d1f6 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt @@ -129,21 +129,22 @@ class InputService( if (remoteMonitoringEnabled && input.clusters.isNotEmpty()) { val responseMap = mutableMapOf>() client.threadPool().threadContext.stashContext().use { - input.clusters.forEach { cluster -> - scope.launch { + scope.launch { // val singleThreadContext = newSingleThreadContext("ClusterMetricsInputThread") // withContext(singleThreadContext) { // // } + input.clusters.forEach { 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 before adding to results. // Not adding this same logic for local-only monitors to avoid breaking existing monitors. responseMap[cluster] = response.toMap() + } + results += responseMap } - results += responseMap } // todo hurneyt delete? // while (responseMap.size < input.clusters.size) {