Skip to content

Commit

Permalink
feat(slo): improve burn rate panel (elastic#197339)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelemme authored and CAWilson94 committed Nov 18, 2024
1 parent 4d55d5f commit a12a2a3
Show file tree
Hide file tree
Showing 32 changed files with 599 additions and 579 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import React, { useEffect } from 'react';
import { EuiFlexGroup, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AlertDetailsAppSectionProps } from '@kbn/observability-plugin/public';
import { useKibana } from '../../../../hooks/use_kibana';
import { useFetchSloDetails } from '../../../../hooks/use_fetch_slo_details';
import { useKibana } from '../../hooks/use_kibana';
import { useFetchSloDetails } from '../../hooks/use_fetch_slo_details';
import { CustomAlertDetailsPanel } from './components/custom_panels/custom_panels';
import { ErrorRatePanel } from './components/error_rate/error_rate_panel';
import { BurnRateAlert, BurnRateRule } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { GetSLOResponse } from '@kbn/slo-schema';
import React from 'react';
import { LogRateAnalysisPanel } from './log_rate_analysis_panel';
import { BurnRateAlert, BurnRateRule } from '../../../types';
import { useLicense } from '../../../../../../../hooks/use_license';
import { useLicense } from '../../../../../hooks/use_license';

interface Props {
slo: GetSLOResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import { colorTransformer } from '@kbn/observability-shared-plugin/common';
import { KQLCustomIndicator, DurationUnit } from '@kbn/slo-schema';
import { i18n } from '@kbn/i18n';
import type { Message } from '@kbn/observability-ai-assistant-plugin/public';
import type { WindowSchema } from '../../../../../../../typings';
import { TimeRange } from '../../../../../error_rate_chart/use_lens_definition';
import type { WindowSchema } from '../../../../../typings';
import { TimeRange } from '../../../../slo/error_rate_chart/use_lens_definition';
import { BurnRateAlert, BurnRateRule } from '../../../types';
import { getActionGroupFromReason } from '../../../utils/alert';
import { useKibana } from '../../../../../../../hooks/use_kibana';
import { useKibana } from '../../../../../hooks/use_kibana';
import { getESQueryForLogRateAnalysis } from './helpers/log_rate_analysis_query';
function getDataTimeRange(
timeRange: { gte: string; lte?: string },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { ALERT_EVALUATION_VALUE, ALERT_TIME_RANGE } from '@kbn/rule-data-utils';
import { GetSLOResponse } from '@kbn/slo-schema';
import React from 'react';
import { useKibana } from '../../../../../../hooks/use_kibana';
import { ErrorRateChart } from '../../../../error_rate_chart';
import { TimeRange } from '../../../../error_rate_chart/use_lens_definition';
import { useKibana } from '../../../../hooks/use_kibana';
import { ErrorRateChart } from '../../../slo/error_rate_chart';
import { TimeRange } from '../../../slo/error_rate_chart/use_lens_definition';
import { BurnRateAlert } from '../../types';
import { getActionGroupWindow } from '../../utils/alert';
import { getLastDurationInUnit } from '../../utils/last_duration_i18n';
Expand Down Expand Up @@ -153,7 +153,7 @@ export function ErrorRatePanel({ alert, slo, isLoading }: Props) {
dataTimeRange={dataTimeRange}
alertTimeRange={alertTimeRange}
threshold={actionGroupWindow!.burnRateThreshold}
showErrorRateAsLine
variant="danger"
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import type { Rule } from '@kbn/alerting-plugin/common';
import type { TopAlert } from '@kbn/observability-plugin/public';
import type { BurnRateRuleParams } from '../../../../typings/slo';
export type { TimeRange } from '../../error_rate_chart/use_lens_definition';
import type { BurnRateRuleParams } from '../../typings/slo';
export type { TimeRange } from '../slo/error_rate_chart/use_lens_definition';

export type BurnRateRule = Rule<BurnRateRuleParams>;
export type BurnRateAlert = TopAlert;
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
HIGH_PRIORITY_ACTION_ID,
LOW_PRIORITY_ACTION_ID,
MEDIUM_PRIORITY_ACTION_ID,
} from '../../../../../../common/constants';
} from '../../../../common/constants';
import { BurnRateAlert } from '../types';
import { WindowSchema } from '../../../../../typings';
import { WindowSchema } from '../../../typings';

export function getActionGroupFromReason(reason: string): string {
const prefix = reason.split(':')[0]?.toLowerCase() ?? undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { i18n } from '@kbn/i18n';
import moment from 'moment';
import { TimeRange } from '../../../error_rate_chart/use_lens_definition';
import { TimeRange } from '../../slo/error_rate_chart/use_lens_definition';

export function getLastDurationInUnit(timeRange: TimeRange): string {
const duration = moment.duration(moment(timeRange.to).diff(timeRange.from));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type { DateRange } from '@kbn/alerting-plugin/common';
import { ALERT_TIME_RANGE } from '@kbn/rule-data-utils';
import { TimeRange } from '../../../error_rate_chart/use_lens_definition';
import { TimeRange } from '../../slo/error_rate_chart/use_lens_definition';
import { BurnRateAlert } from '../types';
import { getActionGroupWindow } from './alert';

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a12a2a3

Please sign in to comment.