Shopify / statsd-instrument

A StatsD client for Ruby apps. Provides metaprogramming methods to inject StatsD instrumentation into your code.
http://shopify.github.io/statsd-instrument
MIT License
570 stars 94 forks source link

Add taggig error classes in statsd_count_success #304

Closed TobiasBales closed 2 years ago

TobiasBales commented 2 years ago

This adds a tag_error_class option to StatsD.stats_count_success to allow keeping track of failure reasons. This feature is opt in to not blow up cardinality (with tests) and only happens in the error case (not falsey return values)

This is to allow us to move to more usage of the metaprogramming API while still keeping track of error classes.

denislaliberte commented 2 years ago

should we add the change to the changelog ?

TobiasBales commented 2 years ago

should we add the change to the changelog ?

probably should, I'll try and figure out how that works

TobiasBales commented 2 years ago

the change look good to me, I left a small optional comment

it is the first time I review in this code base... is there any testing expected from reviewer

I thought about that too but what do we do in the case that it is not a hash - in this case it will just raise, we could explicitly raise or log (using puts?, not sure) and return the original tags to not break anything

Thinking about it the last option seems like the nicest, I just don't have any idea on how to log this nicely (and how write decent tests)