Performance

Instrument your app

Enable APM in the Ruby SDK or WordPress plugin, or post transactions directly to the ingest API from any runtime.

APM data comes from inside your application, so it ships through an SDK rather than the server agent. APM is off by default in every integration — enabling it does not change existing error-only setups until you opt in.

Before you start

  • You need the project API key from the project settings.
  • Error reporting and APM share the same key and configuration; you are adding a flag, not a second integration.
  • On high-traffic services, plan a sample rate up front rather than recording every transaction.

Ruby SDK

Enable APM in your Errorgap configuration:

Errorgap.configure do |c|
  c.api_key     = "your-project-api-key"
  c.apm_enabled = true          # off by default
  # c.apm_sample_rate = 0.25    # record 25% of transactions (default 1.0)
end

In Rails the integration wires itself up when apm_enabled is true — no manual subscriber registration. Once enabled, the SDK records:

  • Web transactions — every Rack request with its method, normalized route (formatted as controller#action in Rails), status code, total duration, and database time.
  • Database spans — one span per Active Record query with normalized SQL and the first in-app frame that issued it.

Plain Rack apps without Rails routing fall back to the request path as the route pattern.

WordPress plugin

In the plugin settings page, check Enable APM. Page views are recorded as transactions with route patterns derived from WordPress conditionals, such as /post/:id, /category/:term, and /wp-admin/:page, so traffic groups sensibly instead of one row per URL.

To break down database time per query, also check Track DB queries and add this to wp-config.php:

define('SAVEQUERIES', true);

Without SAVEQUERIES, only the total query count is available — no per-query spans.

Send transactions directly

Any runtime can ship transactions by posting JSON to the ingest endpoint with the project API key:

POST /api/projects/:slug/transactions
X-Errorgap-Project-Key: <project-api-key>
Content-Type: application/json
{
  "kind": "web",
  "method": "GET",
  "path": "projects#index",
  "path_raw": "/projects",
  "status_code": 200,
  "duration_ms": 312.5,
  "environment": "production",
  "occurred_at": "2026-06-04T12:00:00Z",
  "spans": [
    {
      "kind": "db",
      "sql": "SELECT ? FROM projects WHERE id = ?",
      "file": "app/models/project.rb",
      "line": 42,
      "fn_name": "find",
      "duration_ms": 18.3
    }
  ]
}

For background jobs, set kind to job and include job_class and queue instead of the HTTP fields. The endpoint returns 201 Created with no body on success. Normalize SQL before sending — replace literal values with placeholders so queries aggregate and no sensitive data leaves your servers.

Verify data is flowing

  1. Enable APM and deploy, or send one transaction with the ingest API.
  2. Generate a few requests against the instrumented application.
  3. Open the project Performance page, set the range to the last hour, and confirm the summary charts and Routes view show traffic.
  4. If nothing appears, confirm the API key, that apm_enabled is true in the running environment, that the environment is not listed in ignore_environments, and that a sample rate below 1.0 is not filtering out your test traffic.