Skip to content

Commit

Permalink
Use dogstatsd-ruby >= 4.0.0 and < 5.0.0 and pass nil host/port if not…
Browse files Browse the repository at this point in the history
… set

Recommended by @tjwp
  • Loading branch information
jonmagic committed Feb 21, 2020
1 parent 49aafac commit 4022e81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions lib/kafka/datadog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def statsd=(statsd)
end

def host
@host ||= default_host
@host
end

def host=(host)
Expand All @@ -49,7 +49,7 @@ def host=(host)
end

def port
@port ||= default_port
@port
end

def port=(port)
Expand Down Expand Up @@ -77,14 +77,6 @@ def tags=(tags)

private

def default_host
::Datadog::Statsd.const_defined?(:Connection) ? ::Datadog::Statsd::Connection::DEFAULT_HOST : ::Datadog::Statsd::DEFAULT_HOST
end

def default_port
::Datadog::Statsd.const_defined?(:Connection) ? ::Datadog::Statsd::Connection::DEFAULT_PORT : ::Datadog::Statsd::DEFAULT_PORT
end

def clear
@statsd && @statsd.close
@statsd = nil
Expand Down
2 changes: 1 addition & 1 deletion ruby-kafka.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "zstd-ruby"
spec.add_development_dependency "colored"
spec.add_development_dependency "rspec_junit_formatter", "0.2.2"
spec.add_development_dependency "dogstatsd-ruby", ">= 3.0.0", "< 4.6.0"
spec.add_development_dependency "dogstatsd-ruby", ">= 4.0.0", "< 5.0.0"
spec.add_development_dependency "statsd-ruby"
spec.add_development_dependency "prometheus-client", "~> 0.10.0"
spec.add_development_dependency "ruby-prof"
Expand Down

0 comments on commit 4022e81

Please sign in to comment.