I'm trying to use the Ruby APM agent. We have a Sinatra based app that uses ActiveRecord. Currently APM doesn't show the database calls, just the top level Rack calls. Is there an easy way to turn this on? It looks like from the code that it's only enabled for Rails, before I spend more time digging into the code to figure out if it's possible has anyone else done this?
I haven't tried or heard of this exact combination with the agent before but it should be doable.
The "problem" is that ActiveRecord instrumentation works via ActiveSupport::Notifications and the agent isn't subscribing to those when not loaded via Rails.
But! It should work if you just instantiate your own ElasticAPM::Subscriber, ie somewhere after starting the agent, do ElasticAPM::Subscriber.new(ElasticAPM.agent).register!.
I take it ActiveRecord already depends on ActiveSuppport but if I'm wrong, you might have to do a require 'activesupport' somewhere too.
That idea results in an error as it looks like the Normalizer needs to be registered first. normalizers.rb line 25 throws a nil error.
I'm having a look to see if I can figure out where/how that needs to happen.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.