Ruby APM with Kubernetes
  • 1 Minute to read
  • Dark
    Light
  • PDF

Ruby APM with Kubernetes

  • Dark
    Light
  • PDF

Article summary

This document details how to install the Ruby APM Profiler in your Ruby application running on Kubernetes.

Prerequisite

Follow the Retrace Kubernetes Install Guide.

Ruby Kubernetes Setup

Add Stackify Ruby APM GEM

Add the Stackify APM GEM to each application to monitor.
Modify application Gemfile:

gem 'stackify-ruby-apm'

Configure Application

Add config/stackify_apm.yml to your application, modify application_name and environment_name.

application_name: 'Ruby Application'
environment_name: 'Production'

Rails

Profiler will startup automatically, no additional configuration.

Non-Rails

Include StackifyRubyAPM::Middleware when starting your application:

# config.ru

require 'stackify-ruby-apm'
use StackifyRubyAPM::Middleware
StackifyRubyAPM.start

# application startup

at_exit { StackifyRubyAPM.stop }

Pod Configuration

Application containers are required to have the stackify volume mount configured in Retrace Kubernetes Install .

Example Application Pod YAML:

apiVersion: v1
kind: ReplicationController
metadata:
  name: pod-name
spec:
  replicas: 1
  selector:
    app: app-name
  template:
    metadata:
      name: template-name
      labels:
        app: app-name
    spec:
      containers:
      - name: container-name
        image: application-image
        volumeMounts:
          - mountPath: /usr/local/stackify
            name: stackify
      volumes:
        - name: stackify
          hostPath: 
            path: /var/stackify
            type: DirectoryOrCreate

Verify

Make application requests, you can then verify results in the Retrace dashboard.


Was this article helpful?