Ruby
Traces | Metrics | App Logs | Custom Logs | Profiling |
---|---|---|---|---|
✅ | ✖ | ✖ | ✖ | ✅ |
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 example code here.
Prerequisites
1 Infra Agent
Infrastructure Agent (Infra Agent). To install the Infra Agent, see our Installation Guide.
2 Ruby Version
Ruby version 3.0.0
. Check your Ruby version with the following command:
ruby --version
Install
Step 1: Add Gems to Your Gemfile
gem 'opentelemetry-sdk' gem 'opentelemetry-exporter-otlp' gem 'opentelemetry-instrumentation-all' gem 'pyroscope' gem 'middleware_apm_linux', '~> 2.1.0'
gem 'opentelemetry-sdk' gem 'opentelemetry-exporter-otlp' gem 'opentelemetry-instrumentation-all' gem 'pyroscope' gem 'middleware_apm_windows', '~> 2.1.0'
Step 2: Import Tracker
require 'middleware/ruby_gem_linux' Middleware::RubyGem.init
require 'middleware/ruby_gem_windows' Middleware::RubyGem.init
Step 3: Capture Application Data
Traces
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:9320 \ OTEL_SERVICE_NAME="<Your Service Name>" \ OTEL_RESOURCE_ATTRIBUTES=project.name="<Your Project Name>" \ MW_API_KEY="<MW_API_KEY>" \ <YOUR COMMAND>
Profiling
Application Profiling is auto-configured upon completion of Step 2.
Continuous Profiling
Continuous profiling captures real-time performance insights from your application to enable rapid identification of resource allocation, bottlenecks, and more. Navigate to the Continuous Profiling section to learn more about using Continuous Profiling with the Ruby APM.
Need assistance or want to learn more about Middleware? Contact our support team in Slack.