[Awesome Ruby Gem] Use elastic-apm gem to send Transactions, Errors and Metrics data to Elastic APM Server
elastic-apm
elastic-apm gem is the official Elastic APM agent for Ruby and Ruby on Rails.
The APM Server receives data from APM agents and transforms them into Elasticsearch documents. It does this by exposing an HTTP server endpoint to which agents stream the APM data they collect. After the APM Server has validated and processed events from the APM agents, the server transforms the data into Elasticsearch documents and stores them in corresponding Elasticsearch indices.
The APM Server works in conjunction with APM agents, Elasticsearch, and Kibana. Please view the APM Overview for details on how these components work together.
Prerequisites
Make sure Elastic APM Server Application Performance Monitoring (APM) with Elasticsearch | Elastic - https://www.elastic.co/apm is running before you start implementing the APM agents.
Installation
You can install it as a gem:
1 | gem install elastic-apm |
or add it into a Gemfile (Bundler):
1 | # Gemfile |
Then, run bundle install
.
1 | bundle install |
Config
1 | # config/elastic_apm.yml: |
See the documentation Configuration | APM Ruby Agent Reference [3.x] | Elastic - https://www.elastic.co/guide/en/apm/agent/ruby/current/configuration.html for configuration options and advanced usage.
Run
APM is automatically started when your app boots. Configure the agent, by creating the config file config/elastic_apm.yml
.
Then, you can visit your Elastic Kibana Web UI to see Transactions, Errors and Metrics.
References
[2] elastic/apm-agent-ruby: Elastic APM agent for Ruby - https://github.com/elastic/apm-agent-ruby
[3] Application Performance Monitoring (APM) with Elasticsearch | Elastic - https://www.elastic.co/apm