We use Datadog APM for all our Rails apps but have not been able to make it work for our Sinatra apps. Can you direct me to the most current instructions? We want to try again.
http://www.rubydoc.info/github/DataDog/dd-trace-rb/#Sinatra
-or-
https://github.com/DataDog/dd-trace-rb#quickstart-integration
Or a combination of?
Hello @wassimk! you can check the current updated documentation here: http://www.rubydoc.info/github/Datadog/dd-trace-rb/v0.7.2#Sinatra (it points to the same doc of your first link). Exactly what issue did you have while doing the first round of instrumentation?
Thank you!
@wassimk I've managed to work with sinatra using this examples. See if that works for you. :)
Perhaps I'm just not understanding. On a Sinatra app does it automatically trace events like it does with Rails? Or do I need to send what I want?
The agent is running on the server. I know for sure because a Rails app on same server is sending APM data correctly.
I see it running when I launch the Sinatra app.
D, [2017-06-21T10:04:41.519622 #20451] DEBUG -- ddtrace: [ddtrace] (/var/www/api/vendor/bundle/ruby/2.3.0/gems/ddtrace-0.7.2/lib/ddtrace/tracer.rb:109:in `set_service_info') set_service_info: service: api app: sinatra type: web
The code in config.ru:
require "sinatra/base"
require 'ddtrace'
require 'ddtrace/contrib/sinatra/tracer'
settings.datadog_tracer.configure default_service: 'api', debug: true
@wassimk the tracer for sinatra seems to configure itself out of the box for App < Sinatra::Application only. Are you trying to trace a Sinatra::Base?
@emaiax --- you are correct, sir! We were inheriting from Sinatra::Base. We switched toSinatra::Application and disabled a few things we didn't want and it's good to go!
@wassimk another test you could run, it's to manually register sinatra's tracer inside your class, like this:
require "ddtrace"
require "ddtrace/contrib/sinatra/tracer"
class App < Sinatra::Base
register Datadog::Contrib::Sinatra::Tracer
end
This should do the trick without changing your app. :)
It took me a while to found this out. I'll send a PR fixing the docs, ok @palazzem?
Most helpful comment
@wassimk another test you could run, it's to manually register sinatra's tracer inside your class, like this:
This should do the trick without changing your app. :)
It took me a while to found this out. I'll send a PR fixing the docs, ok @palazzem?