Skip to content

Commit

Permalink
Troubleshooting.
Browse files Browse the repository at this point in the history
Signed-off-by: AWSHurneyt <[email protected]>
  • Loading branch information
AWSHurneyt committed Feb 5, 2024
1 parent 89a5a07 commit 2622aaf
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ package org.opensearch.alerting
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.newSingleThreadContext
import kotlinx.coroutines.withContext
import org.apache.logging.log4j.LogManager
import org.opensearch.action.search.SearchRequest
import org.opensearch.action.search.SearchResponse
Expand Down Expand Up @@ -133,22 +131,24 @@ class InputService(
client.threadPool().threadContext.stashContext().use {
input.clusters.forEach { cluster ->
scope.launch {
val singleThreadContext = newSingleThreadContext("ClusterMetricsInputThread")
withContext(singleThreadContext) {
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()
}
// val singleThreadContext = newSingleThreadContext("ClusterMetricsInputThread")
// withContext(singleThreadContext) {
//
// }
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
}
// todo hurneyt delete?
// while (responseMap.size < input.clusters.size) {
// }
results += responseMap
// results += responseMap
} else {
val response = executeTransportAction(input, client)
results += response.toMap()
Expand Down

0 comments on commit 2622aaf

Please sign in to comment.