{
  "__inputs": [],
  "title": "Laravel Actuator",
  "uid": "laravel-actuator",
  "description": "Sample dashboard for the metrics that nwidart/laravel-actuator serves at /actuator/prometheus. https://nwidart.github.io/laravel-actuator/guides/grafana-dashboard/",
  "tags": [
    "laravel",
    "php",
    "prometheus"
  ],
  "editable": true,
  "graphTooltip": 1,
  "timezone": "browser",
  "refresh": "30s",
  "schemaVersion": 39,
  "version": 1,
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "links": [
    {
      "title": "Documentation",
      "type": "link",
      "icon": "doc",
      "targetBlank": true,
      "url": "https://nwidart.github.io/laravel-actuator/guides/grafana-dashboard/"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "templating": {
    "list": [
      {
        "name": "datasource",
        "label": "Data source",
        "type": "datasource",
        "query": "prometheus",
        "current": {},
        "hide": 0,
        "refresh": 1,
        "regex": "",
        "options": []
      },
      {
        "name": "job",
        "label": "Job",
        "type": "query",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "query": {
          "query": "label_values({otel_scope_name=\"nwidart/laravel-metrics\"}, job)",
          "refId": "job"
        },
        "definition": "label_values({otel_scope_name=\"nwidart/laravel-metrics\"}, job)",
        "refresh": 2,
        "includeAll": true,
        "multi": true,
        "allValue": ".*",
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "sort": 1,
        "hide": 0,
        "regex": "",
        "options": []
      }
    ]
  },
  "panels": [
    {
      "type": "row",
      "title": "Overview",
      "id": 1,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "panels": []
    },
    {
      "type": "stat",
      "title": "Requests",
      "description": "HTTP requests per second, over the last rate interval. Actuator endpoints are not counted.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(http_server_request_duration_seconds_count{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 1
      },
      "id": 2,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "Server errors",
      "description": "Share of the requests of the time range that answered 5xx.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(http_server_request_duration_seconds_count{job=~\"$job\", error_type!=\"\"}[$__range])) / sum(rate(http_server_request_duration_seconds_count{job=~\"$job\"}[$__range]))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 0.01
              },
              {
                "color": "red",
                "value": 0.05
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 1
      },
      "id": 3,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "p95 request duration",
      "description": "95th percentile of the request duration over the time range.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=~\"$job\"}[$__range])))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 0.5
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 1
      },
      "id": 4,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "Exceptions",
      "description": "Exceptions reported by the application over the time range.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "round(sum(increase(laravel_exceptions_total{job=~\"$job\"}[$__range]))) or vector(0)",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 12,
        "y": 1
      },
      "id": 5,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "Failed attempts",
      "description": "Queued job attempts that threw, failed or timed out over the time range.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "round(sum(increase(messaging_process_duration_seconds_count{job=~\"$job\", error_type!=\"\"}[$__range]))) or vector(0)",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 15,
        "y": 1
      },
      "id": 6,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "Cache hit ratio",
      "description": "Cache reads that hit, over the time range, for every store.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(increase(laravel_cache_operations_total{job=~\"$job\", laravel_cache_result=\"hit\"}[$__range])) / sum(increase(laravel_cache_operations_total{job=~\"$job\", laravel_cache_operation=\"read\"}[$__range]))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "orange",
                "value": 0.5
              },
              {
                "color": "green",
                "value": 0.8
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "decimals": 1
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 18,
        "y": 1
      },
      "id": 7,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "Versions",
      "description": "Laravel and PHP versions of the process that answered the last scrape.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max by (laravel_version, process_runtime_version) (laravel_info{job=~\"$job\"})",
          "legendFormat": "Laravel {{laravel_version}} · PHP {{process_runtime_version}}",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "none",
        "graphMode": "none",
        "textMode": "name",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 21,
        "y": 1
      },
      "id": 8,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "row",
      "title": "HTTP requests",
      "id": 9,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Requests per second, by route",
      "description": "http.route is the route template, such as /users/{user}.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(sum by (http_request_method, http_route) (rate(http_server_request_duration_seconds_count{job=~\"$job\"}[$__rate_interval])), \"http_route\", \"(no route)\", \"http_route\", \"\")",
          "legendFormat": "{{http_request_method}} {{http_route}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 6
      },
      "id": 10,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Responses per second, by status class",
      "description": "",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (status) (label_replace(rate(http_server_request_duration_seconds_count{job=~\"$job\"}[$__rate_interval]), \"status\", \"${1}xx\", \"http_response_status_code\", \"([0-9]).*\"))",
          "legendFormat": "{{status}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "2xx"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "3xx"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "blue"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "4xx"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "orange"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "5xx"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "red"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 6
      },
      "id": 11,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Request duration",
      "description": "Percentiles are estimated from the histogram buckets (5 ms to 10 s).",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true,
          "instant": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true,
          "instant": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 14
      },
      "id": 12,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "p95 request duration, slowest routes",
      "description": "",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(topk(10, histogram_quantile(0.95, sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))), \"http_route\", \"(no route)\", \"http_route\", \"\")",
          "legendFormat": "{{http_route}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 14
      },
      "id": 13,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "table",
      "title": "Routes over the time range",
      "description": "Requests that matched no route, such as a 404 on an unknown path, are listed as (no route).",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(round(sum by (http_route) (increase(http_server_request_duration_seconds_count{job=~\"$job\"}[$__range]))), \"http_route\", \"(no route)\", \"http_route\", \"\")",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(sum by (http_route) (increase(http_server_request_duration_seconds_sum{job=~\"$job\"}[$__range])) / sum by (http_route) (increase(http_server_request_duration_seconds_count{job=~\"$job\"}[$__range])), \"http_route\", \"(no route)\", \"http_route\", \"\")",
          "legendFormat": "__auto",
          "refId": "B",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(histogram_quantile(0.95, sum by (le, http_route) (increase(http_server_request_duration_seconds_bucket{job=~\"$job\"}[$__range]))), \"http_route\", \"(no route)\", \"http_route\", \"\")",
          "legendFormat": "__auto",
          "refId": "C",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(sum by (http_route) (increase(http_server_request_duration_seconds_count{job=~\"$job\", error_type!=\"\"}[$__range])) / sum by (http_route) (increase(http_server_request_duration_seconds_count{job=~\"$job\"}[$__range])), \"http_route\", \"(no route)\", \"http_route\", \"\")",
          "legendFormat": "__auto",
          "refId": "D",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            }
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "p95"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "5xx"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "sortBy": [
          {
            "displayName": "Requests",
            "desc": true
          }
        ]
      },
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "renameByName": {
              "http_route": "Route",
              "laravel_job_name": "Job",
              "laravel_scheduler_task_name": "Task",
              "exception_type": "Exception",
              "Value #A": "Requests",
              "Value": "5xx",
              "Value #B": "Average",
              "Value #C": "p95",
              "Value #D": "5xx"
            }
          }
        }
      ],
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 22
      },
      "id": 14,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "row",
      "title": "Database",
      "id": 15,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 30
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Queries per second, by operation",
      "description": "Every process: web requests, queued jobs and commands. Failed queries are not recorded.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (db_operation_name) (rate(db_client_operation_duration_seconds_count{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "{{db_operation_name}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 31
      },
      "id": 16,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "p95 query duration, by database",
      "description": "",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le, db_system_name, db_namespace) (rate(db_client_operation_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "{{db_system_name}} {{db_namespace}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 31
      },
      "id": 17,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "p95 queries per request, top routes",
      "description": "From laravel.db.queries, the queries one request ran. A route high in this list often has an N+1 query. Requests to the actuator routes are not recorded.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "topk(10, histogram_quantile(0.95, sum by (le, http_route) (rate(laravel_db_queries_bucket{job=~\"$job\", http_route!=\"\"}[$__rate_interval]))))",
          "legendFormat": "{{http_route}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 31
      },
      "id": 18,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Transactions per second, by result",
      "description": "Outer transactions, from laravel.db.transaction.duration. A rising share of rolled_back means more failed writes.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "range": true,
          "instant": false,
          "expr": "sum by (laravel_db_transaction_result) (rate(laravel_db_transaction_duration_seconds_count{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "{{laravel_db_transaction_result}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 39
      },
      "id": 41,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "p95 transaction duration",
      "description": "From the beginning of an outer transaction to its commit or rollback. Long transactions hold locks.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "range": true,
          "instant": false,
          "expr": "histogram_quantile(0.95, sum by (le) (rate(laravel_db_transaction_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 39
      },
      "id": 42,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Eloquent models per second, by event",
      "description": "From laravel.eloquent.models. retrieved is the number of models hydrated; a jump means a query that loads too many rows.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "range": true,
          "instant": false,
          "expr": "sum by (laravel_eloquent_event) (rate(laravel_eloquent_models_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "{{laravel_eloquent_event}}",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 39
      },
      "id": 43,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Database server connections",
      "description": "Read during the scrape: the client connections open on the server of the default connection, from every client, and its limit. MySQL, MariaDB and PostgreSQL only.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "range": true,
          "instant": false,
          "expr": "max(laravel_db_server_connections{job=~\"$job\"})",
          "legendFormat": "open",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "range": true,
          "instant": false,
          "expr": "max(laravel_db_server_connections_max{job=~\"$job\"})",
          "legendFormat": "max",
          "refId": "B"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 6,
        "w": 12,
        "x": 0,
        "y": 47
      },
      "id": 44,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "Pending migrations",
      "description": "Read during the scrape: the migrations that php artisan migrate would run. Above 0 after a deploy, the code expects a schema the database does not have yet.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "range": false,
          "instant": true,
          "expr": "max(laravel_db_migrations_pending{job=~\"$job\"})",
          "legendFormat": "__auto",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 12,
        "y": 47
      },
      "id": 45,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "table",
      "title": "Most retrieved models over the time range",
      "description": "Eloquent models hydrated, by class.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "range": false,
          "instant": true,
          "format": "table",
          "expr": "topk(10, round(sum by (laravel_eloquent_model) (increase(laravel_eloquent_models_total{job=~\"$job\", laravel_eloquent_event=\"retrieved\"}[$__range]))))",
          "legendFormat": "__auto",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            }
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Retrieved"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "sortBy": [
          {
            "displayName": "Retrieved",
            "desc": true
          }
        ]
      },
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "renameByName": {
              "http_route": "Route",
              "laravel_job_name": "Job",
              "laravel_scheduler_task_name": "Task",
              "exception_type": "Exception",
              "Value #A": "Retrieved",
              "Value": "Retrieved",
              "laravel_eloquent_model": "Model"
            }
          }
        }
      ],
      "gridPos": {
        "h": 6,
        "w": 8,
        "x": 16,
        "y": 47
      },
      "id": 46,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "row",
      "title": "Queues",
      "id": 19,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 53
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Jobs dispatched and processed, by queue",
      "description": "Processed counts each attempt. Dispatched above processed for a while means the queue grows.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (messaging_destination_name) (rate(messaging_client_sent_messages_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "dispatched {{messaging_destination_name}}",
          "refId": "A",
          "range": true,
          "instant": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (messaging_destination_name) (rate(messaging_process_duration_seconds_count{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "processed {{messaging_destination_name}}",
          "refId": "B",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 54
      },
      "id": 20,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Failed attempts, by job",
      "description": "error.type is the exception class, \"failed\", or Illuminate\\Queue\\TimeoutExceededException.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (laravel_job_name, error_type) (rate(messaging_process_duration_seconds_count{job=~\"$job\", error_type!=\"\"}[$__rate_interval]))",
          "legendFormat": "{{laravel_job_name}} ({{error_type}})",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 54
      },
      "id": 21,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "p95 job duration, by job",
      "description": "",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le, laravel_job_name) (rate(messaging_process_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "{{laravel_job_name}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 54
      },
      "id": 22,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "table",
      "title": "Jobs over the time range",
      "description": "",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "round(sum by (laravel_job_name) (increase(messaging_process_duration_seconds_count{job=~\"$job\"}[$__range])))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "round(sum by (laravel_job_name) (increase(messaging_process_duration_seconds_count{job=~\"$job\", error_type!=\"\"}[$__range])) or (sum by (laravel_job_name) (increase(messaging_process_duration_seconds_count{job=~\"$job\"}[$__range])) * 0))",
          "legendFormat": "__auto",
          "refId": "B",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (laravel_job_name) (increase(messaging_process_duration_seconds_sum{job=~\"$job\"}[$__range])) / sum by (laravel_job_name) (increase(messaging_process_duration_seconds_count{job=~\"$job\"}[$__range]))",
          "legendFormat": "__auto",
          "refId": "C",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le, laravel_job_name) (increase(messaging_process_duration_seconds_bucket{job=~\"$job\"}[$__range])))",
          "legendFormat": "__auto",
          "refId": "D",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            }
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Attempts"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Failed"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "p95"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "sortBy": [
          {
            "displayName": "Attempts",
            "desc": true
          }
        ]
      },
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "renameByName": {
              "http_route": "Route",
              "laravel_job_name": "Job",
              "laravel_scheduler_task_name": "Task",
              "exception_type": "Exception",
              "Value #A": "Attempts",
              "Value": "p95",
              "Value #B": "Failed",
              "Value #C": "Average",
              "Value #D": "p95"
            }
          }
        }
      ],
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 62
      },
      "id": 23,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "row",
      "title": "Cache",
      "id": 24,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 69
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Hit ratio, by store",
      "description": "hit / (hit + miss). remember() counts a read, then a write on a miss.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (laravel_cache_store) (rate(laravel_cache_operations_total{job=~\"$job\", laravel_cache_result=\"hit\"}[$__rate_interval])) / sum by (laravel_cache_store) (rate(laravel_cache_operations_total{job=~\"$job\", laravel_cache_operation=\"read\"}[$__rate_interval]))",
          "legendFormat": "{{laravel_cache_store}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 70
      },
      "id": 25,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Operations per second, by result",
      "description": "increment, decrement, flush and locks dispatch no event and are not counted.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (laravel_cache_operation, laravel_cache_result) (rate(laravel_cache_operations_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "{{laravel_cache_operation}} {{laravel_cache_result}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "read hit"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "read miss"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "orange"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "write failure"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "red"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "delete failure"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "red"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 70
      },
      "id": 26,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "row",
      "title": "Scheduled tasks",
      "id": 27,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 78
      },
      "panels": []
    },
    {
      "type": "table",
      "title": "Tasks over the time range",
      "description": "A task is named by its description, or its command without arguments. Tasks skipped by withoutOverlapping() are not recorded.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "round(sum by (laravel_scheduler_task_name) (increase(laravel_scheduler_task_duration_seconds_count{job=~\"$job\"}[$__range])))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "round(sum by (laravel_scheduler_task_name) (increase(laravel_scheduler_task_duration_seconds_count{job=~\"$job\", error_type!=\"\"}[$__range])) or (sum by (laravel_scheduler_task_name) (increase(laravel_scheduler_task_duration_seconds_count{job=~\"$job\"}[$__range])) * 0))",
          "legendFormat": "__auto",
          "refId": "B",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (laravel_scheduler_task_name) (increase(laravel_scheduler_task_duration_seconds_sum{job=~\"$job\"}[$__range])) / sum by (laravel_scheduler_task_name) (increase(laravel_scheduler_task_duration_seconds_count{job=~\"$job\"}[$__range]))",
          "legendFormat": "__auto",
          "refId": "C",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            }
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Runs"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Failed"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "sortBy": [
          {
            "displayName": "Runs",
            "desc": true
          }
        ]
      },
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "renameByName": {
              "http_route": "Route",
              "laravel_job_name": "Job",
              "laravel_scheduler_task_name": "Task",
              "exception_type": "Exception",
              "Value #A": "Runs",
              "Value": "Average",
              "Value #B": "Failed",
              "Value #C": "Average"
            }
          }
        }
      ],
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 79
      },
      "id": 28,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Average task duration, by task",
      "description": "Over 10 minute windows, because most tasks run at most once a minute.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (laravel_scheduler_task_name) (increase(laravel_scheduler_task_duration_seconds_sum{job=~\"$job\"}[10m])) / sum by (laravel_scheduler_task_name) (increase(laravel_scheduler_task_duration_seconds_count{job=~\"$job\"}[10m]))",
          "legendFormat": "{{laravel_scheduler_task_name}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 79
      },
      "id": 29,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "row",
      "title": "Exceptions",
      "id": 30,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 87
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Exceptions per minute, by class",
      "description": "Reported exceptions only: a 404 or a validation failure is not reported.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (exception_type) (rate(laravel_exceptions_total{job=~\"$job\"}[$__rate_interval])) * 60",
          "legendFormat": "{{exception_type}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 14,
        "x": 0,
        "y": 88
      },
      "id": 31,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "table",
      "title": "Most reported exceptions over the time range",
      "description": "",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "topk(10, round(sum by (exception_type) (increase(laravel_exceptions_total{job=~\"$job\"}[$__range]))))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            }
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Reported"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "sortBy": [
          {
            "displayName": "Reported",
            "desc": true
          }
        ]
      },
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "renameByName": {
              "http_route": "Route",
              "laravel_job_name": "Job",
              "laravel_scheduler_task_name": "Task",
              "exception_type": "Exception",
              "Value #A": "Reported",
              "Value": "Reported"
            }
          }
        }
      ],
      "gridPos": {
        "h": 8,
        "w": 10,
        "x": 14,
        "y": 88
      },
      "id": 32,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "row",
      "title": "PHP runtime and server",
      "id": 33,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 96
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "PHP-FPM workers",
      "description": "Read during the scrape, in the process that answers it: with several servers behind one address, each sample comes from whichever server answered. Only under PHP-FPM.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (php_fpm_process_state) (php_fpm_processes{job=~\"$job\"})",
          "legendFormat": "{{php_fpm_process_state}}",
          "refId": "A",
          "range": true,
          "instant": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(php_fpm_listen_queue{job=~\"$job\"})",
          "legendFormat": "waiting requests",
          "refId": "B",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "active"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "orange"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "idle"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "waiting requests"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "red"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 97
      },
      "id": 34,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "PHP-FPM saturation",
      "description": "Read during the scrape, in the process that answers it: with several servers behind one address, each sample comes from whichever server answered. Max children reached means requests waited for a worker: raise pm.max_children or add servers.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(increase(php_fpm_max_children_reached_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "max children reached",
          "refId": "A",
          "range": true,
          "instant": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(increase(php_fpm_slow_requests_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "slow requests",
          "refId": "B",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 97
      },
      "id": 35,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "OPcache memory",
      "description": "Read during the scrape, in the process that answers it: with several servers behind one address, each sample comes from whichever server answered. Wasted memory grows with each deploy until OPcache restarts.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (php_opcache_memory_state) (php_opcache_memory_usage_bytes{job=~\"$job\"})",
          "legendFormat": "{{php_opcache_memory_state}}",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "used"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "blue"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "free"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wasted"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "orange"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 97
      },
      "id": 36,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "OPcache hit ratio",
      "description": "Read during the scrape, in the process that answers it: with several servers behind one address, each sample comes from whichever server answered.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(php_opcache_lookups_total{job=~\"$job\", php_opcache_lookup_result=\"hit\"}[$__range])) / sum(rate(php_opcache_lookups_total{job=~\"$job\"}[$__range]))",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "orange",
                "value": 0.9
              },
              {
                "color": "green",
                "value": 0.99
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 0,
        "y": 105
      },
      "id": 37,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "stat",
      "title": "Cached scripts",
      "description": "Read during the scrape, in the process that answers it: with several servers behind one address, each sample comes from whichever server answered.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max(php_opcache_scripts{job=~\"$job\"})",
          "legendFormat": "__auto",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 4,
        "y": 105
      },
      "id": 38,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "timeseries",
      "title": "Load average (1 minute)",
      "description": "Read during the scrape, in the process that answers it: with several servers behind one address, each sample comes from whichever server answered. Compare it with the number of CPUs of the server.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max(system_cpu_load_average_1m{job=~\"$job\"})",
          "legendFormat": "load",
          "refId": "A",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "decimals": 2
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "gridPos": {
        "h": 6,
        "w": 10,
        "x": 8,
        "y": 105
      },
      "id": 39,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    },
    {
      "type": "gauge",
      "title": "Disk used",
      "description": "Read during the scrape, in the process that answers it: with several servers behind one address, each sample comes from whichever server answered. The disk that holds the application.",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(system_filesystem_usage_bytes{job=~\"$job\", system_filesystem_state=\"used\"}) / sum(system_filesystem_usage_bytes{job=~\"$job\"})",
          "legendFormat": "__auto",
          "refId": "A",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "min": 0,
          "max": 1,
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 0.8
              },
              {
                "color": "red",
                "value": 0.9
              }
            ]
          },
          "color": {
            "mode": "thresholds"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 18,
        "y": 105
      },
      "id": 40,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      }
    }
  ]
}
