Skip to content

Commit

Permalink
fallback if get remote info fails to cluster health call (#886)
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <[email protected]>
  • Loading branch information
amitgalitz authored Oct 14, 2024
1 parent 9402888 commit c6f33ce
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 c6f33ce

Please sign in to comment.