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

- old
+ new

@@ -6,10 +6,80 @@ ### Unreleased changes _Nothing yet!_ +## Version 2.7.0 + +This release allows you to switch the StatsD singleton to use the new, more +performant client. By setting `STATSD_USE_NEW_CLIENT` as environment variable +methods called on the StatsD singleton (e.g. `StatsD.increment`) will be +delegated to an instance of the new client, configured using environment +variables. + +The new client should be mostly compatible with the legacy client, but some +deprecated functionality will no longer work. See the changelog for version +2.6.0 and 2.5.0 for more information about the deprecations, and how to find +and fix deprecations in your code base. + +- The old legacy client that was implemented on the `StatsD` singleton has + been moved to `StatsD::LegacyClient.singleton`. By default, all method + calls on the `StatsD` singleton will be delegated to this legacy client. +- By setting `STATSD_USE_NEW_CLIENT` as environment variable, these method + calls will be delegated to an instance of the new client instead. This + client is configured using the xisting `STATD_*` environment variables, + like `STATSD_ADDR` and `STATSD_IMPLEMENTATION`. +- You can also assign a custom client to `StatsD.singleton_client`. + +The `assert_statsd_*` methods have been reworked to support asserting StatsD +datagrams coming from a legacy client, or from a new client. + +- By default, the assertion methods will capture metrics emitted from + `StatsD.singleton_client`. +- You can provide a `client` argument if you want to assert metrics being + emitted by a different client. E.g. + + ``` ruby + assert_statsd_increment('foo', client: my_custom_client) do + my_custom_client.increment('foo') + end + ``` + +- You can also capture metrics yourself, and then run assertions on them + by providing a `datagrams` argument: + + ``` ruby + datagrams = my_custom_client.capture do + my_custom_client.increment('foo') + end + assert_statsd_increment('foo', datagrams: datagrams) + ``` + + This makes it easy to run multiple assertions on the set of metrics that + was emitted without having to nest calls. + +- **⚠️ DEPRECATION**: The following methods to configure the legacy client + are deprecated: + + - `Statsd.backend` + - `StatsD.default_sample_rate` + - `StatsD.default_tags` + - `StatsD.prefix` + + We recommend configuring StatsD using environment variables, which will be + picked up by the new client as well. You can also instantiate a new client + yourself; you can provide similar configuration options to + `StatsD::Instrument::Client.new`. + + You can use the following Rubocop invocation to find any occurrences of + these deprecated method calls: + + ``` sh + rubocop --require `bundle show statsd-instrument`/lib/statsd/instrument/rubocop.rb \ + --only StatsD/SingletonConfiguration + ``` + ## 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. @@ -47,11 +117,11 @@ 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 + are using this argument, 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 \ @@ -102,13 +172,13 @@ Version 2.3.3 changed this by failing the test because no metric was being emitted. However, this would hide the the exception from the assertion message, complicating debugging efforts. - Now, we fail the test because an unexpected exception occured inside the block. + Now, we fail the test because an unexpected exception occurred inside the block. This means that the following test will fail: - +s ``` ruby assert_raises(RuntimeError) do assert_statsd_increment('foo') do StatsD.increment('foo') raise 'something unexpected' @@ -135,11 +205,11 @@ - **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 + moment 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 @@ -221,11 +291,11 @@ It is recommended to enable this in CI to find deprecation issues, but not in production because enabling it comes with a performance penalty. - **Performance improvements 🎉**: Several internal changes have made the - library run singificantly faster. The changes: + library run significantly faster. The changes: - Improve performance of duration calculations. (#168) - Early exit when no changes are needed to bring tags and metric names to normalized form. (#173) - Refactor method argument handling to reduce object allocations and @@ -259,11 +329,11 @@ - Make the library frozen string literal-compatible. (#161, #163) - Fix all Ruby warnings. (#162) ## Version 2.3.5 -- Re-add `StatsD::Instrument.duration`, which was accidentally removed since verison 2.5.3 (#157) +- Re-add `StatsD::Instrument.duration`, which was accidentally removed since version 2.5.3 (#157) ## Version 2.3.4 - Improve performance of `Metric#to_s` (#152) - Fix bug in escaping newlines for events with Datadog Backend (#153) @@ -299,11 +369,11 @@ - Add mutex around UDP socket invalidation (#147) ### Version 2.3.0 -- No changes from `beta6`, distribtions are GA at DataDog so making the distribution changes GA in gem +- No changes from `beta6`, distributions are GA at DataDog so making the distribution changes GA in gem ### Version 2.3.0.beta6 - Fix invalidate socket on connectivity issues in UDP (#135) @@ -325,19 +395,19 @@ - Add support for specifying a measure to emit as a distribution using `:as_dist` parameter ### Version 2.3.0.beta -- Add support for beta, datadog specifc distribution metrics +- Add support for beta, Datadog specific distribution metrics - Invalidate socket on connectivity issues ### Version 2.2.1 - Fix performance regression from v2.2.0 ### Version 2.2.0 -- Add support for two new datadog specific metric types: events and service checks. +- Add support for two new Datadog specific metric types: events and service checks. ### Version 2.1.3 - The `assert_statsd_calls` test helper will now raise an exception whenever a block isn't passed. - Sending stats inside an exit handler will no longer cause programs to exit abruptly.