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

datadog_monitor ignore query alert vs metric alert diff #242

Merged
merged 2 commits into from
Jun 20, 2019

Conversation

nmuesch
Copy link
Contributor

@nmuesch nmuesch commented Jun 20, 2019

Fixes #241

The API will return query alert or metric alert depending on the query. We currently ignore the fact that the user may have a metric alert but the API returns a query alert but we don't ignore the opposite.

This config seems to replicate the behavior:

  name = "Anomolous CPU usage"
  type = "query alert"
  message = "CPU utilization is outside normal bounds"
  query = "avg(last_4h):anomalies(ewma_20(avg:system.cpu.system{env:prod,service:website}.as_rate()), 'robust', 3, direction='below', alert_window='last_30m', interval=60, count_default_zero='true', seasonality='weekly') >= 1"
  thresholds {
    critical          = 1.0
    critical_recovery = 0.0
  }
  threshold_windows {
    trigger_window    = "last_30m"
    recovery_window   = "last_30m"
  }

  notify_no_data    = false
  renotify_interval = 60
}

This monitor is seen by Datadog as a metric alert. So when the read function occurs the provider sees this as a change in type and does a forceNew. This PR aims to suppress that diff.

@ghost ghost added the size/XS label Jun 20, 2019
Copy link
Contributor

@bkabrda bkabrda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for doing this PR!

@nmuesch nmuesch merged commit f011a8b into DataDog:master Jun 20, 2019
@nmuesch nmuesch deleted the nick/ignore_metric_query_diff branch June 20, 2019 19:48
jbenais pushed a commit to jbenais/terraform-provider-datadog that referenced this pull request Aug 20, 2019
…g#242)

*  ignore changes in metric alert to query alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query/Metric alert type change causing delete+recreate
3 participants