alerting-dashboards-plugin
alerting-dashboards-plugin copied to clipboard
[BUG] Refactor GetDestinations API call to fail gracefully.
What is the bug?
The create monitor page displays a Failed to load the destinations
error toast popup when the .opendistro-alerting-config
doesn't exist.
The error popup is being created here. I'm able to reproduce the error locally when the .opendistro-alerting-config
hasn't been created. The config index will be created automatically when a monitor is created, so the same error doesn't seem to be thrown when editing a monitor.
Essentially, the frontend calls the alerting backend GetDestinations API which queries the alerting config index here. However, if the config index hasn't been created yet, this API will throw a "[alerting_exception] Configured indices are not found: [.opendistro-alerting-config]"
error. The frontend does attempt to catch that error here, but it's not being handled gracefully here.
My testing so far suggests this shouldn't impact functionality as destinations were deprecated in v2.0 when the notifications plugin was released. Once the error handling has been refactored, we should check older versions of alerting dashboards, and backport accordingly.
How can one reproduce the bug? Steps to reproduce the behavior:
- Delete the
.opendistro-alerting-config
- Go to the
Create monitor
page - Configure some monitor details
- Add a trigger
- Add an action
- See the error
What is the expected behavior? A clear and concise description of what you expected to happen.
What is your host/environment?
- OS: macOS
- Version: 13.4.1 (22F82)
- Plugins: v2.11 alerting, alerting dashboards, notifications, and notifications dashboards
Do you have any screenshots?
Screenshot of the error popup.