DataDog / dd-trace-rb

Datadog Tracing Ruby Client
https://docs.datadoghq.com/tracing/
Other
308 stars 375 forks source link

ddtrace - throws error when deploying a rails 6.1 instance #3649

Open rarodriguez94 opened 5 months ago

rarodriguez94 commented 5 months ago

Current behaviour

ERROR -- ddtrace: [ddtrace] (/usr/local/bundle/gems/ddtrace-1.22.0/lib/datadog/core/remote/negotiation.rb:50:in `endpoint?')

agent reachable but does not report /v0.7/config

Expected behaviour

dd-trace should not throw an error when a instance is deployed. Will this cause an issue when gathering logs? Currently I see data is getting to datadog, but can't confirm if something is missing

Steps to reproduce

How does datadog help you?

Environment

  gem 'ddtrace', require: 'ddtrace/auto_instrument'
if [[ $env != "dev" && "$DATADOG_APM" = "true" ]]; then
  export DD_SERVICE=$service
  export DD_VERSION=$version_app

  export DD_APM_ENABLED=true
  export DD_APM_NON_LOCAL_TRAFFIC=true
  export DD_PROFILING_ENABLED=true
  export DD_PROFILING_ALLOCATION_ENABLED=true
  export DD_TRACE_ENABLED=true
  export DD_TRACE_AGENT_URL=http://datadog-agent:8126
fi
require 'ddtrace'

Datadog.configure do |c|
  c.tracing.instrument :rails
end

Datadog::Tracing.before_flush(
  Datadog::Tracing::Pipeline::SpanFilter.new { |span|
    span.name == "rack.request" && span.get_tag("http.url") == "/health"
  }
)
ivoanjo commented 4 months ago

Hey @rarodriguez94 thanks for reaching out and apologies for taking this long to answer!

So this error happens because the datadog agent deployed on your setup is either outdated (and thus it did not have the remote configuration feature) or has remote configuration explicitly disabled.

If it's the former (an outdated agent), we do recommend looking into updating it :)

You can make ddtrace not even try to hit this endpoint by setting the DD_REMOTE_CONFIGURATION_ENABLED=false environment variable, or via code

Datadog.configure do |c|
  # ... other config ...
  c.remote.enabled = false
end

Let us know if this helps or if we can help in any other way!