Steven Aguilar
Steven Aguilar

Reputation: 3049

ERROR -- ddtrace: [ddtrace] Failed to open TCP connection to localhost:8126 (Connection refused - connect(2) for "localhost" port 8126)

I am currently working on a ruby on rails project that I have not deployed. While working in a development environment, every time I run rails console or the server I get the full error message:

ERROR -- ddtrace: [ddtrace] (/Users/stevenaguilar/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/ddtrace-0.8.0/lib/ddtrace/transport.rb:73:in `rescue in post') Failed to open TCP connection to localhost:8126 (Connection refused - connect(2) for "localhost" port 8126)

I thought I get around this issue by changing the configuration to work only in production. config/initializers/datadog-tracer.rb

Rails.configuration.datadog_trace = {
  auto_instrument: true,
  auto_instrument_redis: true,
  default_service: 'my-rails-app'
}

Upvotes: 5

Views: 8473

Answers (1)

Steven Aguilar
Steven Aguilar

Reputation: 3049

Change the configuration of the file config/initializers/datadog-tracer.rb this would make it so that ddtrace only works in production.

Rails.configuration.datadog_trace =
      {
        # may depend by your conditional env
        enabled: false,
        # these may be 'true' to keep parity with your production
        auto_instrument: true,
        auto_instrument_redis: true
      }

Upvotes: 3

Related Questions