Grafana dashboard: Kooper controllers
Description: A simple dashboard to check how Kubernetes controllers and operators are performing. This Is based on the metrics exposed by Kooper framework. Kooper is a framework to create Kubernetes operators and controllers.

## Description
A simple dashboard to check how Kubernetes controllers and operators are performing. This Is based on the metrics exposed by [Kooper][kooper-repo] framework. Kooper is a framework to create Kubernetes operators and controllers.

## Requirements

* The minimum required version of kooper is [v0.4.0][kooper-v0404]

## Features
The dashboard has various single stats:
- The rate of processing resource events (sent by the apiserver) by the controller per second.
- The throughtput of the queued resource events (queued vs processed)
- The duration of processing of each resource events.
- The rate of errors of processing events.

[kooper-repo]: https://github.com/spotahome/kooper
[kooper-v0404]: https://github.com/spotahome/kooper/releases/tag/v0.4.0

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS-DEVOPS",
      "label": "prometheus",
      "description": "The prometheus data source where the Kooper metrics are stored",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.1.4"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": "5.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 7082,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1532622607566,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "panels": [],
      "repeat": "controller",
      "title": "",
      "type": "row"
    },
    {
      "content": "# ${controller} controller (${job})",
      "gridPos": {
        "h": 2,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 14,
      "links": [],
      "mode": "markdown",
      "title": "",
      "transparent": true,
      "type": "text"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#0a50a1"
      ],
      "datasource": "${DS_PROMETHEUS-DEVOPS}",
      "format": "short",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 3
      },
      "id": 7,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": " processed events/s",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "80%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(0, 0, 0, 0.1)",
        "full": false,
        "lineColor": "rgba(0, 0, 0, 0.32)",
        "show": true
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "sum(rate(kooper_controller_processed_events_total{job=\"${job}\",controller=\"${controller}\"}[$interval]))",
          "format": "time_series",
          "intervalFactor": 1,
          "refId": "A"
        }
      ],
      "thresholds": "0,0",
      "title": "",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#890f02"
      ],
      "datasource": "${DS_PROMETHEUS-DEVOPS}",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 6,
        "y": 3
      },
      "id": 4,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": " queued events (unprocessed)",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "80%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(0, 0, 0, 0.1)",
        "full": false,
        "lineColor": "rgba(0, 0, 0, 0.32)",
        "show": true
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "100 - (\n  sum(rate(kooper_controller_processed_events_total{job=\"${job}\",controller=\"${controller}\"}[$range])) /\n  sum(rate(kooper_controller_queued_events_total{job=\"${job}\",controller=\"${controller}\"}[$range]))\n  * 100\n  or vector(0)\n)",
          "format": "time_series",
          "intervalFactor": 1,
          "refId": "A"
        }
      ],
      "thresholds": "25, 50",
      "title": "",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#890f02"
      ],
      "datasource": "${DS_PROMETHEUS-DEVOPS}",
      "format": "s",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 12,
        "y": 3
      },
      "id": 6,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": " processing duration",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "80%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(0, 0, 0, 0.1)",
        "full": false,
        "lineColor": "rgba(0, 0, 0, 0.32)",
        "show": true
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "histogram_quantile(0.95,\n  sum(\n    rate(kooper_controller_processed_event_duration_seconds_bucket{job=\"${job}\",controller=\"${controller}\"}[${interval}]))\n  by (le))\n",
          "format": "time_series",
          "intervalFactor": 1,
          "refId": "A"
        }
      ],
      "thresholds": "3,5",
      "title": "",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#890f02"
      ],
      "datasource": "${DS_PROMETHEUS-DEVOPS}",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 3
      },
      "id": 5,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": " processing errors",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "80%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(0, 0, 0, 0.1)",
        "full": false,
        "lineColor": "rgba(0, 0, 0, 0.32)",
        "show": true
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "\nsum(rate(kooper_controller_processed_event_errors_total{job=\"${job}\",controller=\"${controller}\"}[$interval])) /\nsum(rate(kooper_controller_processed_events_total{job=\"${job}\",controller=\"${controller}\"}[$interval]))\n* 100\nor vector(0)\n",
          "format": "time_series",
          "intervalFactor": 1,
          "refId": "A"
        }
      ],
      "thresholds": "2,5",
      "title": "",
      "type": "singlestat",
      "valueFontSize": "100%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    }
  ],
  "refresh": "30s",
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "k8s",
    "controllers",
    "kooper"
  ],
  "templating": {
    "list": [
      {
        "auto": true,
        "auto_count": 50,
        "auto_min": "30s",
        "current": {
          "text": "auto",
          "value": "$__auto_interval_interval"
        },
        "hide": 2,
        "label": null,
        "name": "interval",
        "options": [
          {
            "selected": true,
            "text": "auto",
            "value": "$__auto_interval_interval"
          },
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "6h",
            "value": "6h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": false,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "14d",
            "value": "14d"
          },
          {
            "selected": false,
            "text": "30d",
            "value": "30d"
          }
        ],
        "query": "1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
        "refresh": 2,
        "type": "interval"
      },
      {
        "auto": true,
        "auto_count": 1,
        "auto_min": "10s",
        "current": {
          "text": "auto",
          "value": "$__auto_interval_range"
        },
        "hide": 2,
        "label": null,
        "name": "range",
        "options": [
          {
            "selected": true,
            "text": "auto",
            "value": "$__auto_interval_range"
          },
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "6h",
            "value": "6h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": false,
            "text": "2d",
            "value": "2d"
          },
          {
            "selected": false,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "14d",
            "value": "14d"
          },
          {
            "selected": false,
            "text": "30d",
            "value": "30d"
          }
        ],
        "query": "1m,10m,30m,1h,6h,12h,1d,2d,7d,14d,30d",
        "refresh": 2,
        "type": "interval"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS-DEVOPS}",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "job",
        "options": [],
        "query": "label_values(kooper_controller_processed_events_total, job)",
        "refresh": 2,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS-DEVOPS}",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "controller",
        "options": [],
        "query": "label_values(kooper_controller_processed_events_total{job=\"${job}\"}, controller)",
        "refresh": 2,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "Kooper controllers",
  "uid": "3ComM3Oik",
  "version": 3,
  "description": "A simple dashboard to check how Kubernetes controllers and operators are performing. This Is based on the metrics exposed by Kooper framework. Kooper is a framework to create Kubernetes operators and controllers."
}