Skip to content

Commit

Permalink
Make alert status fetching more resilient (elastic#84676)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline authored Dec 2, 2020
1 parent 452f841 commit 2ad3d2b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/monitoring/public/views/base_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ export class MonitoringViewBaseController {
if (isSetupModeFeatureEnabled(SetupModeFeature.MetricbeatMigration)) {
promises.push(updateSetupModeData());
}
this.updateDataPromise = new PromiseWithCancel(Promise.all(promises));
this.updateDataPromise = new PromiseWithCancel(Promise.allSettled(promises));
return this.updateDataPromise.promise().then(([pageData, alerts]) => {
$scope.$apply(() => {
this._isDataInitialized = true; // render will replace loading screen with the react component
$scope.pageData = this.data = pageData; // update the view's data with the fetch result
$scope.alerts = this.alerts = alerts;
$scope.pageData = this.data = pageData.value; // update the view's data with the fetch result
$scope.alerts = this.alerts = alerts.value || {};
});
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,32 @@ export async function getClustersFromRequest(
'production'
);
if (prodLicenseInfo.clusterAlerts.enabled) {
cluster.alerts = {
list: await fetchStatus(
alertsClient,
req.server.plugins.monitoring.info,
undefined,
cluster.cluster_uuid,
start,
end,
[]
),
alertsMeta: {
enabled: true,
},
};
try {
cluster.alerts = {
list: await fetchStatus(
alertsClient,
req.server.plugins.monitoring.info,
undefined,
cluster.cluster_uuid,
start,
end,
[]
),
alertsMeta: {
enabled: true,
},
};
} catch (err) {
req.logger.warn(
`Unable to fetch alert status because '${err.message}'. Alerts may not properly show up in the UI.`
);
cluster.alerts = {
list: {},
alertsMeta: {
enabled: true,
},
};
}
continue;
}

Expand Down

0 comments on commit 2ad3d2b

Please sign in to comment.