Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring non Rails tracers. #138

Closed
whithajess opened this issue Jun 15, 2017 · 3 comments
Closed

Configuring non Rails tracers. #138

whithajess opened this issue Jun 15, 2017 · 3 comments
Labels
docs Involves documentation
Milestone

Comments

@whithajess
Copy link
Contributor

whithajess commented Jun 15, 2017

I am struggling to work out how I can recreate the same:

Rails.configuration.datadog_trace =
  {
    # may depend by your conditional env
    enabled: false
  }

For a non Rails app when adding something like the Rack Trace Middleware you can do:

 Datadog::Contrib::Rack::TraceMiddleware, enabled: ['test','development'].exclude?(ENV['RACK_ENV'])

UPDATE: this doesn't actually work either ^

but when adding Datadog::Monkey.patch_module(:active_record) there is no option to disable this means when running in test or development modes you get a whole bunch of:

E, [2017-06-16T11:28:51.774635 #92936] ERROR -- ddtrace: [ddtrace] (.rvm/gems/ruby-2.3.3/gems/ddtrace-0.7.2/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)

If it is documented somewhere I haven't been able to find it.

@whithajess
Copy link
Contributor Author

whithajess commented Jun 16, 2017

Found you can just set Datadog.tracer.configure(enabled: ['test','development'].exclude?(ENV['RACK_ENV'])) will first patch documentation to make this clear before closing this.

@ufoot ufoot added the docs Involves documentation label Jun 20, 2017
@ufoot ufoot added this to the 0.7.3 milestone Jun 20, 2017
@ufoot
Copy link
Member

ufoot commented Jun 20, 2017

Indeed, using Datadog.trace.configure is the way to go here. Thanks for reporting this.

@theasteve
Copy link

Should we replace the configuration on datadog-tracer.rb file with Datadog.tracer.configure(enabled: ['test','development'].exclude? ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Involves documentation
Projects
None yet
Development

No branches or pull requests

3 participants