yabeda
yabeda copied to clipboard
Allow Yabeda::Counter#increment to be called without argument
Hi, this is a small feature request that should be backwards compatible.
Issue
We have some counters in our app that we're not using any tags with. These counters are currently incremented like this
Yabeda.some_counter.increment({})
The increment
method has one required positional argument -tags
- which has no default value.
https://github.com/yabeda-rb/yabeda/blob/ab2be2235253ed6e0d45a4fa97e4decaa32be480/lib/yabeda/counter.rb#L6
Suggestion
Define tags
to have a default value of {}
so that increment
can be called without parentheses
def increment(tags = {}, by: 1)
Yabeda.some_counter.increment
Hmm. From the one hand sounds reasonable.
From the other – it is quite rare situation when you really need “global” counter without any segmentation. In that case missing required argument tries to remind you that you possibly forget to add tags.
+1 For this. We actually have some global counters where there is no segmentation. Seemed kind of unexpected to have to declare "no tags needed here" explicitly.