-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix: forcefully disabling metrics when client is disabled (#139) #140
fix: forcefully disabling metrics when client is disabled (#139) #140
Conversation
Disabling the client is meant for when a user will be testing their code, and no connection to a remote server is desired. It is hard to see a use case for collecting and reporting metrics if the client is disabled. Forcefully disabling metrics when disabling the client makes sense and is a more coherent behaviour.
Pull Request Test Coverage Report for Build 4861812555
💛 - Coveralls |
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.
Yeah, this looks pretty good to me! 😄 Some minor adjustment suggestions that you can choose to accept or reject.
Regarding the comment in the description:
Note that this change does change behavior, but to make things more sane.
Would you classify it as a bugfix? If not: is it a breaking change? From what I can tell, the previous behavior didn't really work and probably wasn't intended?
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
Those were very good suggestions! I can hardly see how the previous behavior would be desired, except in hyper-corner cases. (like when testing multiple times calling Makes sense? But if i were to vote, I'd call it a fix. |
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.
Nice! LGTM
About the changes
Disabling the client is meant for when a user will be testing their code, and no connection to a remote server is desired.
It is hard to see a use case for collecting and reporting metrics if the client is disabled. Forcefully disabling metrics when disabling the client makes sense and is a more coherent behavior.
Closes #139
Note that this change does change behavior, but to make things more sane.
Important files
client.rb
client_spec.rb
Discussion points
Also added
WebMock.reset!
in theclient_spec.rb
to ensure no leakage between tests.Maybe it would have made more sense to have it overridden in
lib/unleash/configuration.rb
(by movingdisable_metrics
fromattr_accessor
toattr_writter
+ own getter) ?