Skip to content

Commit

Permalink
[8.x] feat(slo): improve burn rate panel (#197339) (#200229)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [feat(slo): improve burn rate panel
(#197339)](#197339)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kevin
Delemme","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-13T17:52:19Z","message":"feat(slo):
improve burn rate panel
(#197339)","sha":"a5b266c45b7db8821281a2325d919b6fdf679618","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.17.0"],"number":197339,"url":"https://github.com/elastic/kibana/pull/197339","mergeCommit":{"message":"feat(slo):
improve burn rate panel
(#197339)","sha":"a5b266c45b7db8821281a2325d919b6fdf679618"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197339","number":197339,"mergeCommit":{"message":"feat(slo):
improve burn rate panel
(#197339)","sha":"a5b266c45b7db8821281a2325d919b6fdf679618"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
  • Loading branch information
kdelemme authored Nov 14, 2024
1 parent a878dc8 commit 971b74e
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 971b74e

Please sign in to comment.