Skip to content

Commit

Permalink
adding default message
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Sep 30, 2020
1 parent 14c7a5e commit f9bd3c4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ export function registerApmAlerts(
errors: [],
}),
requiresAppContext: true,
defaultActionMessage: i18n.translate(
'xpack.apm.alertTypes.errorCount.defaultActionMessage',
{
defaultMessage: `\\{\\{alertName\\}\\} alert is firing for the following configuration:
- Service name: \\{\\{context.serviceName\\}\\}
- Environment: \\{\\{context.environment\\}\\}
- Triggered value: \\{\\{context.triggerValue\\}\\}
- Threshold: \\{\\{context.threshold\\}\\}`,
}
),
});

alertTypeRegistry.register({
Expand All @@ -38,6 +49,18 @@ export function registerApmAlerts(
errors: [],
}),
requiresAppContext: true,
defaultActionMessage: i18n.translate(
'xpack.apm.alertTypes.transactionDuration.defaultActionMessage',
{
defaultMessage: `\\{\\{alertName\\}\\} alert is firing for the following configuration:
- Service name: \\{\\{context.serviceName\\}\\}
- Type: \\{\\{context.transactionType\\}\\}
- Environment: \\{\\{context.environment\\}\\}
- Triggered value: \\{\\{context.triggerValue\\}\\}
- Threshold: \\{\\{context.threshold\\}\\}`,
}
),
});

alertTypeRegistry.register({
Expand All @@ -53,6 +76,18 @@ export function registerApmAlerts(
errors: [],
}),
requiresAppContext: true,
defaultActionMessage: i18n.translate(
'xpack.apm.alertTypes.transactionErrorRate.defaultActionMessage',
{
defaultMessage: `\\{\\{alertName\\}\\} alert is firing for the following configuration:
- Service name: \\{\\{context.serviceName\\}\\}
- Type: \\{\\{context.transactionType\\}\\}
- Environment: \\{\\{context.environment\\}\\}
- Triggered value: \\{\\{context.triggerValue\\}\\}
- Threshold: \\{\\{context.threshold\\}\\}`,
}
),
});

alertTypeRegistry.register({
Expand All @@ -68,5 +103,16 @@ export function registerApmAlerts(
errors: [],
}),
requiresAppContext: true,
defaultActionMessage: i18n.translate(
'xpack.apm.alertTypes.transactionDurationAnomaly.defaultActionMessage',
{
defaultMessage: `\\{\\{alertName\\}\\} alert is firing for the following configuration:
- Service name: \\{\\{context.serviceName\\}\\}
- Type: \\{\\{context.transactionType\\}\\}
- Environment: \\{\\{context.environment\\}\\}
- Threshold: \\{\\{context.threshold\\}\\}`,
}
),
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,13 @@ describe('Transaction duration anomaly alert', () => {
serviceName: 'foo',
transactionType: 'type-foo',
environment: 'production',
threshold: 'minor',
});
expect(scheduleActions).toHaveBeenCalledWith('threshold_met', {
serviceName: 'bar',
transactionType: 'type-bar',
environment: 'production',
threshold: 'minor',
});
});

Expand Down Expand Up @@ -305,21 +307,25 @@ describe('Transaction duration anomaly alert', () => {
serviceName: 'foo',
transactionType: undefined,
environment: 'production',
threshold: 'minor',
});
expect(scheduleActions).toHaveBeenCalledWith('threshold_met', {
serviceName: 'bar',
transactionType: undefined,
environment: 'production',
threshold: 'minor',
});
expect(scheduleActions).toHaveBeenCalledWith('threshold_met', {
serviceName: 'foo',
transactionType: undefined,
environment: 'testing',
threshold: 'minor',
});
expect(scheduleActions).toHaveBeenCalledWith('threshold_met', {
serviceName: 'bar',
transactionType: undefined,
environment: 'testing',
threshold: 'minor',
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function registerTransactionDurationAnomalyAlertType({
apmActionVariables.serviceName,
apmActionVariables.transactionType,
apmActionVariables.environment,
apmActionVariables.threshold,
],
},
producer: 'apm',
Expand Down Expand Up @@ -196,6 +197,7 @@ export function registerTransactionDurationAnomalyAlertType({
serviceName,
environment,
transactionType,
threshold: selectedOption?.label,
});
}

Expand Down

0 comments on commit f9bd3c4

Please sign in to comment.