Skip to content

Commit

Permalink
[Improvement] node healthcheck optimization (#1386)
Browse files Browse the repository at this point in the history
Health check when enabled checked the entire cluster to get
the value set from the nodeId. Switching the health check to
query /_cluster/state/nodes should provide the same data needed
for the health check without transmitting the rest of the
cluster state data over the network.

Issue:
#1354

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla authored Mar 29, 2022
1 parent 327bdaf commit 920cd5e
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const getNodeId = async (
): Promise<string | null> => {
try {
const state = (await internalClient.cluster.state({
metric: 'nodes',
filter_path: [`nodes.*.attributes.${healthcheckAttributeName}`],
})) as ApiResponse;
/* Aggregate different cluster_ids from the OpenSearch nodes
Expand Down Expand Up @@ -221,6 +222,7 @@ export const pollOpenSearchNodesVersion = ({
from(
internalClient.nodes.info<NodesInfo>({
node_id: nodeId,
metric: 'process',
filter_path: ['nodes.*.version', 'nodes.*.http.publish_address', 'nodes.*.ip'],
})
).pipe(
Expand Down

0 comments on commit 920cd5e

Please sign in to comment.