alerting-dashboards-plugin icon indicating copy to clipboard operation
alerting-dashboards-plugin copied to clipboard

[BUG] Destination drop-down list remains empty when disallowed destinations still exist

Open christiand93 opened this issue 6 months ago • 1 comments

What is the bug?

When creating or updating the trigger action for an alerting monitor in OpenSearch Dashboards, the list of available destinations remains empty, even though destinations have been configured. The issue occurs only when there is at least one destination remaining whose types has been removed from the allow list.

How can one reproduce the bug? Steps to reproduce the behavior:

  1. Switch to alerting and create a destination with type "email".
  2. Create a second destination with a different type, e.g, "slack".
  3. Remove "email" from the list of allowed destination types in the OpenSearch configuration:
     plugins.alerting.destination.allow_list: ["chime", "slack", "custom_webhook", "test_action"]
    
  4. Switch to alerting again and create a new monitor.
  5. Add a trigger and try to select a destination from the drop-down list. The list of destination remains empty although the "slack" destination should show up.

What is the expected behavior? All destinations with an allowed type should appear when creating or updating a trigger action.

Versions

  • OpenSearch version: 1.3.16
  • OpenSearch Dashboards version: 1.3.16

Investigation We have found a problem in the getDestinations method in ConfigureActions.js: The destinations are filtered with the allowList in line 95, which is working fine. However, at the end of the method the following code fetches more destinations, if the total number reported by the API is not reached yet: https://github.com/opensearch-project/alerting-dashboards-plugin/blob/7c133586fec9cc4d0f3e4d98b2182e2e8563f3dc/public/pages/CreateTrigger/containers/ConfigureActions/ConfigureActions.js#L98-L104 Unfortunately, the condition uses the already filtered list of destinations and not the number of destinations from the destinationsResponse. This means that if one or more destinations are filtered out previously, the method attempts to fetch more destinations. This eventually fails because index exceeds a certain limit (10,000 in our case).

christiand93 avatar Aug 05 '24 09:08 christiand93