Skip to content

Bcon/make query optional monitor update#192

Merged
unclebconnor merged 10 commits intoDataDog:masterfrom
unclebconnor:bcon/make-query-optional-monitor-update
Oct 18, 2019
Merged

Bcon/make query optional monitor update#192
unclebconnor merged 10 commits intoDataDog:masterfrom
unclebconnor:bcon/make-query-optional-monitor-update

Conversation

@unclebconnor
Copy link
Copy Markdown
Contributor

Similar to DataDog/datadogpy#447

Made query an optional param. Tests pass locally, but happy to add some new testing if appropriate.

body = {
'query' => query,
}.merge options
body = {}.merge options
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather than merging an empty hash, I would write it as :

      def update_monitor(monitor_id, query, options)
        unless query.nil?
          options['query'] = query
          warn '[DEPRECATION] query param is no longer required for update'
        end

        request(Net::HTTP::Put, "/api/#{API_VERSION}/monitor/#{monitor_id}", nil, options, true)
      end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For some reason it's being picky about the order and local tests don't pass with this
¯_(ツ)_/¯

Copy link
Copy Markdown
Member

@armcburney armcburney left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work Brian! 💯

@armcburney
Copy link
Copy Markdown
Member

One thing I forgot is you'll need to bump the version here. Just bumping it up to 1.36.1 will be good! 👍

@unclebconnor unclebconnor requested a review from a team October 11, 2019 23:45
body = {
'query' => query
}.merge body
warn '[DEPRECATION] query param is no longer required for update'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would not warn here. If someone does want to actually update the query, they should not see a deprecation message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually you were right to have this message. I misunderstood how all of it worked.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok just put it back in with the updates!

Copy link
Copy Markdown
Contributor

@zippolyte zippolyte left a comment

Choose a reason for hiding this comment

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

Let's re-add the deprecation message and be more explicit.
something like: query param is not required anymore and should be set to nil. To update the query, set it in the options parameter instead
Sorry about the change of heart 🙈

Copy link
Copy Markdown
Contributor

@zippolyte zippolyte left a comment

Choose a reason for hiding this comment

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

Final 👍, I think we are good to go for real 🙂

@unclebconnor
Copy link
Copy Markdown
Contributor Author

@zippolyte Great thanks for the feedback!

@unclebconnor unclebconnor merged commit 07358ed into DataDog:master Oct 18, 2019
@unclebconnor unclebconnor deleted the bcon/make-query-optional-monitor-update branch October 18, 2019 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants