-
Notifications
You must be signed in to change notification settings - Fork 88
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
Bcon/make query optional monitor update #192
Conversation
body = { | ||
'query' => query, | ||
}.merge options | ||
body = {}.merge options |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
¯_(ツ)_/¯
There was a problem hiding this 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! 💯
One thing I forgot is you'll need to bump the version here. Just bumping it up to |
lib/dogapi/v1/monitor.rb
Outdated
body = { | ||
'query' => query | ||
}.merge body | ||
warn '[DEPRECATION] query param is no longer required for update' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this 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 🙈
There was a problem hiding this 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 🙂
@zippolyte Great thanks for the feedback! |
Similar to DataDog/datadogpy#447
Made query an optional param. Tests pass locally, but happy to add some new testing if appropriate.