3

我目前正在开发一个尚未部署的 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'
}
4

1 回答 1

2

更改文件的配置,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
      }
于 2017-08-17T20:00:08.493 回答