CHANGELOG.md in statsd-instrument-2.5.1 vs CHANGELOG.md in statsd-instrument-2.6.0

- old
+ new

@@ -4,10 +4,79 @@ creating a pull request, please add an entry to the "unreleased changes" section below. ### Unreleased changes +_Nothing yet!_ + +## Version 2.6.0 + +This release contains a new `StatsD::Instrument::Client` class, which is +slated to replace the current implementation in the next major release. + +The main reasons for this rewrite are two folds: +- Improved performance. +- Being able to instantiate multiple clients. + +We have worked hard to make the new client as compatible as possible. However, +to accomplish some of our goals we have deprecated some stuff that we think +is unlikely to be used. See the rest of the release notes of this version, and +version 2.5.0 to see what is deprecated. + +You can test compatibility with the new client by replacing `StatsD` with +`StatsD.client`, which points to a client that will be instantiated using +the same environment variables that you can already use for this library. You +can also use strict mode, and rubocop rules to check whether you are using any +deprecated patterns. See below for more info. + +- **⚠️ DEPRECATION**: Using the `prefix: "foo"` argument for `StatsD.metric` + calls (and the metaprogramming macros) is deprecated. + + - You can include the prefix in the metric name. + - If you want to override the global prefix, set `no_prefix: true` and + include the desired prefix in the metric name + + This library ships with a Rubocop rule to detect uses of this keyword + argument in your codebase: + + ``` sh + # Check for the prefix arguments on your StatsD.metric calls + rubocop --only StatsD/MetricPrefixArgument \ + -r `bundle show statsd-instrument`/lib/statsd/instrument/rubocop.rb + ``` + + Strict mode has also been updated to no longer allow this argument. + +- **⚠️ DEPRECATION**: Using the `as_dist: true` argument for `StatsD.measure` + and `statsd_measure` methods is deprecated. This argument was only available + for internal use, but was exposed in the public API. It is unlikely that you + are usijng this argumenr, but you can check to make sure using this Rubocop + invocation: + + ``` sh + # Check for the as_dist arguments on your StatsD.measure calls + rubocop --only StatsD/MeasureAsDistArgument \ + -r `bundle show statsd-instrument`/lib/statsd/instrument/rubocop.rb + ``` + + Strict mode has also been updated to no longer allow this argument. + +- You can now enable strict mode by setting the `STATSD_STRICT_MODE` + environment variable. No more need to change your Gemfile! Note that it is + still not recommended to enable strict mode in production due to the + performance penalty, but is recommended for development and test. E.g. use + `STATSD_STRICT_MODE=1 rails test` to run your test suite with strict mode + enabled to expose any deprecations in your codebase. + +- Add support for `STATSD_PREFIX` and `STATSD_DEFAULT_TAGS` environment variables + to configure the prefix to use for metrics and the comma-separated list of tags + to apply to every metric, respectively. + + These environment variables are preferred over using `StatsD.prefix` and + `StatsD.default_tags`: it's best practice to configure the StatsD library + using environment variables. + - Several improvements to `StatsD.event` and `StatsD.service_check` (both are Datadog-only). The previous implementation would sometimes construct invalid datagrams based on the input. The method signatures have been made more explicit, and documentation of these methods is now also more clear. @@ -17,11 +86,11 @@ previousloy were succeeding. Consider the following example: ``` ruby - assert_raises(RuntimeError) + assert_raises(RuntimeError) do assert_statsd_increment('foo') do raise 'something unexpected' end end ``` @@ -37,11 +106,11 @@ Now, we fail the test because an unexpected exception occured inside the block. This means that the following test will fail: ``` ruby - assert_raises(RuntimeError) + assert_raises(RuntimeError) do assert_statsd_increment('foo') do StatsD.increment('foo') raise 'something unexpected' end end @@ -51,31 +120,31 @@ `assert_statsd_instrument` so that `assert_statsd_increment` will not see any exceptions: ``` ruby assert_statsd_increment('foo') do - assert_raises(RuntimeError) + assert_raises(RuntimeError) do StatsD.increment('foo') raise 'something unexpected' end end ``` See #193, #184, and #166 for more information. -## Version 2.5.1 +## Verison 2.5.1 - **Bugfix:** when using metaprogramming methods, changes to `StatsD.prefix` after the metaprogramming method was evaluated would not be respected. This unfortunately is quite common when you set the StatsD prefix inside an initializer. This issue is now addressed: the prefix is evaluated at the mopment the metric is emitted, not when the metaprogramming method is being evaluated. (#202) ## Version 2.5.0 -- **DEPRECATION**: Providing a sample rate and tags to your metrics and method +- **⚠️ DEPRECATION**: Providing a sample rate and tags to your metrics and method instrumentation macros should be done using keyword arguments rather than positional arguments. Also, previously you could provide `value` as a keyword argument, but it should be provided as the second positional argument. ``` ruby @@ -113,10 +182,10 @@ rubocop --only StatsD/MetricValueKeywordArgument \ -r `bundle show statsd-instrument`/lib/statsd/instrument/rubocop/metric_value_keyword_argument.rb ``` -- **DEPRECATION**: Relying on the return value of the StatsD metric methods +- **⚠️ DEPRECATION**: Relying on the return value of the StatsD metric methods (e.g. `StatsD.increment`) is deprecated. StatsD is a fire-and-forget protocol, so your code should not depend on the return value of these methods. The documentation of the methods has been updated to reflect this change. The behavior of the library is not changed for the time being, so you can