Ruby: APM not sending any data

Hi everyone,

we already integrated APM in 3 projects with a total of 6 environments, all Rails.
However, we have another project (fairly old) in Sinatra with a lot of Sidekiq Workers that we like to monitor.

I followed this guides for Sinatra and also integrated this code inside the main file of our workers, where all dependencies are loaded:

# init.rb
# config/elastic_apm.yml
service_name: "api staging"
secret_token: "XXXX"
server_url: ""

After a staging deployment I triggered some workers and requests in the Sinatra app, but no data is showing, even after 1-2 hours.

I logged in on a pry session to see if the configurations are correct:

[5] pry(main)> ElasticAPM.running?
=> true

[9] pry(main)> ElasticAPM.agent
=> #<ElasticAPM::Agent:0x007f1024771330
     @service_name="api staging",

I also tried to send some data with ElasticAPM.with_transaction but nothing seems to be reported.

Any ideas on how to debug this, or what I'm doing wrong?

Kibana version:

Elasticsearch version:

APM Server version:

APM Agent language and version:
Ruby, 2.9.1

Original install method (e.g. download page, yum, deb, from source, etc.) and version:
bundler via Gemfile

Or is there a way to get a debug output of the response sent to APM?

Hi! You can increase the verbosity of the agent by setting the log level.
Like this for example:

log_level: <%= Logger::DEBUG %>

Let me know if that gives us a hint of what could be going wrong.

1 Like

@mikker thanks for the hint! I changed the log_level and now I get some errors in our logs

"Problem validating JSON document against schema: I[#] S[#] doesn't validate with \"metadata#\"\n  I[#/service/framework/version] S[#/properties/service/properties/framework/properties/version/type] expected string, but got null [{\"metadata\":{\"service\":{\"name\":\"api staging\",\"environment\":\"staging\",\"version\":null,\"agent\":{\"name\":\"ruby\",\"version\":\"2.9.1\"},\"framework\":{\"name\":\"Sinatra\",\"version\":null},\"language\":{\"name\":\"ruby\",\"version\":\"2.4.1\"},\"runtime\":{\"name\":\"ruby\",\"version\":\"2.4.1\"}},\"process\":{\"pid\":28438,\"title\":\"/var/www/api_staging/shared/bundle/ruby/2.4.0/bin/sidekiq\",\"argv\":[]},\"system\":{\"hostname\":\"Ubuntu-1204-precise-64-minimal\",\"architecture\":\"x86_64\",\"platform\":\"linux\",\"kubernetes\":{\"namespace\":null,\"node\":{\"name\":null},\"pod\":{\"name\":null,\"uid\":null}}}}}]"

I tried setting the framework_name to Sinatra but still the same error. Any idea what config I have to set? I found this issue on github but I have the service_name set as you can see above.

ok, i just found out you also have to set the framework_version by hand, otherwise it throws an error. Thanks anyway!

Actually the recommended way to start the agent will do this for you with Sinatra.

Per the docs:

ElasticAPM.start(app: YourSinatraBaseSubclass)

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.