Closed ritikesh closed 3 years ago
Thanks for opening the PR!
When I was taking a look at the changes I thought it might make things a little cleaner if the notifiers handled the timing themselves. That way disabling the timing of the circuit isn't specifically tied to using the null notifier. If I were to make that change I think it would fulfill what you are looking to do and also make it possible for someone to skip timing in their own notifiers. I can look at implementing that this weekend and then release another prerelease sometime next week if that sounds good?
Sounds good. I thought about that but wanted to refrain from making too many changes to get this done quickly(dirtily) 😅 Let me know if you want me to help with the refactor in this PR itself. Glad to help.
Just wanted to give an update. I'm mostly done with moving over to have the notifiers do timing, just working on the naming of some things. The changes I have so far would just take advantage of ActiveSupport::Notifications
emitting start and finish times, circuit box wouldn't do any timing itself anymore. This seems to me like it would fulfill the request to not have runtime metrics run when the timer is the null timer. The null timer's method for tracking this (currently metric_gauge
but I'm going to rename it) would just block.call
(or yield
).
Thanks @matthewshafer for the updates. Looking forward to the next prerelease version!
I finally opened a PR #169 with the changes. I've held off for a while because I've been waiting for one of my coworkers to take a look since it'll change how we measure things in our applications. Hopefully they are able to take a look in the next day or two and then I can merge this.
closing this in favour of #169
I do not want to compute time differences if I'm using a
Notifier::Null
notifier. This was the behaviour earlier and got replaced with #159.