{
  "leansignal_demand_export": "1.0",
  "exported_at": "2026-07-17T00:00:00Z",
  "source_tenant": "leansignal-catalog",
  "catalog": {
    "slug": "ruby-otel-demand-essential",
    "integration": "ruby",
    "variant": "essential",
    "title": "Ruby on Rails — Essential",
    "category": "SDK",
    "dashboards": 1,
    "panels": 4,
    "alerts": 3,
    "docs_url": "https://docs.leansignal.io/integrations/ruby/"
  },
  "demand": {
    "ref": "demand",
    "name": "Ruby on Rails — Essential (OpenTelemetry)",
    "description": "The RED golden signals for a Rails app — request rate, error rate, and request latency — plus database time, from Prometheus (Yabeda) instrumentation. Enough to know the app is healthy.",
    "dashboards": [
      {
        "ref": "dash-ruby",
        "name": "Ruby on Rails — Essential",
        "description": "Rails HTTP request metrics (rate, errors, latency) plus view and database time, from Prometheus (Yabeda) instrumentation scraped into LeanSignal (essential variant).",
        "data": {
          "display": {
            "name": "Ruby on Rails — Essential"
          },
          "panels": {
            "request_rate": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Request rate",
                  "description": "Inbound request throughput per instance."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "requests/sec"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (instance) (rate(rails_requests_total{instance=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{instance}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "error_rate": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "5xx error rate",
                  "description": "Share of requests answered 5xx."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "percent-decimal"
                      },
                      "min": 0,
                      "max": 1
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "sum by (instance) (rate(rails_requests_total{instance=~\"$instance\",status=~\"5..\"}[5m])) / sum by (instance) (rate(rails_requests_total{instance=~\"$instance\"}[5m]))",
                          "seriesNameFormat": "{{instance}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "request_latency_p95": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Request latency p95",
                  "description": "95th-percentile request latency per instance."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "seconds"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "histogram_quantile(0.95, sum by (le, instance) (rate(rails_request_duration_seconds_bucket{instance=~\"$instance\"}[5m])))",
                          "seriesNameFormat": "{{instance}}"
                        }
                      }
                    }
                  }
                ]
              }
            },
            "db_runtime_p95": {
              "kind": "Panel",
              "spec": {
                "display": {
                  "name": "Database time p95",
                  "description": "ActiveRecord time per request — slow queries or connection pressure."
                },
                "plugin": {
                  "kind": "TimeSeriesChart",
                  "spec": {
                    "legend": {
                      "position": "bottom",
                      "mode": "table",
                      "values": [
                        "last-number",
                        "mean",
                        "max"
                      ]
                    },
                    "yAxis": {
                      "format": {
                        "unit": "seconds"
                      },
                      "min": 0
                    }
                  }
                },
                "queries": [
                  {
                    "kind": "TimeSeriesQuery",
                    "spec": {
                      "plugin": {
                        "kind": "PrometheusTimeSeriesQuery",
                        "spec": {
                          "query": "histogram_quantile(0.95, sum by (le, instance) (rate(rails_db_runtime_seconds_bucket{instance=~\"$instance\"}[5m])))",
                          "seriesNameFormat": "{{instance}}"
                        }
                      }
                    }
                  }
                ]
              }
            }
          },
          "layouts": [
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Requests",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/request_rate"
                    }
                  },
                  {
                    "x": 12,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/error_rate"
                    }
                  }
                ]
              }
            },
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Latency",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/request_latency_p95"
                    }
                  }
                ]
              }
            },
            {
              "kind": "Grid",
              "spec": {
                "display": {
                  "title": "Database",
                  "collapse": {
                    "open": true
                  }
                },
                "items": [
                  {
                    "x": 0,
                    "y": 0,
                    "width": 12,
                    "height": 8,
                    "content": {
                      "$ref": "#/spec/panels/db_runtime_p95"
                    }
                  }
                ]
              }
            }
          ],
          "variables": [
            {
              "kind": "ListVariable",
              "spec": {
                "name": "instance",
                "display": {
                  "name": "Instance"
                },
                "allowAllValue": true,
                "allowMultiple": true,
                "customAllValue": ".*",
                "defaultValue": ".*",
                "plugin": {
                  "kind": "PrometheusLabelValuesVariable",
                  "spec": {
                    "labelName": "instance"
                  }
                }
              }
            }
          ],
          "duration": "1h",
          "refreshInterval": "30s",
          "datasources": {}
        }
      }
    ],
    "alert_rules": [
      {
        "ref": "alert-high-error-rate",
        "name": "High HTTP 5xx error rate",
        "description": null,
        "query": "sum by (instance) (rate(rails_requests_total{status=~\"5..\"}[5m])) / sum by (instance) (rate(rails_requests_total[5m]))",
        "condition_op": "gt",
        "threshold": 0.05,
        "interval": "1m",
        "for": "5m",
        "severity": "critical",
        "message": "{{labels.instance}} is serving {{value | percent:1}} 5xx responses.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-high-latency-p95",
        "name": "High request latency (p95)",
        "description": null,
        "query": "histogram_quantile(0.95, sum by (le, instance) (rate(rails_request_duration_seconds_bucket[5m])))",
        "condition_op": "gt",
        "threshold": 1,
        "interval": "1m",
        "for": "5m",
        "severity": "warning",
        "message": "{{labels.instance}} p95 request latency is {{value}}s.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      },
      {
        "ref": "alert-high-db-runtime-p95",
        "name": "High database time (p95)",
        "description": null,
        "query": "histogram_quantile(0.95, sum by (le, instance) (rate(rails_db_runtime_seconds_bucket[5m])))",
        "condition_op": "gt",
        "threshold": 0.5,
        "interval": "1m",
        "for": "10m",
        "severity": "warning",
        "message": "{{labels.instance}} p95 database time is {{value}}s — slow queries or connection pressure.",
        "notify_on_resolve": true,
        "paused": false,
        "channels": []
      }
    ]
  }
}
