Documentation

Ruby integration

Documentation / Ruby

Integrate a Ruby or Rails app with Logister.

The best path for Ruby projects is the logister-ruby gem. It matches the Ruby-specific setup experience in the app and is the recommended integration for Rails applications.

Guide overview

Use the gem when you want the fastest Ruby integration path.

The Ruby integration is the most direct path for Rails apps. It gives you a native setup flow for errors, metrics, logs, and check-ins with very little application code.

After reading this guide, you will know:

  • How to create a project and generate the API token you need.
  • How to install and configure logister-ruby.
  • How to wire your app to the ingest endpoint safely with environment variables.
  • How to enable database timing metrics for the performance views.

Before you start

Create the project with the `Ruby gem` integration type.

In Logister, choose Ruby gem for the project integration type. That makes the project settings page show Ruby-specific setup instructions and links back to this public guide.

What you need Why it matters
Project API token Authenticates your app when sending events
Hosted Logister base URL Used to build the ingest endpoint
Ruby app with Bundler Lets you install and configure logister-ruby

Setup flow

Recommended installation path

  1. Create the project and generate an API key.
  2. Add logister-ruby to the application.
  3. Configure the API key and Logister ingest endpoint.
  4. Optionally enable DB metrics for performance visibility.
Tip

If you only want error capture at first, ship the base config first and add database metrics later. That keeps the first rollout small and easy to verify.

Install

Add the gem

1. Add the dependency

ruby
gem "logister-ruby", "~> 0.1.2"

2. Install the gem

shell
bundle install

Add the gem to your app, install dependencies, then restart the web process so the configuration initializer loads.

Package links: RubyGems and GitHub.

Configure

Point the gem at your Logister project

Create the initializer directory if needed

shell
mkdir -p config/initializers

Minimal configuration

ruby
Logister.configure do |config|
  config.api_key = "your-project-api-token"
  config.endpoint = "https://your-logister-host.example/api/v1/ingest_events"
end

The API token is shown once when you create it in project settings, and the endpoint should be your hosted Logister base URL plus /api/v1/ingest_events.

Recommended initializer

ruby
# config/initializers/logister.rb
Logister.configure do |config|
  config.api_key = ENV.fetch("LOGISTER_API_KEY")
  config.endpoint = ENV.fetch("LOGISTER_ENDPOINT")
end

Using environment variables keeps tokens out of source control and makes it easier to promote the same setup across environments.

Important

The API token is only shown once in project settings. Store it in your environment or secret manager before you navigate away.

Metrics

Enable DB timing metrics when needed

ruby
Logister.configure do |config|
  config.capture_db_metrics = true
  config.db_metric_min_duration_ms = 10.0
  config.db_metric_sample_rate = 1.0
end

This is the easiest way to populate the Logister performance view with `db.query` timing data.

What these settings control

Setting Purpose
capture_db_metrics Turns database timing capture on
db_metric_min_duration_ms Filters out very fast queries
db_metric_sample_rate Controls how much query traffic is reported

What to verify after rollout

Verification
Performance page checklist
transactions visible
db.query samples flowing
no missing API token errors
Tip

After rollout, open the project performance page and confirm you see transaction volume first, then query timing data.