Optionally measure block even when exception occurs - #112
Closed
dnlserrano wants to merge 1 commit into
Closed
Conversation
Author
|
Closing this in detriment of the supra-referenced issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey guys (Shopify and contributors)!
First of all thanks so much for the
statsd-instrumentgem. It helps us scale our system at Onfido.This pull request introduces a feature that we found could be useful for certain projects. Maybe this is not the right way to achieve it. I'd like your feedback on it. 😅
We've ran into timeouts that yielded exceptions in wrapped
StatsD.measurecalls. This lead to timeouts not being reported to Datadog, which effectively resulted in biased dashboards and flawed monitoring. What we'd like to know, for better data collection and analysis, is how much time something took even if that something fails.I've added a global option,
StatsD.measure_on_exceptionthat tellsstatsd-instrumentto keep collecting time metrics even if we get an exception (i.e.,StatsD.measurewill still measure even if the code it wraps fails with aStandardError).Default behaviour is retro-compatible.
To test it, I've added unit tests and used the following prototypes to do some integration testing:
Before this change, we did not measure on exception:
After adding this, we measure on exception:
Thanks to my colleague and friend @jcmfernandes who paired with me on this. 😊
What do you guys think?