Skip to content

Commit

Permalink
[RAC][Uptime] remove extra dot from the uptime alert connector message (
Browse files Browse the repository at this point in the history
  • Loading branch information
mgiota authored and awahab07 committed Jan 31, 2022
1 parent 9c44294 commit e57e45f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/uptime/common/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const VALUE_MUST_BE_AN_INTEGER = i18n.translate('xpack.uptime.settings.in
export const MonitorStatusTranslations = {
defaultActionMessage: i18n.translate('xpack.uptime.alerts.monitorStatus.defaultActionMessage', {
defaultMessage:
'Monitor {monitorName} with url {monitorUrl} from {observerLocation} {statusMessage}. The latest error message is {latestErrorMessage}',
'Monitor {monitorName} with url {monitorUrl} from {observerLocation} {statusMessage} The latest error message is {latestErrorMessage}',
values: {
monitorName: '{{state.monitorName}}',
monitorUrl: '{{{state.monitorUrl}}}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('monitor status alert type', () => {
})
).toMatchInlineSnapshot(`
Object {
"defaultActionMessage": "Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}}. The latest error message is {{{state.latestErrorMessage}}}",
"defaultActionMessage": "Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}} The latest error message is {{{state.latestErrorMessage}}}",
"description": "Alert when a monitor is down or an availability threshold is breached.",
"documentationUrl": [Function],
"format": [Function],
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/uptime/public/state/api/alert_actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Alert Actions factory', () => {
eventAction: 'trigger',
severity: 'error',
summary:
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}}. The latest error message is {{{state.latestErrorMessage}}}',
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}} The latest error message is {{{state.latestErrorMessage}}}',
},
id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9',
},
Expand All @@ -75,7 +75,7 @@ describe('Alert Actions factory', () => {
eventAction: 'trigger',
severity: 'error',
summary:
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}}. The latest error message is {{{state.latestErrorMessage}}}',
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}} The latest error message is {{{state.latestErrorMessage}}}',
},
},
]);
Expand All @@ -93,7 +93,7 @@ describe('Alert Actions factory', () => {
eventAction: 'trigger',
severity: 'error',
summary:
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}}. The latest error message is {{{state.latestErrorMessage}}}',
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}} The latest error message is {{{state.latestErrorMessage}}}',
},
id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9',
},
Expand All @@ -118,7 +118,7 @@ describe('Alert Actions factory', () => {
eventAction: 'trigger',
severity: 'error',
summary:
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}}. The latest error message is {{{state.latestErrorMessage}}}',
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}} The latest error message is {{{state.latestErrorMessage}}}',
},
},
]);
Expand Down
12 changes: 6 additions & 6 deletions x-pack/plugins/uptime/server/lib/alerts/status_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,26 @@ export const getStatusMessage = (
) => {
let statusMessage = '';
if (downMonParams?.info) {
statusMessage = `${statusCheckTranslations.downMonitorsLabel(
statusMessage = statusCheckTranslations.downMonitorsLabel(
downMonParams.count!,
downMonParams.interval!,
downMonParams.numTimes
)}.`;
);
}
let availabilityMessage = '';

if (availMonInfo) {
availabilityMessage = `${statusCheckTranslations.availabilityBreachLabel(
availabilityMessage = statusCheckTranslations.availabilityBreachLabel(
(availMonInfo.availabilityRatio! * 100).toFixed(2),
availability?.threshold!,
getInterval(availability?.range!, availability?.rangeUnit!)
)}.`;
);
}
if (availMonInfo && downMonParams?.info) {
return `${statusCheckTranslations.downMonitorsAndAvailabilityBreachLabel(
return statusCheckTranslations.downMonitorsAndAvailabilityBreachLabel(
statusMessage,
availabilityMessage
)}`;
);
}
return statusMessage + availabilityMessage;
};
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/uptime/server/lib/alerts/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export const durationAnomalyTranslations = {
export const statusCheckTranslations = {
downMonitorsLabel: (count: number, interval: string, numTimes: number) =>
i18n.translate('xpack.uptime.alerts.monitorStatus.actionVariables.down', {
defaultMessage: `failed {count} times in the last {interval}. Alert when > {numTimes}`,
defaultMessage: `failed {count} times in the last {interval}. Alert when > {numTimes}.`,
values: {
count,
interval,
Expand All @@ -345,7 +345,7 @@ export const statusCheckTranslations = {
) =>
i18n.translate('xpack.uptime.alerts.monitorStatus.actionVariables.availabilityMessage', {
defaultMessage:
'{interval} availability is {availabilityRatio}%. Alert when < {expectedAvailability}%',
'{interval} availability is {availabilityRatio}%. Alert when < {expectedAvailability}%.',
values: {
availabilityRatio,
expectedAvailability,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
group: 'xpack.uptime.alerts.actionGroups.monitorStatus',
params: {
message:
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}}. The latest error message is {{{state.latestErrorMessage}}}',
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} from {{state.observerLocation}} {{{state.statusMessage}}} The latest error message is {{{state.latestErrorMessage}}}',
},
id: 'my-slack1',
},
Expand Down

0 comments on commit e57e45f

Please sign in to comment.