# Ruby: APM not sending any data

**URL:** <https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028>\
**Category:** APM\
**Tags:** ruby\
**Created:** [July 5, 2019, 7:21am UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028 "2019-07-05T07:21:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rzlprnft](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@rzlprnft](https://discuss.elastic.co/u/rzlprnft)\
**Post date:** [July 5, 2019, 7:21am UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028/1 "2019-07-05T07:21:43Z")

</div>

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 [https://www.elastic.co/guide/en/apm/agent/ruby/2.x/getting-started-rack.html](https://www.elastic.co/guide/en/apm/agent/ruby/2.x/getting-started-rack.html) and also integrated this code inside the main file of our workers, where all dependencies are loaded:

```auto
# init.rb
ElasticAPM.start(YAML.load_file("config/elastic_apm.yml"))

```

```auto
# config/elastic_apm.yml
service_name: "api staging"
secret_token: "XXXX"
server_url: "https://XXXX.apm.eu-central-1.aws.cloud.es.io:443"

```

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:

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

[9] pry(main)> ElasticAPM.agent
=> #<ElasticAPM::Agent:0x007f1024771330
 @config=
  #<ElasticAPM::Config:0x007f102477eda0
   @active=true,
   @api_buffer_size=256,
   @api_request_size=768000,
   @api_request_time=10,
   @capture_body="off",
   @capture_env=true,
   @capture_headers=true,
   @config_file="config/elastic_apm.yml",
...
 @context_builder=
  #<ElasticAPM::ContextBuilder:0x007f10247709a8
   @config=
    #<ElasticAPM::Config:0x007f102477eda0
     @active=true,
     @api_buffer_size=256,
     @api_request_size=768000,
     @api_request_time=10,
     @capture_body="off",
     @capture_env=true,
     @capture_headers=true,
     @config_file="config/elastic_apm.yml",
     @current_user_email_method=:email,
     @current_user_id_method=:id,
     @current_user_username_method=:username,
     @custom_key_filters=[],
     @default_tags={},
     @disable_send=false,
     @disable_start_message=false,
     @disabled_spies=["json"],
     @environment="staging",
     @filter_exception_types=[],
     @http_compression=true,
     @ignore_url_patterns=[],
     @instrument=true,
     @instrumented_rake_tasks=[],
     @log_level=1,
     @log_path=nil,
...
     @root_path="/var/www/api/releases/20190705060553",
     @secret_token="XXXX",
     @server_url="https://XXXX.apm.eu-central-1.aws.cloud.es.io:443",
     @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** :  
v6.5.4

**Elasticsearch version** :  
v6.5.4

**APM Server version** :  
v6.5.4

**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

---

<div class="post-metadata">

**Author:** ![rzlprnft](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@rzlprnft](https://discuss.elastic.co/u/rzlprnft)\
**Post date:** [July 5, 2019, 11:54am UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028/2 "2019-07-05T11:54:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mikker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikker/32/22118_2.png) [@mikker](https://discuss.elastic.co/u/mikker)\
**Post date:** [July 5, 2019, 12:29pm UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028/3 "2019-07-05T12:29:59Z")

</div>

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

```auto
log_level: <%= Logger::DEBUG %>

```

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

---

<div class="post-metadata">

**Author:** ![rzlprnft](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@rzlprnft](https://discuss.elastic.co/u/rzlprnft)\
**Post date:** [July 5, 2019, 2:48pm UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028/4 "2019-07-05T14:48:43Z")

</div>

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

```auto
"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 [https://github.com/elastic/apm-agent-ruby/issues/390](https://github.com/elastic/apm-agent-ruby/issues/390) but I have the `service_name` set as you can see above.

---

<div class="post-metadata">

**Author:** ![rzlprnft](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@rzlprnft](https://discuss.elastic.co/u/rzlprnft)\
**Post date:** [July 5, 2019, 3:02pm UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028/5 "2019-07-05T15:02:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mikker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikker/32/22118_2.png) [@mikker](https://discuss.elastic.co/u/mikker)\
**Post date:** [July 6, 2019, 11:01am UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028/6 "2019-07-06T11:01:45Z")

</div>

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

Per the docs:

`ElasticAPM.start(app: YourSinatraBaseSubclass)`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 27, 2019, 7:01am UTC](https://discuss.elastic.co/t/ruby-apm-not-sending-any-data/189028/7 "2019-07-27T07:01:51Z")

</div>

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