Skip to content

Commit 4737c73

Browse files
authored
Removed a possibility to define two different names for Alert types on API and UI level. (#86236) (#86605)
* Removed a possibility to define two different names for Alert types on API and UI level * fixed typechecks * fixed typechecks * fixed due to comments * fixed typechecks * fixed jest tests * fixed typechecks
1 parent 5db8193 commit 4737c73

File tree

41 files changed

+24
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+24
-118
lines changed

x-pack/examples/alerting_example/public/alert_types/always_firing.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
export function getAlertType(): AlertTypeModel {
3333
return {
3434
id: 'example.always-firing',
35-
name: 'Always Fires',
3635
description: 'Alert when called',
3736
iconClass: 'bolt',
3837
documentationUrl: null,

x-pack/examples/alerting_example/public/alert_types/astros.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ function isValueInEnum(enumeratin: Record<string, any>, value: any): boolean {
4444
export function getAlertType(): AlertTypeModel {
4545
return {
4646
id: 'example.people-in-space',
47-
name: 'People Are In Space Right Now',
4847
description: 'Alert when people are in space right now',
4948
iconClass: 'globe',
5049
documentationUrl: null,

x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export function registerApmAlerts(
1414
) {
1515
alertTypeRegistry.register({
1616
id: AlertType.ErrorCount,
17-
name: i18n.translate('xpack.apm.alertTypes.errorCount', {
18-
defaultMessage: 'Error count threshold',
19-
}),
2017
description: i18n.translate('xpack.apm.alertTypes.errorCount.description', {
2118
defaultMessage:
2219
'Alert when the number of errors in a service exceeds a defined threshold.',
@@ -45,9 +42,6 @@ export function registerApmAlerts(
4542

4643
alertTypeRegistry.register({
4744
id: AlertType.TransactionDuration,
48-
name: i18n.translate('xpack.apm.alertTypes.transactionDuration', {
49-
defaultMessage: 'Transaction duration threshold',
50-
}),
5145
description: i18n.translate(
5246
'xpack.apm.alertTypes.transactionDuration.description',
5347
{
@@ -82,9 +76,6 @@ export function registerApmAlerts(
8276

8377
alertTypeRegistry.register({
8478
id: AlertType.TransactionErrorRate,
85-
name: i18n.translate('xpack.apm.alertTypes.transactionErrorRate', {
86-
defaultMessage: 'Transaction error rate threshold',
87-
}),
8879
description: i18n.translate(
8980
'xpack.apm.alertTypes.transactionErrorRate.description',
9081
{
@@ -119,9 +110,6 @@ export function registerApmAlerts(
119110

120111
alertTypeRegistry.register({
121112
id: AlertType.TransactionDurationAnomaly,
122-
name: i18n.translate('xpack.apm.alertTypes.transactionDurationAnomaly', {
123-
defaultMessage: 'Transaction duration anomaly',
124-
}),
125113
description: i18n.translate(
126114
'xpack.apm.alertTypes.transactionDurationAnomaly.description',
127115
{

x-pack/plugins/infra/public/alerting/inventory/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import { validateMetricThreshold } from './components/validation';
1414
export function createInventoryMetricAlertType(): AlertTypeModel {
1515
return {
1616
id: METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID,
17-
name: i18n.translate('xpack.infra.metrics.inventory.alertFlyout.alertName', {
18-
defaultMessage: 'Inventory',
19-
}),
2017
description: i18n.translate('xpack.infra.metrics.inventory.alertFlyout.alertDescription', {
2118
defaultMessage: 'Alert when the inventory exceeds a defined threshold.',
2219
}),

x-pack/plugins/infra/public/alerting/log_threshold/log_threshold_alert_type.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import { validateExpression } from './validation';
1212
export function getAlertType(): AlertTypeModel {
1313
return {
1414
id: LOG_DOCUMENT_COUNT_ALERT_TYPE_ID,
15-
name: i18n.translate('xpack.infra.logs.alertFlyout.alertName', {
16-
defaultMessage: 'Log threshold',
17-
}),
1815
description: i18n.translate('xpack.infra.logs.alertFlyout.alertDescription', {
1916
defaultMessage: 'Alert when the log aggregation exceeds the threshold.',
2017
}),

x-pack/plugins/infra/public/alerting/metric_threshold/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import { METRIC_THRESHOLD_ALERT_TYPE_ID } from '../../../server/lib/alerting/met
1414
export function createMetricThresholdAlertType(): AlertTypeModel {
1515
return {
1616
id: METRIC_THRESHOLD_ALERT_TYPE_ID,
17-
name: i18n.translate('xpack.infra.metrics.alertFlyout.alertName', {
18-
defaultMessage: 'Metric threshold',
19-
}),
2017
description: i18n.translate('xpack.infra.metrics.alertFlyout.alertDescription', {
2118
defaultMessage: 'Alert when the metrics aggregation exceeds the threshold.',
2219
}),

x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_alert_type.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import { schema } from '@kbn/config-schema';
7+
import { i18n } from '@kbn/i18n';
78
import { AlertType } from '../../../../../alerts/server';
89
import {
910
createInventoryMetricThresholdExecutor,
@@ -41,7 +42,9 @@ const condition = schema.object({
4142

4243
export const registerMetricInventoryThresholdAlertType = (libs: InfraBackendLibs): AlertType => ({
4344
id: METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID,
44-
name: 'Inventory',
45+
name: i18n.translate('xpack.infra.metrics.inventory.alertName', {
46+
defaultMessage: 'Inventory',
47+
}),
4548
validate: {
4649
params: schema.object(
4750
{

x-pack/plugins/infra/server/lib/alerting/log_threshold/register_log_threshold_alert_type.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ export async function registerLogThresholdAlertType(
8181

8282
alertingPlugin.registerType({
8383
id: LOG_DOCUMENT_COUNT_ALERT_TYPE_ID,
84-
name: 'Log threshold',
84+
name: i18n.translate('xpack.infra.logs.alertName', {
85+
defaultMessage: 'Log threshold',
86+
}),
8587
validate: {
8688
params: {
8789
validate: (params) => decodeOrThrow(AlertParamsRT)(params),

x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import { schema } from '@kbn/config-schema';
7+
import { i18n } from '@kbn/i18n';
78
import { AlertType } from '../../../../../alerts/server';
89
import { METRIC_EXPLORER_AGGREGATIONS } from '../../../../common/http_api/metrics_explorer';
910
import { createMetricThresholdExecutor, FIRED_ACTIONS } from './metric_threshold_executor';
@@ -42,7 +43,9 @@ export function registerMetricThresholdAlertType(libs: InfraBackendLibs): AlertT
4243

4344
return {
4445
id: METRIC_THRESHOLD_ALERT_TYPE_ID,
45-
name: 'Metric threshold',
46+
name: i18n.translate('xpack.infra.metrics.alertName', {
47+
defaultMessage: 'Metric threshold',
48+
}),
4649
validate: {
4750
params: schema.object(
4851
{

x-pack/plugins/monitoring/public/alerts/alert_form.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ describe('alert_form', () => {
7171
const alertType = {
7272
id: 'alert-type',
7373
iconClass: 'test',
74-
name: 'test-alert',
7574
description: 'Testing',
7675
documentationUrl: 'https://...',
7776
validate: validationMethod,

0 commit comments

Comments
 (0)