mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
121273 [RAC][APM] review readability alert reason msg (#123018)
* Update Error count reason msg * Update anomaly reason message * Add interval and update reason msg for Trasn Error and Latency * Add threshold to Latency duration anomaly * Update errorCount reason msg * Update interval format * Update the test msgs * Remove unused import * Update i18n msgs * Add missing points in the text * Update test msg * Code review fixes * Remove > sign from serverity alert * Remove the threashold value from the reason message for Anomaly alert * Remove moment and use O11Y shared duration format function * Remove empty spaces Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b8b7edf8ab
commit
9575ebbcaf
9 changed files with 68 additions and 49 deletions
|
@ -7,9 +7,14 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { ValuesType } from 'utility-types';
|
||||
import type { AsDuration, AsPercent } from '../../observability/common';
|
||||
import type {
|
||||
AsDuration,
|
||||
AsPercent,
|
||||
TimeUnitChar,
|
||||
} from '../../observability/common';
|
||||
import type { ActionGroup } from '../../alerting/common';
|
||||
import { ANOMALY_SEVERITY, ANOMALY_THRESHOLD } from './ml_constants';
|
||||
import { formatDurationFromTimeUnitChar } from '../../observability/common';
|
||||
|
||||
export const APM_SERVER_FEATURE_ID = 'apm';
|
||||
|
||||
|
@ -33,17 +38,25 @@ export function formatErrorCountReason({
|
|||
threshold,
|
||||
measured,
|
||||
serviceName,
|
||||
windowSize,
|
||||
windowUnit,
|
||||
}: {
|
||||
threshold: number;
|
||||
measured: number;
|
||||
serviceName: string;
|
||||
windowSize: number;
|
||||
windowUnit: string;
|
||||
}) {
|
||||
return i18n.translate('xpack.apm.alertTypes.errorCount.reason', {
|
||||
defaultMessage: `Error count is greater than {threshold} (current value is {measured}) for {serviceName}`,
|
||||
defaultMessage: `Error count is {measured} in the last {interval} for {serviceName}. Alert when > {threshold}.`,
|
||||
values: {
|
||||
threshold,
|
||||
measured,
|
||||
serviceName,
|
||||
interval: formatDurationFromTimeUnitChar(
|
||||
windowSize,
|
||||
windowUnit as TimeUnitChar
|
||||
),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -53,18 +66,34 @@ export function formatTransactionDurationReason({
|
|||
measured,
|
||||
serviceName,
|
||||
asDuration,
|
||||
aggregationType,
|
||||
windowSize,
|
||||
windowUnit,
|
||||
}: {
|
||||
threshold: number;
|
||||
measured: number;
|
||||
serviceName: string;
|
||||
asDuration: AsDuration;
|
||||
aggregationType: string;
|
||||
windowSize: number;
|
||||
windowUnit: string;
|
||||
}) {
|
||||
let aggregationTypeFormatted =
|
||||
aggregationType.charAt(0).toUpperCase() + aggregationType.slice(1);
|
||||
if (aggregationTypeFormatted === 'Avg')
|
||||
aggregationTypeFormatted = aggregationTypeFormatted + '.';
|
||||
|
||||
return i18n.translate('xpack.apm.alertTypes.transactionDuration.reason', {
|
||||
defaultMessage: `Latency is above {threshold} (current value is {measured}) for {serviceName}`,
|
||||
defaultMessage: `{aggregationType} latency is {measured} in the last {interval} for {serviceName}. Alert when > {threshold}.`,
|
||||
values: {
|
||||
threshold: asDuration(threshold),
|
||||
measured: asDuration(measured),
|
||||
serviceName,
|
||||
aggregationType: aggregationTypeFormatted,
|
||||
interval: formatDurationFromTimeUnitChar(
|
||||
windowSize,
|
||||
windowUnit as TimeUnitChar
|
||||
),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -74,18 +103,26 @@ export function formatTransactionErrorRateReason({
|
|||
measured,
|
||||
serviceName,
|
||||
asPercent,
|
||||
windowSize,
|
||||
windowUnit,
|
||||
}: {
|
||||
threshold: number;
|
||||
measured: number;
|
||||
serviceName: string;
|
||||
asPercent: AsPercent;
|
||||
windowSize: number;
|
||||
windowUnit: string;
|
||||
}) {
|
||||
return i18n.translate('xpack.apm.alertTypes.transactionErrorRate.reason', {
|
||||
defaultMessage: `Failed transactions rate is greater than {threshold} (current value is {measured}) for {serviceName}`,
|
||||
defaultMessage: `Failed transactions is {measured} in the last {interval} for {serviceName}. Alert when > {threshold}.`,
|
||||
values: {
|
||||
threshold: asPercent(threshold, 100),
|
||||
measured: asPercent(measured, 100),
|
||||
serviceName,
|
||||
interval: formatDurationFromTimeUnitChar(
|
||||
windowSize,
|
||||
windowUnit as TimeUnitChar
|
||||
),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -94,19 +131,27 @@ export function formatTransactionDurationAnomalyReason({
|
|||
serviceName,
|
||||
severityLevel,
|
||||
measured,
|
||||
windowSize,
|
||||
windowUnit,
|
||||
}: {
|
||||
serviceName: string;
|
||||
severityLevel: string;
|
||||
measured: number;
|
||||
windowSize: number;
|
||||
windowUnit: string;
|
||||
}) {
|
||||
return i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionDurationAnomaly.reason',
|
||||
{
|
||||
defaultMessage: `{severityLevel} anomaly detected for {serviceName} (score was {measured})`,
|
||||
defaultMessage: `{severityLevel} anomaly with a score of {measured} was detected in the last {interval} for {serviceName}.`,
|
||||
values: {
|
||||
serviceName,
|
||||
severityLevel,
|
||||
measured,
|
||||
interval: formatDurationFromTimeUnitChar(
|
||||
windowSize,
|
||||
windowUnit as TimeUnitChar
|
||||
),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
|
|
@ -8,20 +8,10 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { lazy } from 'react';
|
||||
import { stringify } from 'querystring';
|
||||
import {
|
||||
ALERT_EVALUATION_THRESHOLD,
|
||||
ALERT_EVALUATION_VALUE,
|
||||
ALERT_SEVERITY,
|
||||
} from '@kbn/rule-data-utils';
|
||||
import { ALERT_REASON } from '@kbn/rule-data-utils';
|
||||
import type { ObservabilityRuleTypeRegistry } from '../../../../observability/public';
|
||||
import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values';
|
||||
import {
|
||||
AlertType,
|
||||
formatErrorCountReason,
|
||||
formatTransactionDurationAnomalyReason,
|
||||
formatTransactionDurationReason,
|
||||
formatTransactionErrorRateReason,
|
||||
} from '../../../common/alert_types';
|
||||
import { AlertType } from '../../../common/alert_types';
|
||||
|
||||
// copied from elasticsearch_fieldnames.ts to limit page load bundle size
|
||||
const SERVICE_ENVIRONMENT = 'service.environment';
|
||||
|
@ -49,11 +39,7 @@ export function registerApmAlerts(
|
|||
}),
|
||||
format: ({ fields }) => {
|
||||
return {
|
||||
reason: formatErrorCountReason({
|
||||
threshold: fields[ALERT_EVALUATION_THRESHOLD]!,
|
||||
measured: fields[ALERT_EVALUATION_VALUE]!,
|
||||
serviceName: String(fields[SERVICE_NAME][0]),
|
||||
}),
|
||||
reason: fields[ALERT_REASON]!,
|
||||
link: format({
|
||||
pathname: `/app/apm/services/${String(
|
||||
fields[SERVICE_NAME][0]
|
||||
|
@ -98,12 +84,8 @@ export function registerApmAlerts(
|
|||
}
|
||||
),
|
||||
format: ({ fields, formatters: { asDuration } }) => ({
|
||||
reason: formatTransactionDurationReason({
|
||||
threshold: fields[ALERT_EVALUATION_THRESHOLD]!,
|
||||
measured: fields[ALERT_EVALUATION_VALUE]!,
|
||||
serviceName: String(fields[SERVICE_NAME][0]),
|
||||
asDuration,
|
||||
}),
|
||||
reason: fields[ALERT_REASON]!,
|
||||
|
||||
link: format({
|
||||
pathname: `/app/apm/services/${fields[SERVICE_NAME][0]!}`,
|
||||
query: {
|
||||
|
@ -149,12 +131,7 @@ export function registerApmAlerts(
|
|||
}
|
||||
),
|
||||
format: ({ fields, formatters: { asPercent } }) => ({
|
||||
reason: formatTransactionErrorRateReason({
|
||||
threshold: fields[ALERT_EVALUATION_THRESHOLD]!,
|
||||
measured: fields[ALERT_EVALUATION_VALUE]!,
|
||||
serviceName: String(fields[SERVICE_NAME][0]),
|
||||
asPercent,
|
||||
}),
|
||||
reason: fields[ALERT_REASON]!,
|
||||
link: format({
|
||||
pathname: `/app/apm/services/${String(fields[SERVICE_NAME][0]!)}`,
|
||||
query: {
|
||||
|
@ -199,11 +176,7 @@ export function registerApmAlerts(
|
|||
}
|
||||
),
|
||||
format: ({ fields }) => ({
|
||||
reason: formatTransactionDurationAnomalyReason({
|
||||
serviceName: String(fields[SERVICE_NAME][0]),
|
||||
severityLevel: String(fields[ALERT_SEVERITY]),
|
||||
measured: Number(fields[ALERT_EVALUATION_VALUE]),
|
||||
}),
|
||||
reason: fields[ALERT_REASON]!,
|
||||
link: format({
|
||||
pathname: `/app/apm/services/${String(fields[SERVICE_NAME][0])}`,
|
||||
query: {
|
||||
|
|
|
@ -155,6 +155,8 @@ export function registerErrorCountAlertType({
|
|||
serviceName,
|
||||
threshold: ruleParams.threshold,
|
||||
measured: errorCount,
|
||||
windowSize: ruleParams.windowSize,
|
||||
windowUnit: ruleParams.windowUnit,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -196,6 +196,9 @@ export function registerTransactionDurationAlertType({
|
|||
serviceName: ruleParams.serviceName,
|
||||
threshold: thresholdMicroseconds,
|
||||
asDuration,
|
||||
aggregationType: String(ruleParams.aggregationType),
|
||||
windowSize: ruleParams.windowSize,
|
||||
windowUnit: ruleParams.windowUnit,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -233,6 +233,8 @@ export function registerTransactionDurationAnomalyAlertType({
|
|||
measured: score,
|
||||
serviceName,
|
||||
severityLevel,
|
||||
windowSize: params.windowSize,
|
||||
windowUnit: params.windowUnit,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -221,6 +221,8 @@ export function registerTransactionErrorRateAlertType({
|
|||
measured: errorRate,
|
||||
asPercent,
|
||||
serviceName,
|
||||
windowSize: ruleParams.windowSize,
|
||||
windowUnit: ruleParams.windowUnit,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -6382,16 +6382,12 @@
|
|||
"xpack.apm.alerts.anomalySeverity.warningLabel": "警告",
|
||||
"xpack.apm.alertTypes.errorCount.defaultActionMessage": "次の条件のため、\\{\\{alertName\\}\\}アラートが実行されています。\n\n- サービス名:\\{\\{context.serviceName\\}\\}\n- 環境:\\{\\{context.environment\\}\\}\n- しきい値\\{\\{context.threshold\\}\\}エラー\n- トリガーされた値:過去\\{\\{context.interval\\}\\}に\\{\\{context.triggerValue\\}\\}件のエラー",
|
||||
"xpack.apm.alertTypes.errorCount.description": "サービスのエラー数が定義されたしきい値を超過したときにアラートを発行します。",
|
||||
"xpack.apm.alertTypes.errorCount.reason": "エラー数が{serviceName}の{threshold}を超えています(現在の値は{measured})",
|
||||
"xpack.apm.alertTypes.transactionDuration.defaultActionMessage": "次の条件のため、\\{\\{alertName\\}\\}アラートが実行されています。\n\n- サービス名:\\{\\{context.serviceName\\}\\}\n- タイプ:\\{\\{context.transactionType\\}\\}\n- 環境:\\{\\{context.environment\\}\\}\n- レイテンシしきい値:\\{\\{context.threshold\\}\\}ミリ秒\n- 観察されたレイテンシ:直前の\\{\\{context.interval\\}\\}に\\{\\{context.triggerValue\\}\\}",
|
||||
"xpack.apm.alertTypes.transactionDuration.description": "サービスの特定のトランザクションタイプのレイテンシが定義されたしきい値を超えたときにアラートを発行します。",
|
||||
"xpack.apm.alertTypes.transactionDuration.reason": "レイテンシが{serviceName}の{threshold}を超えています(現在の値は{measured})",
|
||||
"xpack.apm.alertTypes.transactionDurationAnomaly.defaultActionMessage": "次の条件のため、\\{\\{alertName\\}\\}アラートが実行されています。\n\n- サービス名:\\{\\{context.serviceName\\}\\}\n- タイプ:\\{\\{context.transactionType\\}\\}\n- 環境:\\{\\{context.environment\\}\\}\n- 重要度しきい値:\\{\\{context.threshold\\}\\}%\n- 重要度値:\\{\\{context.triggerValue\\}\\}\n",
|
||||
"xpack.apm.alertTypes.transactionDurationAnomaly.description": "サービスのレイテンシが異常であるときにアラートを表示します。",
|
||||
"xpack.apm.alertTypes.transactionDurationAnomaly.reason": "{serviceName}の{severityLevel}異常が検知されました(スコアは{measured})",
|
||||
"xpack.apm.alertTypes.transactionErrorRate.defaultActionMessage": "次の条件のため、\\{\\{alertName\\}\\}アラートが実行されています。\n\n- サービス名:\\{\\{context.serviceName\\}\\}\n- タイプ:\\{\\{context.transactionType\\}\\}\n- 環境:\\{\\{context.environment\\}\\}\n- しきい値:\\{\\{context.threshold\\}\\}%\n- トリガーされた値:過去\\{\\{context.interval\\}\\}にエラーの\\{\\{context.triggerValue\\}\\}%",
|
||||
"xpack.apm.alertTypes.transactionErrorRate.description": "サービスのトランザクションエラー率が定義されたしきい値を超過したときにアラートを発行します。",
|
||||
"xpack.apm.alertTypes.transactionErrorRate.reason": "トランザクションエラー率が{serviceName}の{threshold}を超えています(現在の値は{measured})",
|
||||
"xpack.apm.analyzeDataButton.label": "データの探索",
|
||||
"xpack.apm.analyzeDataButton.tooltip": "データの探索では、任意のディメンションの結果データを選択してフィルタリングし、パフォーマンスの問題の原因または影響を調査することができます。",
|
||||
"xpack.apm.analyzeDataButtonLabel": "データの探索",
|
||||
|
|
|
@ -6434,16 +6434,12 @@
|
|||
"xpack.apm.alerts.anomalySeverity.warningLabel": "警告",
|
||||
"xpack.apm.alertTypes.errorCount.defaultActionMessage": "由于以下条件 \\{\\{alertName\\}\\} 告警触发:\n\n- 服务名称:\\{\\{context.serviceName\\}\\}\n- 环境:\\{\\{context.environment\\}\\}\n- 阈值:\\{\\{context.threshold\\}\\} 个错误\n- 已触发的值:在过去 \\{\\{context.interval\\}\\}有 \\{\\{context.triggerValue\\}\\} 个错误",
|
||||
"xpack.apm.alertTypes.errorCount.description": "当服务中的错误数量超过定义的阈值时告警。",
|
||||
"xpack.apm.alertTypes.errorCount.reason": "{serviceName} 的错误计数大于 {threshold}(当前值为 {measured})",
|
||||
"xpack.apm.alertTypes.transactionDuration.defaultActionMessage": "由于以下条件 \\{\\{alertName\\}\\} 告警触发:\n\n- 服务名称:\\{\\{context.serviceName\\}\\}\n- 类型:\\{\\{context.transactionType\\}\\}\n- 环境:\\{\\{context.environment\\}\\}\n- 延迟阈值:\\{\\{context.threshold\\}\\}ms\n- 观察的延迟:在过去 \\{\\{context.interval\\}\\}为 \\{\\{context.triggerValue\\}\\}",
|
||||
"xpack.apm.alertTypes.transactionDuration.description": "当服务中特定事务类型的延迟超过定义的阈值时告警。",
|
||||
"xpack.apm.alertTypes.transactionDuration.reason": "{serviceName} 的延迟高于 {threshold}(当前值为 {measured})",
|
||||
"xpack.apm.alertTypes.transactionDurationAnomaly.defaultActionMessage": "由于以下条件 \\{\\{alertName\\}\\} 告警触发:\n\n- 服务名称:\\{\\{context.serviceName\\}\\}\n- 类型:\\{\\{context.transactionType\\}\\}\n- 环境:\\{\\{context.environment\\}\\}\n- 严重性阈值:\\{\\{context.threshold\\}\\}\n- 严重性值:\\{\\{context.triggerValue\\}\\}\n",
|
||||
"xpack.apm.alertTypes.transactionDurationAnomaly.description": "服务的延迟异常时告警。",
|
||||
"xpack.apm.alertTypes.transactionDurationAnomaly.reason": "{serviceName} 检查到 {severityLevel} 异常(分数为 {measured})",
|
||||
"xpack.apm.alertTypes.transactionErrorRate.defaultActionMessage": "由于以下条件 \\{\\{alertName\\}\\} 告警触发:\n\n- 服务名称:\\{\\{context.serviceName\\}\\}\n- 类型:\\{\\{context.transactionType\\}\\}\n- 环境:\\{\\{context.environment\\}\\}\n- 阈值:\\{\\{context.threshold\\}\\}%\n- 已触发的值:在过去 \\{\\{context.interval\\}\\}有 \\{\\{context.triggerValue\\}\\}% 的错误",
|
||||
"xpack.apm.alertTypes.transactionErrorRate.description": "当服务中的事务错误率超过定义的阈值时告警。",
|
||||
"xpack.apm.alertTypes.transactionErrorRate.reason": "{serviceName} 的失败事务率大于 {threshold}(当前值为 {measured})",
|
||||
"xpack.apm.analyzeDataButton.label": "浏览数据",
|
||||
"xpack.apm.analyzeDataButton.tooltip": "“浏览数据”允许您选择和筛选任意维度中的结果数据以及查找性能问题的原因或影响",
|
||||
"xpack.apm.analyzeDataButtonLabel": "浏览数据",
|
||||
|
|
|
@ -21,7 +21,7 @@ Object {
|
|||
"apm.transaction_error_rate_opbeans-go_request_ENVIRONMENT_NOT_DEFINED",
|
||||
],
|
||||
"kibana.alert.reason": Array [
|
||||
"Failed transactions rate is greater than 30% (current value is 50%) for opbeans-go",
|
||||
"Failed transactions is 50% in the last 5 mins for opbeans-go. Alert when > 30%.",
|
||||
],
|
||||
"kibana.alert.rule.category": Array [
|
||||
"Failed transaction rate threshold",
|
||||
|
@ -85,7 +85,7 @@ Object {
|
|||
"apm.transaction_error_rate_opbeans-go_request_ENVIRONMENT_NOT_DEFINED",
|
||||
],
|
||||
"kibana.alert.reason": Array [
|
||||
"Failed transactions rate is greater than 30% (current value is 50%) for opbeans-go",
|
||||
"Failed transactions is 50% in the last 5 mins for opbeans-go. Alert when > 30%.",
|
||||
],
|
||||
"kibana.alert.rule.category": Array [
|
||||
"Failed transaction rate threshold",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue