Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for presence of the `STATSD_IMPLEMENTATION' env: #324

Merged
merged 1 commit into from
Aug 7, 2018

Conversation

Edouard-chin
Copy link
Contributor

@Edouard-chin Edouard-chin commented Aug 7, 2018

Check for presence of the `STATSD_IMPLEMENTATION' env:

  • Calling empty? when ENV['STATSD_IMPLEMENTATION'] isn't set makes kubernetes-deploy to crash.

    Fixing the issue by calling ActiveSuport's present? instead

@@ -15,7 +15,7 @@ def self.build
if ENV['STATSD_DEV'].present?
::StatsD.backend = ::StatsD::Instrument::Backends::LoggerBackend.new(Logger.new($stderr))
elsif ENV['STATSD_ADDR'].present?
statsd_impl = ENV['STATSD_IMPLEMENTATION'].empty? ? "datadog" : ENV['STATSD_IMPLEMENTATION']
statsd_impl = ENV['STATSD_IMPLEMENTATION'].to_s.empty? ? "datadog" : ENV['STATSD_IMPLEMENTATION']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENV['STATSD_IMPLEMENTATION'].present? is probably what you want.

@Edouard-chin Edouard-chin force-pushed the ec-statsd-env branch 5 times, most recently from ef23a5d to f5848be Compare August 7, 2018 20:14
Copy link
Contributor

@n1koo n1koo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nitpick though about commit message. We don't check if its a string.

- Calling `empty?` when ENV['STATSD_IMPLEMENTATION'] isn't set makes kubernetes-deploy to crash.

  Fixing the issue by calling ActiveSuport's `present?` instead
@Edouard-chin Edouard-chin changed the title Ensure the STATSD_IMPLEMENTATION env is a string: Check for presence of the `STATSD_IMPLEMENTATION' env: Aug 7, 2018
@Edouard-chin Edouard-chin merged commit 5fc851c into master Aug 7, 2018
@Edouard-chin Edouard-chin deleted the ec-statsd-env branch August 7, 2018 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants