-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.17] [Synthetics] Fix to handle ops genie as default connector !! (#…
…201923) (#202572) # Backport This will backport the following commits from `main` to `8.17`: - [[Synthetics] Fix to handle ops genie as default connector !! (#201923)](#201923) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-02T19:20:26Z","message":"[Synthetics] Fix to handle ops genie as default connector !! (#201923)\n\n## Summary\r\n\r\nfixes https://github.com/elastic/kibana/issues/168681\r\n\r\nFix to handle ops genie as default connector !!\r\n\r\nTested by creating a trail account in ops genie \r\n\r\n<img width=\"1712\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/ec768758-0fd3-4e3e-bb16-2bc11f10f6b7\">","sha":"a674b9d043faf58494feda039bb2a563c9f4d661","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","backport:prev-major","ci:project-deploy-observability","Team:obs-ux-management"],"title":"[Synthetics] Fix to handle ops genie as default connector !!","number":201923,"url":"https://github.com/elastic/kibana/pull/201923","mergeCommit":{"message":"[Synthetics] Fix to handle ops genie as default connector !! (#201923)\n\n## Summary\r\n\r\nfixes https://github.com/elastic/kibana/issues/168681\r\n\r\nFix to handle ops genie as default connector !!\r\n\r\nTested by creating a trail account in ops genie \r\n\r\n<img width=\"1712\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/ec768758-0fd3-4e3e-bb16-2bc11f10f6b7\">","sha":"a674b9d043faf58494feda039bb2a563c9f4d661"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201923","number":201923,"mergeCommit":{"message":"[Synthetics] Fix to handle ops genie as default connector !! (#201923)\n\n## Summary\r\n\r\nfixes https://github.com/elastic/kibana/issues/168681\r\n\r\nFix to handle ops genie as default connector !!\r\n\r\nTested by creating a trail account in ops genie \r\n\r\n<img width=\"1712\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/ec768758-0fd3-4e3e-bb16-2bc11f10f6b7\">","sha":"a674b9d043faf58494feda039bb2a563c9f4d661"}}]}] BACKPORT--> Co-authored-by: Shahzad <[email protected]>
- Loading branch information
1 parent
213a96d
commit 09f4e91
Showing
5 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,4 +291,77 @@ describe('Alert Actions factory', () => { | |
}, | ||
]); | ||
}); | ||
|
||
it('generate expected action for email opsgenie connector', async () => { | ||
const resp = populateAlertActions({ | ||
groupId: SYNTHETICS_MONITOR_STATUS.id, | ||
defaultActions: [ | ||
{ | ||
frequency: { | ||
notifyWhen: 'onActionGroupChange', | ||
summary: false, | ||
throttle: null, | ||
}, | ||
actionTypeId: '.opsgenie', | ||
group: 'xpack.synthetics.alerts.actionGroups.monitorStatus', | ||
params: {}, | ||
id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', | ||
}, | ||
] as unknown as ActionConnector[], | ||
defaultEmail: { | ||
to: ['[email protected]'], | ||
}, | ||
translations: { | ||
defaultActionMessage: SyntheticsMonitorStatusTranslations.defaultActionMessage, | ||
defaultRecoveryMessage: SyntheticsMonitorStatusTranslations.defaultRecoveryMessage, | ||
defaultSubjectMessage: SyntheticsMonitorStatusTranslations.defaultSubjectMessage, | ||
defaultRecoverySubjectMessage: | ||
SyntheticsMonitorStatusTranslations.defaultRecoverySubjectMessage, | ||
}, | ||
}); | ||
expect(resp).toEqual([ | ||
{ | ||
frequency: { | ||
notifyWhen: 'onActionGroupChange', | ||
summary: false, | ||
throttle: null, | ||
}, | ||
group: 'recovered', | ||
id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', | ||
params: { | ||
subAction: 'closeAlert', | ||
subActionParams: { | ||
alias: '{{rule.id}}:{{alert.id}}', | ||
description: | ||
'The alert for monitor "{{context.monitorName}}" from {{context.locationNames}} is no longer active: {{context.recoveryReason}}. - Elastic Synthetics\n\nDetails:\n\n- Monitor name: {{context.monitorName}} \n- {{context.monitorUrlLabel}}: {{{context.monitorUrl}}} \n- Monitor type: {{context.monitorType}} \n- From: {{context.locationNames}} \n- Last error received: {{{context.lastErrorMessage}}} \n{{{context.linkMessage}}}', | ||
message: | ||
'Monitor "{{context.monitorName}}" ({{context.locationNames}}) {{context.recoveryStatus}} - Elastic Synthetics', | ||
priority: 'P2', | ||
tags: ['{{rule.tags}}'], | ||
}, | ||
}, | ||
}, | ||
{ | ||
frequency: { | ||
notifyWhen: 'onActionGroupChange', | ||
summary: false, | ||
throttle: null, | ||
}, | ||
group: 'xpack.synthetics.alerts.actionGroups.monitorStatus', | ||
id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', | ||
params: { | ||
subAction: 'createAlert', | ||
subActionParams: { | ||
alias: '{{rule.id}}:{{alert.id}}', | ||
description: | ||
'Monitor "{{context.monitorName}}" is {{{context.status}}} from {{context.locationNames}}.{{{context.pendingLastRunAt}}} - Elastic Synthetics\n\nDetails:\n\n- Monitor name: {{context.monitorName}} \n- {{context.monitorUrlLabel}}: {{{context.monitorUrl}}} \n- Monitor type: {{context.monitorType}} \n- Checked at: {{context.checkedAt}} \n- From: {{context.locationNames}} \n- Reason: {{{context.reason}}} \n- Error received: {{{context.lastErrorMessage}}} \n{{{context.linkMessage}}}', | ||
message: | ||
'Monitor "{{context.monitorName}}" ({{context.locationNames}}) is down - Elastic Synthetics', | ||
priority: 'P2', | ||
tags: ['{{rule.tags}}'], | ||
}, | ||
}, | ||
}, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters