mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Change kibana.alert.evaluation.threshold unit to microseconds (#158703)
Resolves #156255 Fixes #158204 Partially reverts #154801 [RFC Document](https://docs.google.com/document/d/1-O6-nqOedrjtTF9mHawd_u-vUdXu06KGI8ic5qNeQPQ/edit?usp=sharing) ## Summary This PR changes kibana.alert.evaluation.threshold unit to microseconds in AAD. |Case|Screenshot| |----|---| |Saved value in AAD|| |Should show correct information in flyout|| |Should show correct information on alert details page|| |Should show correct information in action message|| |Same unit for value and threshold in the alert table|| ## 🧪 How to test - Generate an APM Latency threshold alert - Check the threshold in - Alert's flyout - Alert's table - Alert details page (summary and chart) - Action generated by this alert
This commit is contained in:
parent
81b9bd2d90
commit
d13f884ec3
3 changed files with 4 additions and 16 deletions
|
@ -21,7 +21,6 @@ import React, { useEffect, useMemo } from 'react';
|
|||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { getPaddedAlertTimeRange } from '@kbn/observability-alert-details';
|
||||
import { EuiCallOut } from '@elastic/eui';
|
||||
import { toMicroseconds as toMicrosecondsUtil } from '../../../../../common/utils/formatters';
|
||||
import { SERVICE_ENVIRONMENT } from '../../../../../common/es_fields/apm';
|
||||
import { ChartPointerEventContextProvider } from '../../../../context/chart_pointer_event/chart_pointer_event_context';
|
||||
import { TimeRangeMetadataContextProvider } from '../../../../context/time_range_metadata/time_range_metadata_context';
|
||||
|
@ -37,9 +36,6 @@ import {
|
|||
TRANSACTION_TYPE,
|
||||
} from './types';
|
||||
|
||||
const toMicroseconds = (value?: number) =>
|
||||
value ? toMicrosecondsUtil(value, 'milliseconds') : value;
|
||||
|
||||
export function AlertDetailsAppSection({
|
||||
rule,
|
||||
alert,
|
||||
|
@ -69,7 +65,7 @@ export function AlertDetailsAppSection({
|
|||
),
|
||||
value: formatAlertEvaluationValue(
|
||||
alert?.fields[ALERT_RULE_TYPE_ID],
|
||||
toMicroseconds(alert?.fields[ALERT_EVALUATION_THRESHOLD])
|
||||
alert?.fields[ALERT_EVALUATION_THRESHOLD]
|
||||
),
|
||||
},
|
||||
{
|
||||
|
|
|
@ -280,7 +280,7 @@ export function registerTransactionDurationRuleType({
|
|||
[TRANSACTION_NAME]: ruleParams.transactionName,
|
||||
[PROCESSOR_EVENT]: ProcessorEvent.transaction,
|
||||
[ALERT_EVALUATION_VALUE]: transactionDuration,
|
||||
[ALERT_EVALUATION_THRESHOLD]: ruleParams.threshold,
|
||||
[ALERT_EVALUATION_THRESHOLD]: thresholdMicroseconds,
|
||||
[ALERT_REASON]: reason,
|
||||
...sourceFields,
|
||||
...groupByFields,
|
||||
|
|
|
@ -30,7 +30,7 @@ import { AlertLifecycleStatusBadge } from '@kbn/alerts-ui-shared';
|
|||
import moment from 'moment-timezone';
|
||||
import { useUiSetting } from '@kbn/kibana-react-plugin/public';
|
||||
import { useKibana } from '../../utils/kibana_react';
|
||||
import { asDuration, toMicroseconds } from '../../../common/utils/formatters';
|
||||
import { asDuration } from '../../../common/utils/formatters';
|
||||
import { paths } from '../../config/paths';
|
||||
import { translations } from '../../config/translations';
|
||||
import { formatAlertEvaluationValue } from '../../utils/format_alert_evaluation_value';
|
||||
|
@ -42,14 +42,6 @@ interface FlyoutProps {
|
|||
id?: string;
|
||||
}
|
||||
|
||||
// For APM Latency threshold rule, threshold is in ms but the duration formatter works with microseconds
|
||||
const normalizeUnit = (ruleTypeId: string, value?: number) => {
|
||||
if (ruleTypeId === 'apm.transaction_duration' && value) {
|
||||
return toMicroseconds(value, 'milliseconds');
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
export function AlertsFlyoutBody({ alert, id: pageId }: FlyoutProps) {
|
||||
const {
|
||||
http: {
|
||||
|
@ -97,7 +89,7 @@ export function AlertsFlyoutBody({ alert, id: pageId }: FlyoutProps) {
|
|||
title: translations.alertsFlyout.expectedValueLabel,
|
||||
description: formatAlertEvaluationValue(
|
||||
alert.fields[ALERT_RULE_TYPE_ID],
|
||||
normalizeUnit(alert.fields[ALERT_RULE_TYPE_ID], alert.fields[ALERT_EVALUATION_THRESHOLD])
|
||||
alert.fields[ALERT_EVALUATION_THRESHOLD]
|
||||
),
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue