Skip to content

Commit 28c47fa

Browse files
committed
Make alert status fetching more resilient
1 parent 6e80d9f commit 28c47fa

2 files changed

Lines changed: 29 additions & 17 deletions

File tree

x-pack/plugins/monitoring/public/views/base_controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ export class MonitoringViewBaseController {
163163
if (isSetupModeFeatureEnabled(SetupModeFeature.MetricbeatMigration)) {
164164
promises.push(updateSetupModeData());
165165
}
166-
this.updateDataPromise = new PromiseWithCancel(Promise.all(promises));
166+
this.updateDataPromise = new PromiseWithCancel(Promise.allSettled(promises));
167167
return this.updateDataPromise.promise().then(([pageData, alerts]) => {
168168
$scope.$apply(() => {
169169
this._isDataInitialized = true; // render will replace loading screen with the react component
170-
$scope.pageData = this.data = pageData; // update the view's data with the fetch result
171-
$scope.alerts = this.alerts = alerts;
170+
$scope.pageData = this.data = pageData.value; // update the view's data with the fetch result
171+
$scope.alerts = this.alerts = alerts.value || {};
172172
});
173173
});
174174
};

x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,32 @@ export async function getClustersFromRequest(
151151
'production'
152152
);
153153
if (prodLicenseInfo.clusterAlerts.enabled) {
154-
cluster.alerts = {
155-
list: await fetchStatus(
156-
alertsClient,
157-
req.server.plugins.monitoring.info,
158-
undefined,
159-
cluster.cluster_uuid,
160-
start,
161-
end,
162-
[]
163-
),
164-
alertsMeta: {
165-
enabled: true,
166-
},
167-
};
154+
try {
155+
cluster.alerts = {
156+
list: await fetchStatus(
157+
alertsClient,
158+
req.server.plugins.monitoring.info,
159+
undefined,
160+
cluster.cluster_uuid,
161+
start,
162+
end,
163+
[]
164+
),
165+
alertsMeta: {
166+
enabled: true,
167+
},
168+
};
169+
} catch (err) {
170+
req.logger.warn(
171+
`Unable to fetch alert status because '${err.message}'. Alerts may not properly show up in the UI.`
172+
);
173+
cluster.alerts = {
174+
list: {},
175+
alertsMeta: {
176+
enabled: true,
177+
},
178+
};
179+
}
168180
continue;
169181
}
170182

0 commit comments

Comments
 (0)