Skip to content

Commit 3477c9a

Browse files
Merge pull request #581 from falox/render-short-events
OU-1011: Render short-lived incidents and alerts
2 parents 81cfc77 + 5e0c1c0 commit 3477c9a

File tree

9 files changed

+1992
-203
lines changed

9 files changed

+1992
-203
lines changed

web/src/components/Incidents/IncidentsChart/IncidentsChart.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ import {
2626
import '../incidents-styles.css';
2727
import { IncidentsTooltip } from '../IncidentsTooltip';
2828
import { Incident } from '../model';
29-
import { calculateChartDomain, createIncidentsChartBars, generateDateArray } from '../utils';
29+
import {
30+
calculateIncidentsChartDomain,
31+
createIncidentsChartBars,
32+
generateDateArray,
33+
} from '../utils';
3034
import { dateTimeFormatter } from '../../console/utils/datetime';
3135
import { useTranslation } from 'react-i18next';
3236
import { DataTestIDs } from '../../data-test';
@@ -202,7 +206,7 @@ const IncidentsChart = ({
202206
tickLabelComponent={
203207
<ChartLabel style={{ fill: theme === 'light' ? '#1b1d21' : '#e0e0e0' }} />
204208
}
205-
domain={calculateChartDomain(dateValues, chartData)}
209+
domain={calculateIncidentsChartDomain(dateValues)}
206210
/>
207211
<ChartGroup horizontal data-test={DataTestIDs.IncidentsChart.ChartBars}>
208212
{chartData.map((bar) => {

web/src/components/Incidents/IncidentsPage.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Helmet } from 'react-helmet';
2525
import { IncidentsTable } from './IncidentsTable';
2626
import {
2727
getIncidentsTimeRanges,
28-
processIncidents,
28+
convertToIncidents,
2929
processIncidentsForAlerts,
3030
} from './processIncidents';
3131
import {
@@ -37,7 +37,7 @@ import {
3737
parseUrlParams,
3838
updateBrowserUrl,
3939
} from './utils';
40-
import { groupAlertsForTable, processAlerts } from './processAlerts';
40+
import { groupAlertsForTable, convertToAlerts } from './processAlerts';
4141
import { CompressArrowsAltIcon, CompressIcon, FilterIcon } from '@patternfly/react-icons';
4242
import { useDispatch, useSelector } from 'react-redux';
4343
import {
@@ -251,10 +251,10 @@ const IncidentsPage = () => {
251251
}),
252252
)
253253
.then((results) => {
254-
const aggregatedData = results.flat();
254+
const prometheusResults = results.flat();
255255
dispatch(
256256
setAlertsData({
257-
alertsData: processAlerts(aggregatedData, incidentForAlertProcessing),
257+
alertsData: convertToAlerts(prometheusResults, incidentForAlertProcessing),
258258
}),
259259
);
260260
if (!isEmpty(filteredData)) {
@@ -304,23 +304,23 @@ const IncidentsPage = () => {
304304
}),
305305
)
306306
.then((results) => {
307-
const aggregatedData = results.flat();
308-
const processedIncidents = processIncidents(aggregatedData);
307+
const prometheusResults = results.flat();
308+
const incidents = convertToIncidents(prometheusResults);
309309

310310
// Update the raw, unfiltered incidents state
311-
dispatch(setIncidents({ incidents: processedIncidents }));
311+
dispatch(setIncidents({ incidents }));
312312

313-
// Now, dispatch the filtered data based on the full incidents list
313+
// Filter the incidents and dispatch
314314
dispatch(
315315
setFilteredIncidentsData({
316-
filteredIncidentsData: filterIncident(incidentsActiveFilters, processedIncidents),
316+
filteredIncidentsData: filterIncident(incidentsActiveFilters, incidents),
317317
}),
318318
);
319319

320320
setIncidentsAreLoading(false);
321321

322322
if (isGroupSelected) {
323-
setIncidentForAlertProcessing(processIncidentsForAlerts(aggregatedData));
323+
setIncidentForAlertProcessing(processIncidentsForAlerts(prometheusResults));
324324
// Only set loading if we don't already have data to show
325325
if (isEmpty(alertsData)) {
326326
dispatch(setAlertsAreLoading({ alertsAreLoading: true }));

web/src/components/Incidents/model.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ export type Metric = {
3030
};
3131

3232
export type ProcessedIncident = Incident & {
33-
informative: boolean;
34-
critical: boolean;
35-
warning: boolean;
3633
resolved: boolean;
3734
firing: boolean;
3835
};

0 commit comments

Comments
 (0)