Skip to content

undefined method `url' for #<Datadog::Transport::HTTP::Adapters::Test:0x00007fde4b256bc0> #1132

Closed

Description

Using gem version: ddtrace 0.38.0

Recently, we have this error message when launching our rspec suite on a rails project:
Full error message:

W, [2020-08-03T13:29:43.057611 #15929]  WARN -- ddtrace: [ddtrace] Failed to collect environment information: undefined method `url' for #<Datadog::Transport::HTTP::Adapters::Test:0x00007fde4b256bc0> location: /Users/cyril/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/ddtrace-0.38.0/lib/ddtrace/diagnostics/environment_logger.rb:111:in `agent_url'

Here is our full configuration:

Datadog.configure do |c|
  c.use(:rails)

  c.tracer.enabled = true

  # Set transport to no-op mode. Enable tracer so that the stack is the same on every env (test, staging, etc.),
  # but only send the event to datadog agent in production.
  # The datadog agent will only accept apm http calls in production anyway.
  c.tracer.transport_options = proc { |t| t.adapter(:test) } unless Rails.env.production?
end

When I apply this patch:

module TestAdapterUrlMethod
  def url
    ''
  end
end
Datadog::Transport::HTTP::Adapters::Test.prepend(TestAdapterUrlMethod)

I get on stdout what seems to be a debug log with the warn level:
W, [2020-08-03T13:30:38.668865 #16240] WARN -- ddtrace: [ddtrace] DATADOG TRACER CONFIGURATION - {"date":"2020-08-03T13:30:38+02:00", ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions