Skip to content

Commit

Permalink
fallback if get remote info fails to cluster health call
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
  • Loading branch information
amitgalitz committed Oct 11, 2024
1 parent 9402888 commit 08630a6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions server/routes/opensearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,19 @@ export default class OpenSearchService {

let clustersResponse: ClusterInfo[] = [];

const remoteInfo = await callWithRequest('transport.request', {
method: 'GET',
path: '/_remote/info',
});
clustersResponse = Object.keys(remoteInfo).map((key) => ({
name: key,
localCluster: false,
}));
try {
const remoteInfo = await callWithRequest('transport.request', {
method: 'GET',
path: '/_remote/info',
});
clustersResponse = Object.keys(remoteInfo).map((key) => ({
name: key,
localCluster: false,
}));
} catch (remoteErr) {
console.warn('Failed to fetch remote cluster info, proceeding with local datasource info only.', remoteErr);
}


const clusterHealth = await callWithRequest('cat.health', {
format: 'json',
Expand Down

0 comments on commit 08630a6

Please sign in to comment.