Grafana dashboard: Ruby on Rails Slowlog by Controller Action
Description: A list of the slowest controller actions

# A Ruby on Rails Performance Dashboard

The datasource would be a [influxdb](https://www.influxdata.com/products/influxdb-overview/) database that is filled by the official [influxdb-rails](https://github.com/influxdata/influxdb-rails) reporter.

**PLEASE NOTE**: This dashboard is one of a collection of Ruby on Rails dashboards. They make the most sense united.

- [Ruby On Rails Performance Overview](https://grafana.com/dashboards/10428/)
- Performance insights into individual requests, see [Ruby On Rails Performance per Request](https://grafana.com/dashboards/10429/)
- Performance of individual actions, see [Ruby On Rails Performance per Action](https://grafana.com/grafana/dashboards/11031)
- [Ruby On Rails Health Overview](https://grafana.com/grafana/dashboards/14115)
- [Ruby on Rails ActiveJob Overview](https://grafana.com/grafana/dashboards/14116)
- [Ruby on Rails Slowlog by Request](https://grafana.com/grafana/dashboards/14118)
- [Ruby on Rails Slowlog by Action](https://grafana.com/grafana/dashboards/14117)
- [Ruby on Rails Slowlog by SQL](https://grafana.com/grafana/dashboards/14119)

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB-RAILS",
      "label": "InfluxDB",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.1.1"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table-old",
      "name": "Table (old)",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "A list of the slowest controller actions",
  "editable": true,
  "gnetId": 14117,
  "graphTooltip": 0,
  "id": null,
  "links": [
    {
      "$$hashKey": "object:349",
      "icon": "external link",
      "keepTime": true,
      "tags": [
        "influxdb-rails"
      ],
      "type": "dashboards"
    }
  ],
  "panels": [
    {
      "columns": [],
      "datasource": "${DS_INFLUXDB-RAILS}",
      "description": "The list of slowest controller actions",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fontSize": "100%",
      "gridPos": {
        "h": 23,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": 3,
        "desc": true
      },
      "styles": [
        {
          "$$hashKey": "object:5125",
          "alias": "Finished",
          "align": "auto",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "hidden"
        },
        {
          "$$hashKey": "object:5127",
          "alias": "Execution Time",
          "align": "auto",
          "colorMode": "value",
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "max",
          "thresholds": [
            "3000",
            "50000"
          ],
          "type": "number",
          "unit": "ms"
        },
        {
          "$$hashKey": "object:5129",
          "alias": "Controller Action",
          "align": "auto",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "link": true,
          "linkTargetBlank": true,
          "linkTooltip": "View data per this Controller Action",
          "linkUrl": "/d/influxdb-rails-action/ruby-on-rails-performance-per-action?var-Action=${__cell_1}&from=${__cell_2}&to=${__cell_0}",
          "mappingType": 1,
          "pattern": "method",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "$$hashKey": "object:505",
          "alias": "Started",
          "align": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "started",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "$$hashKey": "object:826",
          "alias": "Ended",
          "align": "auto",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "ended",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "method"
              ],
              "type": "tag"
            }
          ],
          "limit": "",
          "measurement": "rails",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "started"
                ],
                "type": "field"
              }
            ],
            [
              {
                "params": [
                  "controller"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "max"
              }
            ]
          ],
          "tags": [
            {
              "key": "hook",
              "operator": "=",
              "value": "process_action"
            }
          ]
        }
      ],
      "title": "Slowest Actions",
      "transform": "table",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "alias": "ended",
            "binary": {
              "left": "started",
              "operator": "+",
              "reducer": "sum",
              "right": "max"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        }
      ],
      "type": "table-old"
    }
  ],
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "Performance",
    "Ruby on Rails",
    "influxdb-rails"
  ],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Ruby on Rails Slowlog by Controller Action",
  "uid": "influxdb-rails-slowlog-action",
  "version": 12
}