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

Ignore the change of no_data_timeframe if notify_no_data is false #384

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

abicky
Copy link
Contributor

@abicky abicky commented Jan 7, 2020

This PR will resolve https://github.com/terraform-providers/terraform-provider-datadog/issues/383.

Datadog seems to have changed the response of monitors recently modified and the response no longer includes "no_data_timeframe" if "notify_no_data" is false.
For example, if I execute the following script:

for monitor_id in $OLD_MONITOR_ID $RECENTLY_MODIFIED_MONITOR_ID; do
  curl -s -X GET \
  -H "DD-API-KEY: ${DATADOG_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DATADOG_APP_KEY}" \
  -d "group_states=all" \
  "https://api.datadoghq.com/api/v1/monitor/${monitor_id}" | \
  jq '{modified, options: .options | {notify_no_data, no_data_timeframe}}'
done

The output is like below:

{
  "modified": "2019-09-17T08:08:32.094503+00:00",
  "options": {
    "notify_no_data": false,
    "no_data_timeframe": 10
  }
}
{
  "modified": "2020-01-07T14:06:55.889061+00:00",
  "options": {
    "notify_no_data": false,
    "no_data_timeframe": null
  }
}

This commit will resolve
https://github.com/terraform-providers/terraform-provider-datadog/issues/383.

Datadog seemed the response of monitors recently changed.
For example, if I execute the following script:

```sh
for monitor_id in $OLD_MONITOR_ID $RECENT_CHANGED_MONITOR_ID; do
  curl -s -X GET \
  -H "DD-API-KEY: ${DATADOG_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DATADOG_APP_KEY}" \
  -d "group_states=all" \
  "https://api.datadoghq.com/api/v1/monitor/${monitor_id}" | \
  jq '{modified, options: .options | {notify_no_data, no_data_timeframe}}'
done
```

The output is like below:

```
{
  "modified": "2019-09-17T08:08:32.094503+00:00",
  "options": {
    "notify_no_data": false,
    "no_data_timeframe": 10
  }
}
{
  "modified": "2020-01-07T14:06:55.889061+00:00",
  "options": {
    "notify_no_data": false,
    "no_data_timeframe": null
  }
}
```
Copy link
Contributor

@platinummonkey platinummonkey left a comment

Choose a reason for hiding this comment

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

Looks good to me. This is intentionally reset in the API to ensure proper configuration.

Copy link
Contributor

@gzussa gzussa left a comment

Choose a reason for hiding this comment

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

Thanks for this PR!

@gzussa gzussa merged commit 0dc57dd into DataDog:master Jan 17, 2020
@ashrayjain
Copy link

Hey folks, is there a release planned with this change soon?

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.

Always "no_data_timeframe = 0 -> 10" plan is displayed
4 participants