Skip to content

Commit

Permalink
Merge pull request #212 from DataDog/remeh/5.3.0
Browse files Browse the repository at this point in the history
Prepare release of version 5.3.0
  • Loading branch information
remeh authored Oct 6, 2021
2 parents 6fb301a + 37c814c commit 92eb4b9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

[//]: # (comment: Don't forget to update lib/datadog/statsd/version.rb:DogStatsd::Statsd::VERSION when releasing a new version)

## 5.3.0 / 2021.08.04

* [ENHANCEMENT] Automatically re-allocate resources (e.g. background thread) if `dogstatsd-ruby` is used in an application using forks [#205][] by [@remeh][]

This will help in scenarios where applications are not handling cleanup/re-creation of the dogstatsd-ruby instances in forked processes.
If you are an user of v4.x versions of `dogstatsd-ruby` and want to migrate to v5.x, please make sure to go through [this section of the README](https://github.com/DataDog/dogstatsd-ruby#v5x-common-pitfalls) and through the [migration guide](https://github.com/DataDog/dogstatsd-ruby#migrating-from-v4x-to-v5x).
* [BUGFIX] Fix client telemetry in applications using forks [#205][] by [@remeh][]

Please note that this version will emit a deprecation message if you are using `ruby < 2.1`: we plan to drop support for ruby 2.0 in a future minor release.

## 5.2.0 / 2021.07.01

Expand Down Expand Up @@ -372,6 +381,7 @@ Future versions are likely to introduce backward incompatibilities with < Ruby 1
[#181]: https://github.com/DataDog/dogstatsd-ruby/issues/181
[#192]: https://github.com/DataDog/dogstatsd-ruby/issues/192
[#194]: https://github.com/DataDog/dogstatsd-ruby/issues/194
[#205]: https://github.com/DataDog/dogstatsd-ruby/issues/205
[@AMekss]: https://github.com/AMekss
[@abicky]: https://github.com/abicky
[@adimitrov]: https://github.com/adimitrov
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ This means the current thread is going to sleep and wait for a Queue which is gi
This is useful when closing the application or when checking unit tests.
## Versioning
This Ruby gem is using [Semantic Versioning](https://guides.rubygems.org/patterns/#semantic-versioning) but please note that supported Ruby versions can change in a minor release of this library. As much as possible, we will add a "future deprecation" message in the minor release preceding the one dropping the support.
## Credits
dogstatsd-ruby is forked from Rein Henrichs [original Statsd
Expand Down
16 changes: 16 additions & 0 deletions lib/datadog/statsd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
require_relative 'statsd/single_thread_sender'
require_relative 'statsd/forwarder'

$deprecation_message_mutex = Mutex.new
$deprecation_message_done = false

# = Datadog::Statsd: A DogStatsd client (https://www.datadoghq.com)
#
# @example Set up a global Statsd client for a server on localhost:8125
Expand Down Expand Up @@ -101,6 +104,19 @@ def initialize(
@serializer = Serialization::Serializer.new(prefix: @prefix, global_tags: tags)
@sample_rate = sample_rate

# deprecation message for ruby < 2.1.0 users as we will drop support for ruby 2.0
# in dogstatsd-ruby 5.4.0
# TODO(remy): remove this message and the two global vars used in dogstatd-ruby 5.4.0
if RUBY_VERSION < '2.1.0' && $deprecation_message_mutex.try_lock && !$deprecation_message_done
if logger != nil
logger.warn { "deprecation: dogstatsd-ruby will drop support of Ruby < 2.1.0 in a next minor release" }
else
puts("warning: deprecation: dogstatsd-ruby will drop support of Ruby < 2.1.0 in a next minor release")
end
$deprecation_message_done = true
$deprecation_message_mutex.unlock
end

@forwarder = Forwarder.new(
host: host,
port: port,
Expand Down

0 comments on commit 92eb4b9

Please sign in to comment.