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

Bcon/make query optional monitor update #192

Merged

Conversation

unclebconnor
Copy link
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
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
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
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
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
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
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
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
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
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
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
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.

None yet

3 participants