Skip to content

Commit

Permalink
fallback if get remote info fails to cluster health call (opensearch-…
Browse files Browse the repository at this point in the history
…project#886)

Signed-off-by: Amit Galitzky <[email protected]>
  • Loading branch information
amitgalitz committed Oct 14, 2024
1 parent 86adb4f commit 55be031
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 55be031

Please sign in to comment.