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