TracesMetricsApp LogsCustom LogsProfiling
✖️✖️✖️

This guide walks you through setting up Application Performance Monitoring (APM) on a Ruby application. These instructions can also be found on the Installation page in your Middleware Account. View demo code here.

Prerequisites

  • Middleware Host Agent (MW Agent), to install the MW Agent please see our installation guide.
  • Ruby version 3.0.0, you can check your Ruby version with the following command.
Shell
ruby --version

Step 1: Add Gems to Your Gemfile

  • Linux Gemfile

  • Windows Gemfile

Ruby
   gem 'opentelemetry-sdk'
   gem 'opentelemetry-exporter-otlp'
   gem 'opentelemetry-instrumentation-all'
   gem 'pyroscope'
   gem 'middleware_apm_linux', '~> 2.1.0'

Step 2: Import Tracker

  • Linux Environment

  • Windows Environment

Ruby
    require 'middleware/ruby_gem_linux'
    Middleware::RubyGem.init

Step 3: Capture Application Data

Traces

Shell
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:9320 \ 
OTEL_SERVICE_NAME="<Your Service Name>" \ 
OTEL_RESOURCE_ATTRIBUTES=project.name="<Your Project Name>" \ 
MW_API_KEY=<Your API Key> \ 
<YOUR COMMAND> 

Profiling

Application Profiling is auto-configured upon completion of Step 2.

Need assistance or want to learn more about Middleware? Contact us at support[at]middleware.io.