mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[AO] Update default action and recovery messages for observability rule types (#159571)
Closes #157284, closes #158437
## Summary
This PR updates the default action and recovery message for
observability rule types. Only uptime is excluded in this PR, I will add
that after synching with the synthetics team.
[Here](https://docs.google.com/spreadsheets/d/15cJanv0xi4EKo1QZVXsi_NcFcPa_VQze3nQc4P8GZrQ/edit?pli=1#gid=0)
you can find the list of default messages and the new proposals.

## 🧪 How to test
- Ensure that `server.publicBaseUrl` is configured in kibana.dev.yml
- Create an observability rule with an action such as Email to use the
default messages (both for alert and recover states)
- After an alert is triggered, check the generated action message, it
should
- match the message mentioned in the list
- contain an alert details link pointing to the Alerts page filtered for
that specific alert
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b78c798971
commit
807c5d90f2
18 changed files with 252 additions and 77 deletions
|
@ -95,7 +95,7 @@ pageLoadAssetSize:
|
|||
monitoring: 80000
|
||||
navigation: 37269
|
||||
newsfeed: 42228
|
||||
observability: 105500
|
||||
observability: 115443
|
||||
observabilityOnboarding: 19573
|
||||
observabilityShared: 52256
|
||||
osquery: 107090
|
||||
|
|
|
@ -10,52 +10,139 @@ import { i18n } from '@kbn/i18n';
|
|||
export const errorCountMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.errorCount.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{alertName\\}\\} alert is firing because of the following conditions:
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active with the following conditions:
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Error count: \\{\\{context.triggerValue\\}\\} errors over the last \\{\\{context.interval\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
- Triggered value: \\{\\{context.triggerValue\\}\\} errors over the last \\{\\{context.interval\\}\\}`,
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
export const errorCountRecoveryMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.errorCount.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Error count: \\{\\{context.triggerValue\\}\\} errors over the last \\{\\{context.interval\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
||||
export const transactionDurationMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionDuration.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{alertName\\}\\} alert is firing because of the following conditions:
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active with the following conditions:
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Transaction type: \\{\\{context.transactionType\\}\\}
|
||||
- Transaction name: \\{\\{context.transactionName\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Latency threshold: \\{\\{context.threshold\\}\\}ms
|
||||
- Latency observed: \\{\\{context.triggerValue\\}\\} over the last \\{\\{context.interval\\}\\}`,
|
||||
- Latency: \\{\\{context.triggerValue\\}\\} over the last \\{\\{context.interval\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}ms
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
export const transactionDurationRecoveryMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionDuration.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Transaction type: \\{\\{context.transactionType\\}\\}
|
||||
- Transaction name: \\{\\{context.transactionName\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Latency: \\{\\{context.triggerValue\\}\\} over the last \\{\\{context.interval\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}ms
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
||||
export const transactionErrorRateMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionErrorRate.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{alertName\\}\\} alert is firing because of the following conditions:
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active with the following conditions:
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Type: \\{\\{context.transactionType\\}\\}
|
||||
- Transaction type: \\{\\{context.transactionType\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Failed transaction rate: \\{\\{context.triggerValue\\}\\}% of errors over the last \\{\\{context.interval\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}%
|
||||
- Triggered value: \\{\\{context.triggerValue\\}\\}% of errors over the last \\{\\{context.interval\\}\\}`,
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
export const transactionErrorRateRecoveryMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionErrorRate.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Transaction type: \\{\\{context.transactionType\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Failed transaction rate: \\{\\{context.triggerValue\\}\\}% of errors over the last \\{\\{context.interval\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}%
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
||||
export const anomalyMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionDurationAnomaly.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{alertName\\}\\} alert is firing because of the following conditions:
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active with the following conditions:
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Type: \\{\\{context.transactionType\\}\\}
|
||||
- Transaction type: \\{\\{context.transactionType\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Severity threshold: \\{\\{context.threshold\\}\\}
|
||||
- Severity value: \\{\\{context.triggerValue\\}\\}
|
||||
- Severity: \\{\\{context.triggerValue\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
export const anomalyRecoveryMessage = i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionDurationAnomaly.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
- Service name: \\{\\{context.serviceName\\}\\}
|
||||
- Transaction type: \\{\\{context.transactionType\\}\\}
|
||||
- Environment: \\{\\{context.environment\\}\\}
|
||||
- Severity: \\{\\{context.triggerValue\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -16,9 +16,13 @@ import {
|
|||
import { ApmRuleType } from '../../../../common/rules/apm_rule_types';
|
||||
import {
|
||||
anomalyMessage,
|
||||
anomalyRecoveryMessage,
|
||||
errorCountMessage,
|
||||
errorCountRecoveryMessage,
|
||||
transactionDurationMessage,
|
||||
transactionDurationRecoveryMessage,
|
||||
transactionErrorRateMessage,
|
||||
transactionErrorRateRecoveryMessage,
|
||||
} from '../../../../common/rules/default_action_message';
|
||||
|
||||
// copied from elasticsearch_fieldnames.ts to limit page load bundle size
|
||||
|
@ -55,6 +59,7 @@ export function registerApmRuleTypes(
|
|||
}),
|
||||
requiresAppContext: false,
|
||||
defaultActionMessage: errorCountMessage,
|
||||
defaultRecoveryMessage: errorCountRecoveryMessage,
|
||||
});
|
||||
|
||||
observabilityRuleTypeRegistry.register({
|
||||
|
@ -92,6 +97,7 @@ export function registerApmRuleTypes(
|
|||
),
|
||||
requiresAppContext: false,
|
||||
defaultActionMessage: transactionDurationMessage,
|
||||
defaultRecoveryMessage: transactionDurationRecoveryMessage,
|
||||
});
|
||||
|
||||
observabilityRuleTypeRegistry.register({
|
||||
|
@ -124,6 +130,7 @@ export function registerApmRuleTypes(
|
|||
}),
|
||||
requiresAppContext: false,
|
||||
defaultActionMessage: transactionErrorRateMessage,
|
||||
defaultRecoveryMessage: transactionErrorRateRecoveryMessage,
|
||||
});
|
||||
|
||||
observabilityRuleTypeRegistry.register({
|
||||
|
@ -153,5 +160,6 @@ export function registerApmRuleTypes(
|
|||
}),
|
||||
requiresAppContext: false,
|
||||
defaultActionMessage: anomalyMessage,
|
||||
defaultRecoveryMessage: anomalyRecoveryMessage,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export const apmActionVariables = {
|
|||
'xpack.apm.alerts.action_variables.alertDetailsUrl',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view within Elastic that shows further details and context surrounding this alert',
|
||||
'Link to the alert troubleshooting view for further context and details. This will be an empty string if the server.publicBaseUrl is not configured.',
|
||||
}
|
||||
),
|
||||
name: 'alertDetailsUrl' as const,
|
||||
|
@ -87,8 +87,7 @@ export const apmActionVariables = {
|
|||
description: i18n.translate(
|
||||
'xpack.apm.alerts.action_variables.viewInAppUrl',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view or feature within Elastic that can be used to investigate the alert and its context further',
|
||||
defaultMessage: 'Link to the alert source',
|
||||
}
|
||||
),
|
||||
name: 'viewInAppUrl' as const,
|
||||
|
|
|
@ -20,6 +20,36 @@ interface InventoryMetricRuleTypeParams extends RuleTypeParams {
|
|||
criteria: InventoryMetricConditions[];
|
||||
}
|
||||
|
||||
const inventoryDefaultActionMessage = i18n.translate(
|
||||
'xpack.infra.metrics.alerting.inventory.threshold.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active with the following conditions:
|
||||
|
||||
- Affected: \\{\\{context.group\\}\\}
|
||||
- Metric: \\{\\{context.metric\\}\\}
|
||||
- Observed value: \\{\\{context.value\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
const inventoryDefaultRecoveryMessage = i18n.translate(
|
||||
'xpack.infra.metrics.alerting.inventory.threshold.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
- Affected: \\{\\{context.group\\}\\}
|
||||
- Metric: \\{\\{context.metric\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
||||
export function createInventoryMetricRuleType(): ObservabilityRuleTypeModel<InventoryMetricRuleTypeParams> {
|
||||
return {
|
||||
id: METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID,
|
||||
|
@ -32,16 +62,8 @@ export function createInventoryMetricRuleType(): ObservabilityRuleTypeModel<Inve
|
|||
},
|
||||
ruleParamsExpression: React.lazy(() => import('./components/expression')),
|
||||
validate: validateMetricThreshold,
|
||||
defaultActionMessage: i18n.translate(
|
||||
'xpack.infra.metrics.alerting.inventory.threshold.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\} is in a state of \\{\\{context.alertState\\}\\}
|
||||
|
||||
Reason:
|
||||
\\{\\{context.reason\\}\\}
|
||||
`,
|
||||
}
|
||||
),
|
||||
defaultActionMessage: inventoryDefaultActionMessage,
|
||||
defaultRecoveryMessage: inventoryDefaultRecoveryMessage,
|
||||
requiresAppContext: false,
|
||||
format: formatReason,
|
||||
};
|
||||
|
|
|
@ -18,6 +18,30 @@ import { InfraClientCoreSetup } from '../../types';
|
|||
import { createRuleFormatter } from './rule_data_formatters';
|
||||
import { validateExpression } from './validation';
|
||||
|
||||
const logThresholdDefaultActionMessage = i18n.translate(
|
||||
'xpack.infra.logs.alerting.threshold.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active.
|
||||
|
||||
\\{\\{^context.isRatio\\}\\}\\{\\{#context.group\\}\\}\\{\\{context.group\\}\\} - \\{\\{/context.group\\}\\}\\{\\{context.matchingDocuments\\}\\} log entries have matched the following conditions: \\{\\{context.conditions\\}\\}\\{\\{/context.isRatio\\}\\}
|
||||
\\{\\{#context.isRatio\\}\\}\\{\\{#context.group\\}\\}\\{\\{context.group\\}\\} - \\{\\{/context.group\\}\\} Ratio of the count of log entries matching \\{\\{context.numeratorConditions\\}\\} to the count of log entries matching \\{\\{context.denominatorConditions\\}\\} was \\{\\{context.ratio\\}\\}\\{\\{/context.isRatio\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
const logThresholdDefaultRecoveryMessage = i18n.translate(
|
||||
'xpack.infra.logs.alerting.threshold.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
||||
export function createLogThresholdRuleType(
|
||||
core: InfraClientCoreSetup,
|
||||
logsLocator: LocatorPublic<LogsLocatorParams>
|
||||
|
@ -44,12 +68,8 @@ export function createLogThresholdRuleType(
|
|||
alertDetailsAppSection,
|
||||
ruleParamsExpression,
|
||||
validate: validateExpression,
|
||||
defaultActionMessage: i18n.translate(
|
||||
'xpack.infra.logs.alerting.threshold.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{^context.isRatio\\}\\}\\{\\{#context.group\\}\\}\\{\\{context.group\\}\\} - \\{\\{/context.group\\}\\}\\{\\{context.matchingDocuments\\}\\} log entries have matched the following conditions: \\{\\{context.conditions\\}\\}\\{\\{/context.isRatio\\}\\}\\{\\{#context.isRatio\\}\\}\\{\\{#context.group\\}\\}\\{\\{context.group\\}\\} - \\{\\{/context.group\\}\\} Ratio of the count of log entries matching \\{\\{context.numeratorConditions\\}\\} to the count of log entries matching \\{\\{context.denominatorConditions\\}\\} was \\{\\{context.ratio\\}\\}\\{\\{/context.isRatio\\}\\}`,
|
||||
}
|
||||
),
|
||||
defaultActionMessage: logThresholdDefaultActionMessage,
|
||||
defaultRecoveryMessage: logThresholdDefaultRecoveryMessage,
|
||||
requiresAppContext: false,
|
||||
format: createRuleFormatter(logsLocator),
|
||||
};
|
||||
|
|
|
@ -20,6 +20,36 @@ export interface MetricThresholdRuleTypeParams extends RuleTypeParams {
|
|||
criteria: MetricExpressionParams[];
|
||||
}
|
||||
|
||||
const metricThresholdDefaultActionMessage = i18n.translate(
|
||||
'xpack.infra.metrics.alerting.metric.threshold.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active with the following conditions:
|
||||
|
||||
- Affected: \\{\\{context.group\\}\\}
|
||||
- Metric: \\{\\{context.metric\\}\\}
|
||||
- Observed value: \\{\\{context.value\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
const metricThresholdDefaultRecoveryMessage = i18n.translate(
|
||||
'xpack.infra.metrics.alerting.metric.threshold.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
- Affected: \\{\\{context.group\\}\\}
|
||||
- Metric: \\{\\{context.metric\\}\\}
|
||||
- Threshold: \\{\\{context.threshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
||||
export function createMetricThresholdRuleType(): ObservabilityRuleTypeModel<MetricThresholdRuleTypeParams> {
|
||||
return {
|
||||
id: METRIC_THRESHOLD_ALERT_TYPE_ID,
|
||||
|
@ -32,16 +62,8 @@ export function createMetricThresholdRuleType(): ObservabilityRuleTypeModel<Metr
|
|||
},
|
||||
ruleParamsExpression: lazy(() => import('./components/expression')),
|
||||
validate: validateMetricThreshold,
|
||||
defaultActionMessage: i18n.translate(
|
||||
'xpack.infra.metrics.alerting.threshold.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\} is in a state of \\{\\{context.alertState\\}\\}
|
||||
|
||||
Reason:
|
||||
\\{\\{context.reason\\}\\}
|
||||
`,
|
||||
}
|
||||
),
|
||||
defaultActionMessage: metricThresholdDefaultActionMessage,
|
||||
defaultRecoveryMessage: metricThresholdDefaultRecoveryMessage,
|
||||
requiresAppContext: false,
|
||||
format: formatReason,
|
||||
alertDetailsAppSection: lazy(() => import('./components/alert_details_app_section')),
|
||||
|
|
|
@ -180,7 +180,7 @@ export const alertDetailUrlActionVariableDescription = i18n.translate(
|
|||
'xpack.infra.metrics.alerting.alertDetailUrlActionVariableDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view within Elastic that shows further details and context surrounding this alert',
|
||||
'Link to the alert troubleshooting view for further context and details. This will be an empty string if the server.publicBaseUrl is not configured.',
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -225,8 +225,7 @@ export const thresholdActionVariableDescription = i18n.translate(
|
|||
export const viewInAppUrlActionVariableDescription = i18n.translate(
|
||||
'xpack.infra.metrics.alerting.viewInAppUrlActionVariableDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view or feature within Elastic that can assist with further investigation',
|
||||
defaultMessage: 'Link to the alert source',
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -94,8 +94,7 @@ const alertReasonMessageActionVariableDescription = i18n.translate(
|
|||
const viewInAppUrlActionVariableDescription = i18n.translate(
|
||||
'xpack.infra.logs.alerting.threshold.viewInAppUrlActionVariableDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view or feature within Elastic that can be used to investigate the alert and its context further',
|
||||
defaultMessage: 'Link to the alert source',
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import type { Logger } from '@kbn/logging';
|
|||
import type { IBasePath } from '@kbn/core/server';
|
||||
import type { handleEsError } from '@kbn/es-ui-shared-plugin/server';
|
||||
import type { AlertsLocatorParams } from '@kbn/observability-plugin/common';
|
||||
import { ObservabilityConfig } from '@kbn/observability-plugin/server';
|
||||
import type { LocatorPublic } from '@kbn/share-plugin/common';
|
||||
import { RulesServiceSetup } from '../services/rules';
|
||||
import { InfraConfig, InfraPluginStartServicesAccessor } from '../types';
|
||||
|
@ -34,7 +33,6 @@ export interface InfraBackendLibs extends InfraDomainLibs {
|
|||
metricsRules: RulesServiceSetup;
|
||||
sources: InfraSources;
|
||||
sourceStatus: InfraSourceStatus;
|
||||
getAlertDetailsConfig: () => ObservabilityConfig['unsafe']['alertDetails'];
|
||||
getStartServices: InfraPluginStartServicesAccessor;
|
||||
handleEsError: typeof handleEsError;
|
||||
logger: Logger;
|
||||
|
|
|
@ -208,7 +208,6 @@ export class InfraServerPlugin
|
|||
logsRules: this.logsRules.setup(core, plugins),
|
||||
metricsRules: this.metricsRules.setup(core, plugins),
|
||||
getStartServices: () => core.getStartServices(),
|
||||
getAlertDetailsConfig: () => plugins.observability.getAlertDetailsConfig(),
|
||||
logger: this.logger,
|
||||
basePath: core.http.basePath,
|
||||
alertsLocator: plugins.share.url.locators.get(alertsLocatorID),
|
||||
|
|
|
@ -19,6 +19,39 @@ import { validateBurnRateRule } from '../components/burn_rate_rule_editor/valida
|
|||
import { validateMetricThreshold } from '../pages/threshold/components/validation';
|
||||
import { formatReason } from '../pages/threshold/rule_data_formatters';
|
||||
|
||||
const sloBurnRateDefaultActionMessage = i18n.translate(
|
||||
'xpack.observability.slo.rules.burnRate.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} is active with the following conditions:
|
||||
|
||||
- SLO: \\{\\{context.sloName\\}\\}'
|
||||
- The burn rate over the last \\{\\{context.longWindow.duration\\}\\} is \\{\\{context.longWindow.burnRate\\}\\}
|
||||
- The burn rate over the last \\{\\{context.shortWindow.duration\\}\\} is \\{\\{context.shortWindow.burnRate\\}\\}
|
||||
- Threshold: \\{\\{context.burnRateThreshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
const sloBurnRateDefaultRecoveryMessage = i18n.translate(
|
||||
'xpack.observability.slo.rules.burnRate.defaultRecoveryMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{context.reason\\}\\}
|
||||
|
||||
\\{\\{rule.name\\}\\} has recovered.
|
||||
|
||||
- SLO: \\{\\{context.sloName\\}\\}'
|
||||
- The burn rate over the last \\{\\{context.longWindow.duration\\}\\} is \\{\\{context.longWindow.burnRate\\}\\}
|
||||
- The burn rate over the last \\{\\{context.shortWindow.duration\\}\\} is \\{\\{context.shortWindow.burnRate\\}\\}
|
||||
- Threshold: \\{\\{context.burnRateThreshold\\}\\}
|
||||
|
||||
[View alert details](\\{\\{context.alertDetailsUrl\\}\\})
|
||||
`,
|
||||
}
|
||||
);
|
||||
|
||||
export const registerObservabilityRuleTypes = (
|
||||
config: ConfigSchema,
|
||||
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry
|
||||
|
@ -41,17 +74,8 @@ export const registerObservabilityRuleTypes = (
|
|||
ruleParamsExpression: lazy(() => import('../components/burn_rate_rule_editor')),
|
||||
validate: validateBurnRateRule,
|
||||
requiresAppContext: false,
|
||||
defaultActionMessage: i18n.translate(
|
||||
'xpack.observability.slo.rules.burnRate.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `The rule \\{\\{rule.name\\}\\} for the SLO '\\{\\{context.sloName\\}\\}' is firing:
|
||||
- Reason: \\{\\{context.reason\\}\\}
|
||||
- The burn rate over the last \\{\\{context.longWindow.duration\\}\\} is \\{\\{context.longWindow.burnRate\\}\\}
|
||||
- The burn rate over the last \\{\\{context.shortWindow.duration\\}\\} is \\{\\{context.shortWindow.burnRate\\}\\}
|
||||
- The burn rate threshold is set to \\{\\{context.burnRateThreshold\\}\\}
|
||||
- View in the SLO details page: \\{\\{context.viewInAppUrl\\}\\}`,
|
||||
}
|
||||
),
|
||||
defaultActionMessage: sloBurnRateDefaultActionMessage,
|
||||
defaultRecoveryMessage: sloBurnRateDefaultRecoveryMessage,
|
||||
});
|
||||
if (config.unsafe.thresholdRule.enabled) {
|
||||
observabilityRuleTypeRegistry.register({
|
||||
|
@ -72,7 +96,7 @@ export const registerObservabilityRuleTypes = (
|
|||
'xpack.observability.threshold.rule.alerting.threshold.defaultActionMessage',
|
||||
{
|
||||
defaultMessage: `\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\} is in a state of \\{\\{context.alertState\\}\\}
|
||||
|
||||
|
||||
Reason:
|
||||
\\{\\{context.reason\\}\\}
|
||||
`,
|
||||
|
|
|
@ -184,7 +184,7 @@ export const alertDetailUrlActionVariableDescription = i18n.translate(
|
|||
'xpack.observability.threshold.rule.alertDetailUrlActionVariableDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view within Elastic that shows further details and context surrounding this alert',
|
||||
'Link to the alert troubleshooting view for further context and details. This will be an empty string if the server.publicBaseUrl is not configured.',
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -229,8 +229,7 @@ export const thresholdActionVariableDescription = i18n.translate(
|
|||
export const viewInAppUrlActionVariableDescription = i18n.translate(
|
||||
'xpack.observability.threshold.rule.viewInAppUrlActionVariableDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view or feature within Elastic that can assist with further investigation',
|
||||
defaultMessage: 'Link to the alert source',
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ export const ACTION_VARIABLES = {
|
|||
'xpack.synthetics.alerts.monitorStatus.actionVariables.context.alertDetailUrl.description',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view within Elastic that shows further details and context surrounding this alert',
|
||||
'Link to the alert troubleshooting view for further context and details. This will be an empty string if the server.publicBaseUrl is not configured.',
|
||||
}
|
||||
),
|
||||
usesPublicBaseUrl: true,
|
||||
|
@ -47,8 +47,7 @@ export const ACTION_VARIABLES = {
|
|||
description: i18n.translate(
|
||||
'xpack.synthetics.alerts.monitorStatus.actionVariables.context.viewInAppUrl.description',
|
||||
{
|
||||
defaultMessage:
|
||||
'Link to the view or feature within Elastic that can be used to investigate the alert and its context further',
|
||||
defaultMessage: 'Link to the alert source',
|
||||
}
|
||||
),
|
||||
usesPublicBaseUrl: true,
|
||||
|
|
|
@ -19020,7 +19020,6 @@
|
|||
"xpack.infra.metrics.alerting.threshold.belowRecovery": "inférieur à",
|
||||
"xpack.infra.metrics.alerting.threshold.betweenRecovery": "entre",
|
||||
"xpack.infra.metrics.alerting.threshold.customEquation": "Équation personnalisée",
|
||||
"xpack.infra.metrics.alerting.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\} est à l'état \\{\\{context.alertState\\}\\}\n\nRaison :\n\\{\\{context.reason\\}\\}\n",
|
||||
"xpack.infra.metrics.alerting.threshold.documentCount": "Nombre de documents",
|
||||
"xpack.infra.metrics.alerting.threshold.errorState": "ERREUR",
|
||||
"xpack.infra.metrics.alerting.threshold.fired": "Alerte",
|
||||
|
|
|
@ -19019,7 +19019,6 @@
|
|||
"xpack.infra.metrics.alerting.threshold.belowRecovery": "より小",
|
||||
"xpack.infra.metrics.alerting.threshold.betweenRecovery": "の間",
|
||||
"xpack.infra.metrics.alerting.threshold.customEquation": "カスタム等式",
|
||||
"xpack.infra.metrics.alerting.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\}は状態\\{\\{context.alertState\\}\\}です\n\n理由:\n\\{\\{context.reason\\}\\}\n",
|
||||
"xpack.infra.metrics.alerting.threshold.documentCount": "ドキュメントカウント",
|
||||
"xpack.infra.metrics.alerting.threshold.errorState": "エラー",
|
||||
"xpack.infra.metrics.alerting.threshold.fired": "アラート",
|
||||
|
|
|
@ -19019,7 +19019,6 @@
|
|||
"xpack.infra.metrics.alerting.threshold.belowRecovery": "低于",
|
||||
"xpack.infra.metrics.alerting.threshold.betweenRecovery": "介于",
|
||||
"xpack.infra.metrics.alerting.threshold.customEquation": "定制方程",
|
||||
"xpack.infra.metrics.alerting.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\} 处于 \\{\\{context.alertState\\}\\} 状态\n\n原因:\n\\{\\{context.reason\\}\\}\n",
|
||||
"xpack.infra.metrics.alerting.threshold.documentCount": "文档计数",
|
||||
"xpack.infra.metrics.alerting.threshold.errorState": "错误",
|
||||
"xpack.infra.metrics.alerting.threshold.fired": "告警",
|
||||
|
|
|
@ -120,8 +120,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
{
|
||||
message: `${errorCountMessage}
|
||||
- Transaction name: {{context.transactionName}}
|
||||
- Error grouping key: {{context.errorGroupingKey}}
|
||||
- Alert URL: {{context.alertDetailsUrl}}`,
|
||||
- Error grouping key: {{context.errorGroupingKey}}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -169,15 +168,19 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
expect(resp.hits.hits[0]._source?.message).eql(
|
||||
`Apm error count alert is firing because of the following conditions:
|
||||
`Error count is 15 in the last 1 hr for service: opbeans-java, env: production, name: tx-java, error key: ${errorGroupingKey}. Alert when > 1.
|
||||
|
||||
Apm error count is active with the following conditions:
|
||||
|
||||
- Service name: opbeans-java
|
||||
- Environment: production
|
||||
- Error count: 15 errors over the last 1 hr
|
||||
- Threshold: 1
|
||||
- Triggered value: 15 errors over the last 1 hr
|
||||
|
||||
[View alert details](http://mockedpublicbaseurl/app/observability/alerts?_a=(kuery:%27kibana.alert.uuid:%20%22${alertId}%22%27%2CrangeFrom:%27${rangeFrom}%27%2CrangeTo:now%2Cstatus:all))
|
||||
|
||||
- Transaction name: tx-java
|
||||
- Error grouping key: ${errorGroupingKey}
|
||||
- Alert URL: http://mockedpublicbaseurl/app/observability/alerts?_a=(kuery:%27kibana.alert.uuid:%20%22${alertId}%22%27%2CrangeFrom:%27${rangeFrom}%27%2CrangeTo:now%2Cstatus:all)`
|
||||
- Error grouping key: ${errorGroupingKey}`
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue