Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(slo): improve burn rate panel #197339

Merged
merged 19 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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