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
574 stars 97 forks source link

Prefix cannot be removed once set #350

Closed Mangara closed 1 year ago

Mangara commented 1 year ago

The documentation for the prefix option states

The prefix can be overridden by any metric call by setting the no_prefix keyword argument to true. We recommend against doing this, but this behavior is retained for backwards compatibility. Rather, when you feel the need to do this, we recommend instantiating a new client without prefix (using clone_with_options), and using it to emit the metric.

However, this does not work due to the way clone_with_options works:

def clone_with_options(prefix: nil, ...)
  self.class.new(prefix: prefix || @prefix, ...)
end

So calling clone_with_options(prefix: nil) will maintain the same prefix as before.