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

Stop variable shadowing from breaking dynamic tags #343

Closed avdgaag closed 1 year ago

avdgaag commented 1 year ago

Summary

Fix dynamic tags being evaluated only once.

Description

Re-assigning the tags variable defined outside a block inside the block overrides that value for subsequent calls. That caused dynamic tags to be evaluated once and then be fixed to that first value — rather than being dynamically evaluated on every invocation. By using a unique variable name, this is prevented from happening.

Example

See the added tests; they fail without the change in this PR.

casperisfine commented 1 year ago

@avdgaag thanks for the fix. However, sorry but could you sign the CLA thing? :/

avdgaag commented 1 year ago

I have signed the CLA!

casperisfine commented 1 year ago

Thank you!