Skip to content

Commit

Permalink
Added support for remote cluster metrics monitor calls.
Browse files Browse the repository at this point in the history
Signed-off-by: AWSHurneyt <[email protected]>
  • Loading branch information
AWSHurneyt committed Sep 15, 2023
1 parent 04b11ee commit 96bb36a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,27 @@ class InputService(
prevResult?.aggTriggersAfterKey
)
results += searchResponse.convertToMap()
logger.info("hurneyt results = $results")
logger.info("hurneyt SearchInput::results = $results")
}
is ClusterMetricsInput -> {
logger.debug("ClusterMetricsInput clusterMetricType: ${input.clusterMetricType}")
val response = executeTransportAction(input, client)
results += response.toMap()

logger.info("hurneyt ClusterMetricsInput::clustersAliases = ${input.clustersAliases}")
if (input.clustersAliases.isNotEmpty()) {
input.clustersAliases.forEach { alias ->
logger.info("hurneyt ClusterMetricsInput::alias = $alias")
val targetClient =
if (clusterService.clusterName.value() == alias) client
else client.getRemoteClusterClient(alias)
val response = executeTransportAction(input, targetClient)
results += response.toMap()
}
} else {
logger.info("hurneyt ClusterMetricsInput NO REMOTE CLUSTERS")
val response = executeTransportAction(input, client)
results += response.toMap()
}
logger.info("hurneyt ClusterMetricsInput::results = $results")
}
else -> {
throw IllegalArgumentException("Unsupported input type: ${input.name()}.")
Expand Down

0 comments on commit 96bb36a

Please sign in to comment.