mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.8`: - [Change kibana.alert.evaluation.threshold unit to microseconds (#158703)](https://github.com/elastic/kibana/pull/158703) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Maryam Saeidi","email":"maryam.saeidi@elastic.co"},"sourceCommit":{"committedDate":"2023-06-01T11:12:21Z","message":"Change kibana.alert.evaluation.threshold unit to microseconds (#158703)\n\nResolves #156255\r\nFixes #158204\r\nPartially reverts #154801\r\n\r\n[RFC\r\nDocument](https://docs.google.com/document/d/1-O6-nqOedrjtTF9mHawd_u-vUdXu06KGI8ic5qNeQPQ/edit?usp=sharing)\r\n\r\n## Summary\r\n\r\nThis PR changes kibana.alert.evaluation.threshold unit to microseconds\r\nin AAD.\r\n\r\n|Case|Screenshot|\r\n|----|---|\r\n|Saved value in\r\nAAD||\r\n|Should show correct information in\r\nflyout||\r\n|Should show correct information on alert details\r\npage||\r\n|Should show correct information in action\r\nmessage||\r\n|Same unit for value and threshold in the alert\r\ntable||\r\n\r\n\r\n## 🧪 How to test\r\n- Generate an APM Latency threshold alert\r\n- Check the threshold in\r\n - Alert's flyout\r\n - Alert's table\r\n - Alert details page (summary and chart)\r\n - Action generated by this alert","sha":"d13f884ec3a4e61fcc23e5594741ec436fa4c4fb","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:APM","Team: Actionable Observability","backport:prev-minor","v8.9.0"],"number":158703,"url":"https://github.com/elastic/kibana/pull/158703","mergeCommit":{"message":"Change kibana.alert.evaluation.threshold unit to microseconds (#158703)\n\nResolves #156255\r\nFixes #158204\r\nPartially reverts #154801\r\n\r\n[RFC\r\nDocument](https://docs.google.com/document/d/1-O6-nqOedrjtTF9mHawd_u-vUdXu06KGI8ic5qNeQPQ/edit?usp=sharing)\r\n\r\n## Summary\r\n\r\nThis PR changes kibana.alert.evaluation.threshold unit to microseconds\r\nin AAD.\r\n\r\n|Case|Screenshot|\r\n|----|---|\r\n|Saved value in\r\nAAD||\r\n|Should show correct information in\r\nflyout||\r\n|Should show correct information on alert details\r\npage||\r\n|Should show correct information in action\r\nmessage||\r\n|Same unit for value and threshold in the alert\r\ntable||\r\n\r\n\r\n## 🧪 How to test\r\n- Generate an APM Latency threshold alert\r\n- Check the threshold in\r\n - Alert's flyout\r\n - Alert's table\r\n - Alert details page (summary and chart)\r\n - Action generated by this alert","sha":"d13f884ec3a4e61fcc23e5594741ec436fa4c4fb"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158703","number":158703,"mergeCommit":{"message":"Change kibana.alert.evaluation.threshold unit to microseconds (#158703)\n\nResolves #156255\r\nFixes #158204\r\nPartially reverts #154801\r\n\r\n[RFC\r\nDocument](https://docs.google.com/document/d/1-O6-nqOedrjtTF9mHawd_u-vUdXu06KGI8ic5qNeQPQ/edit?usp=sharing)\r\n\r\n## Summary\r\n\r\nThis PR changes kibana.alert.evaluation.threshold unit to microseconds\r\nin AAD.\r\n\r\n|Case|Screenshot|\r\n|----|---|\r\n|Saved value in\r\nAAD||\r\n|Should show correct information in\r\nflyout||\r\n|Should show correct information on alert details\r\npage||\r\n|Should show correct information in action\r\nmessage||\r\n|Same unit for value and threshold in the alert\r\ntable||\r\n\r\n\r\n## 🧪 How to test\r\n- Generate an APM Latency threshold alert\r\n- Check the threshold in\r\n - Alert's flyout\r\n - Alert's table\r\n - Alert details page (summary and chart)\r\n - Action generated by this alert","sha":"d13f884ec3a4e61fcc23e5594741ec436fa4c4fb"}}]}] BACKPORT-->
This commit is contained in:
parent
49a8e57273
commit
cd27f98a73
3 changed files with 4 additions and 16 deletions
|
@ -19,7 +19,6 @@ import {
|
|||
import moment from 'moment';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
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';
|
||||
|
@ -36,9 +35,6 @@ import {
|
|||
TRANSACTION_TYPE,
|
||||
} from './types';
|
||||
|
||||
const toMicroseconds = (value?: number) =>
|
||||
value ? toMicrosecondsUtil(value, 'milliseconds') : value;
|
||||
|
||||
export function AlertDetailsAppSection({
|
||||
rule,
|
||||
alert,
|
||||
|
@ -68,7 +64,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