Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Uninitialized constant error (ruby-kafka) w/ v4.7.0

Open
#134 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby

Research direction

Start by reading ruby-kafka/lib/kafka/datadog.rb around lines 80-85, especially default_host and default_port, and compare the referenced Datadog::Statsd constants in the reported v4.7.0 release. Reproduce with ruby-kafka 0.7.1 or 0.7.10 and confirm that the uninitialized-constant error no longer occurs.

Written by the indexing model from the issue text.

Description

Hi, following the release of v4.7.0, an error results when using ruby-kafka v0.7.1
"uninitialized constant Datadog::Statsd::Connection::DEFAULT_PORT\nDid you mean? Datadog::Statsd::DEFAULT_BUFFER_SIZE"

ruby-kafka/lib/kafka/datadog.rb: line 80

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

Following is the listener error backtrace

[2020-02-17T20:05:44:328+0000Z] ERROR -- Phobos : {:message=>"Listener crashed, waiting 16.14s (uninitialized constant Datadog::Statsd::Connection::DEFAULT_PORT\nDid you mean? Datadog::Statsd::DEFAULT_BUFFER_SIZE)", :listener_id=>"51366e", :retry_count=>4, :waiting_time=>16.14, :exception_class=>"NameError", :exception_message=>"uninitialized constant Datadog::Statsd::Connection::DEFAULT_PORT\nDid you mean? Datadog::Statsd::DEFAULT_BUFFER_SIZE", :backtrace=>["/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/datadog.rb:85:in default_port'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/datadog.rb:52:in port'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/datadog.rb:34:in statsd'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/datadog.rb:106:in emit'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/datadog.rb:99:in block (2 levels) in <class:StatsdSubscriber>'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/datadog.rb:124:in request'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/subscriber.rb:145:in finish'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications/fanout.rb:160:in finish'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications/fanout.rb:62:in block in finish'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications/fanout.rb:62:in each'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications/fanout.rb:62:in finish'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications/instrumenter.rb:45:in finish_with_state'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications/instrumenter.rb:30:in instrument'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications.rb:180:in instrument'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/instrumenter.rb:21:in instrument'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/connection.rb:97:in send_request'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/broker.rb:200:in send_request'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/broker.rb:44:in fetch_metadata'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/cluster.rb:375:in block in fetch_cluster_info'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/cluster.rb:370:in each'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/cluster.rb:370:in fetch_cluster_info'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/cluster.rb:350:in cluster_info'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/cluster.rb:98:in refresh_metadata!'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/cluster.rb:52:in add_target_topics'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/consumer_group.rb:27:in subscribe'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/consumer.rb:575:in subscribe_to_topic'", "/usr/local/bundle/gems/ruby-kafka-0.7.10/lib/kafka/consumer.rb:105:in subscribe'", "/usr/local/bundle/gems/phobos-1.8.2/lib/phobos/listener.rb:96:in block in start_listener'", "/usr/local/bundle/gems/phobos-1.8.2/lib/phobos/instrumentation.rb:21:in block in instrument'", "/usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications.rb:182:in instrument'", "/usr/local/bundle/gems/phobos-1.8.2/lib/phobos/instrumentation.rb:20:in instrument'", "/usr/local/bundle/gems/phobos-1.8.2/lib/phobos/listener.rb:94:in start_listener'", "/usr/local/bundle/gems/phobos-1.8.2/lib/phobos/listener.rb:46:in start'", "/usr/local/bundle/gems/phobos-1.8.2/lib/phobos/executor.rb:72:in run_listener'", "/usr/local/bundle/gems/phobos-1.8.2/lib/phobos/executor.rb:31:in block (2 levels) in start'", "/usr/local/bundle/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:353:in run_task'", "/usr/local/bundle/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:342:in block (3 levels) in create_worker'", "/usr/local/bundle/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:325:in loop'", "/usr/local/bundle/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:325:in block (2 levels) in create_worker'", "/usr/local/bundle/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:324:in catch'", "/usr/local/bundle/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:324:in block in create_worker'", "/usr/local/bundle/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in block in create_with_logging_context'"]}

Thank you

Dominant language
Ruby
Stars
208
Forks
138
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/dogstatsd-ruby

All issues in DataDog/dogstatsd-ruby

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.