Sha256: 45f6f07352047680eee43c23f2b3038838b245bf3c68933186e9db97d5edf52f
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
ifdef::env-github[] NOTE: For the best reading experience, please view this documentation at https://www.elastic.co/guide/en/apm/agent/ruby/current/introduction.html[elastic.co] endif::[] [[getting-started-rack]] === Getting started with Rack Add the gem to your `Gemfile`: [source,ruby] ---- gem 'elastic-apm' ---- Create a file `config/elastic_apm.yml`: [source,yaml] ---- server_url: http://localhost:8200 secret_token: '' ---- Include the middleware, start (and stop) Elastic APM when booting your app: [source,ruby] ---- # config.ru app = lambda do |env| [200, {'Content-Type' => 'text/plain'}, ['ok']] end # Wraps all requests in transactions and reports exceptions use ElasticAPM::Middleware # Start an instance of the Agent ElasticAPM.start(service_name: 'NothingButRack') run app # Gracefully stop the agent when process exits. # Makes sure any pending transactions are sent. at_exit { ElasticAPM.stop } ---- [float] [[getting-started-sinatra]] ==== Sinatra example [source,ruby] ---- # Example config.ru require 'sinatra/base' class MySinatraApp < Sinatra::Base use ElasticAPM::Middleware # ... end # Takes optional ElasticAPM::Config values ElasticAPM.start(app: MySinatraApp, ...) # You can also do the following, which is equivalent to the above: # ElasticAPM::Sinatra.start(MySinatraApp, ...) run MySinatraApp at_exit { ElasticAPM.stop } ----
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
elastic-apm-3.1.0 | docs/getting-started-rack.asciidoc |