Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

criticalRecovery and warningRecovery always fail for createMonitor #754

Closed
paco-sparta opened this issue Jul 8, 2022 · 3 comments
Closed
Labels

Comments

@paco-sparta
Copy link

paco-sparta commented Jul 8, 2022

Describe the bug
This is a problem with the backend, but I cannot find the right repo.

I have a project with the following monitor, exported directly from the UI:

  type: MonitorType.QUERY_ALERT,
  query: `avg(last_1d):anomalies(max:system.cpu.user{env:${enviro},service:${monitor.service}} by {host}, 'agile', 2, direction='both', interval=300, alert_window='last_1h', count_default_zero='true', seasonality='weekly') > 0.5`,
  message: `[${monitor.service}] CPU usage is too high.`,
  options: {
    thresholds: {
      critical: 0.5,
      criticalRecovery: 0.25,
      warning: 0.2,
      warningRecovery: 0.1,
    },

For this use case the API monitorsApi.createMonitor always returns:

"error": {
      "code": 400,
      "body": {
        "errors": [
          "alert and alert recovery criteria are such that the monitor can be simultaneously in alert and alert recovery states"
        ]
      }
    }

No matter what values I put in criticalRecovery and warningRecovery both always error.

To Reproduce
Steps to reproduce the behavior:

  1. Using the API
  2. Create a QUERY_ALERT monitor with criticalRecovery and warningRecovery
  3. Request createMonitor
  4. See error

Expected behavior
These values should be accepted, as they match the website's.

Environment and Versions (please complete the following information):
"@datadog/datadog-api-client": "^1.0.0",

Additional context
This is a backend problem, the error happens after the request goes through. I'd be happy to forward it to the corresponding repo.

@therve
Copy link
Contributor

therve commented Jul 8, 2022

Hi,

Can you submit a ticket with support please: https://www.datadoghq.com/support/. There is no GIthub repo for backend. Thanks.

@therve therve closed this as completed Jul 8, 2022
@paco-sparta
Copy link
Author

paco-sparta commented Jul 8, 2022

Is there a way not to go through support escalations for what is more than probably just a code bug you can ask about in an internal channel?

@paco-sparta
Copy link
Author

paco-sparta commented Jul 22, 2022

The solution was to change triggerWindow and recoveryWindow on the options.thresholdWindows object so that trigger <= recovery

    thresholds: {
      critical: 0.5,
      criticalRecovery: 0.25,
      warning: 0.2,
      warningRecovery: 0.1,
    },
    thresholdWindows: {
      triggerWindow: 'last_30m',
      recoveryWindow: 'last_30m',
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants