Stackify Ruby APM

Installation Guide

Rails Guide

  1. Install Stackify Linux Agent.

  2. Check that your setup meets our system requirements.

    • Ruby version 2.0+
    • Frameworks
      • Ruby on Rails 4+
      • Rack 1+
      • Sinatra 1.4+
    • Operating System
      • Linux
  3. Add gem 'stackify-ruby-apm' to your Gemfile.

  4. In the root folder of your Rails app create a file config/stackify_apm.yml and then add this configuration

    application_name: 'Ruby Application'
    environment_name: 'Production'
    
  5. Build/Deploy your application

Custom Instrumentation in Rails

  1. Create config/stackify.json file from the root of your app and place the class name and method name in which you want to instrument.

Example stackify.json:

{
  "instrumentation": [
  {
    "class": "<class name>",
    "method": "<method name>",
    "trackedFunctionName": "{{ClassName}}#{{MethodName}}",
    "trackedFunction": <true or false>,
    "transaction": <true or false>
  }
  ]
}
  1. In the config/initializer folder of your Rails app create a file config/initializer/stackify.rb and then add this configuration

    Rails.configuration.to_prepare do StackifyRubyAPM.run_custom_instrument end

Non-Rails Guide

  1. Install Stackify Linux Agent.

  2. Check that your setup meets our system requirements.

    • Ruby version 2.0+
    • Frameworks
      • Rack 1+
      • Sinatra 1.4+
    • Operating System
      • Linux
  3. Add gem 'stackify-ruby-apm' to your Gemfile.

  4. In the root folder of your Rails app create a file config/stackify_apm.yml and then add this configuration

        application_name: 'Ruby Application'
        environment_name: 'Production'
    
  5. In the config.ru add the following lines:

        use StackifyRubyAPM::Middleware
        StackifyRubyAPM.start
        at_exit { StackifyRubyAPM.stop }
    
  6. Build/Deploy your application

Custom Instrumentation in Non-Rails

  1. Create config/stackify.json file from the root of your app and place the class name and method name in which you want to instrument.

Example stackify.json:

{
  "instrumentation": [
  {
    "class": "<class name>",
    "method": "<method name>",
    "trackedFunctionName": "{{ClassName}}#{{MethodName}}",
    "trackedFunction": <true or false>,
    "transaction": <true or false>
  }
  ]
}
  1. In config.ru file add this line: StackifyRubyAPM.run_custom_instrument

Example:

    use StackifyRubyAPM::Middleware
    StackifyRubyAPM.start
    StackifyRubyAPM.run_custom_instrument
    at_exit { StackifyRubyAPM.stop }