错误 - ddtrace:[ddtrace]无法打开到localhost的TCP连接:8126(连接被拒绝 - 连接(2)为“localhost”端口8126)

时间:2017-08-17 19:53:20

标签: ruby-on-rails datadog

我目前正在开发一个我尚未部署的ruby on rails项目。在开发环境中工作时,每次运行rails console或服务器时,我都会收到完整的错误消息:

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)

我认为通过将配置更改为仅在生产中工作来解决此问题。 config/initializers/datadog-tracer.rb

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

1 个答案:

答案 0 :(得分:1)

更改文件config/initializers/datadog-tracer.rb的配置 这样可以使ddtrace仅适用于制作。

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
      }