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

Unable to add trigger to an alerting monitor for Monitor defining method as "anomaly detector"

Open sonu1311 opened this issue 9 months ago • 10 comments
trafficstars

What is the bug? I cannot create a trigger for my alert monitor configured for the anomaly detector. It tells me that "No features have been added to this anomaly detector," but per the screenshots provided here, I do have one configured. In my debugging so far, it seems this log line in the dashboard pod could be the reason statusCode":400,"req":{"url":"/api/alerting/detectors/6wlts5QBQ09GuqQB4YyT/results?startTime=1737573868672&endTime=1738178668672&preview=true" as it's logged every time I click to add a trigger on the screen.

How can one reproduce the bug?

  1. Have a anomaly detector configured with a feature enabled
  2. Try to create a alerting monitor and choose anomaly detector as montitor defined method.
  3. Click on add trigger and the message come on the ui stating "No features have been added to this anomaly detector" and dashboard logs has that 400 http status get request.

What is the expected behavior? It should let me add the trigger condition based on the feature I've in the anomaly detector. What is your host/environment?

  • Linux
  • OpenSearch - 2.18
  • Plugins - Anomaly and alerting

Do you have any screenshots?

Image

Image

Do you have any additional context? Add any other context about the problem.

sonu1311 avatar Jan 29 '25 20:01 sonu1311

I fixed this bug before: https://github.com/opensearch-project/alerting-dashboards-plugin/pull/502

kaituo avatar Feb 05 '25 21:02 kaituo

pinged @amitgalitz to take a look.

kaituo avatar Feb 05 '25 21:02 kaituo

@kaituo, thank you for the reply. As mentioned in the ticket, the status code is 400, which generally means a bad request. I am running with demo security in setup, so not sure if that is playing any part in this.

sonu1311 avatar Feb 11 '25 17:02 sonu1311

@sonu1311 not sure. Assigned my teammate @siddharthabingi Siddhartha Bingi to take a look.

kaituo avatar Feb 11 '25 20:02 kaituo

When calling the API /api/alerting/detectors/<<detector-id>>/results?startTime=1737573868672&endTime=1738178668672&preview=true, the error was observed [request query.startTime]: definition for this key is missing. This occurs because the startTime and endTime parameters are not included in the validation schema for the query parameters in the route definition for AD (for 2.18).

Previously, this PR which was raised for Bug fix and mds support for AD Plugin APIs changed the query schema from schema.any() to query: createValidateQuerySchema(dataSourceEnabled) now the /.../startTime&endTime do not seem to be allowed.

siddharthabingi avatar Feb 12 '25 00:02 siddharthabingi

@kaituo This bug has already been fixed in #1126 , but it needs to be backported to the 2.x

siddharthabingi avatar Feb 12 '25 00:02 siddharthabingi

@siddharthabingi nice. Can you backport to 2.x and 2.19 branch (cc @AWSHurneyt )? Also, this breaks because we don't have IT. Can you add an IT in https://github.com/opensearch-project/alerting-dashboards-plugin/tree/main/cypress/integration ?

kaituo avatar Feb 12 '25 20:02 kaituo

@kaituo to clarify, this is the fix, correct? Looks like it's already in the 2.x branch https://github.com/opensearch-project/alerting-dashboards-plugin/commit/b62c1adb5c0797f75dd4a1b414e2026f6a07651e

Generated 2.19 backport PR https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1208

AWSHurneyt avatar Feb 12 '25 20:02 AWSHurneyt

@AWSHurneyt Yes. Can you help review the 2.19 backport? This breaks AD alerting UI from 2.15~2.19. The backport will help ensure AOS 2.19 get the fix.

kaituo avatar Feb 13 '25 21:02 kaituo

Catch All Triage - 1

krisfreedain avatar Feb 17 '25 17:02 krisfreedain

Any ETA on this? we've just hit this in production with one of our customers

synhershko avatar Jul 21 '25 05:07 synhershko