Grafana dashboard: Kubewebhook admission webhooks
Description: A simple dashboard to check how Kubernetes admission webhooks are performing. This Is based on the metrics exposed by Kubewebhook framework. Kubewebhook is a framework to create Kubernetes validating and mutating admission webhooks.

## Description
A simple dashboard to check how Kubernetes admission webhooks are performing. This Is based on the metrics exposed by [Kubewebhook][kubewebhook-repo] framework. Kubewebhook is a framework to create Kubernetes validating and mutating admission webhooks.

## Features
The dashboard has various single stats:
- The total number of admission reviews handled in the time range selected.
- The admission reviews per second
- The duration of the admission reviews.
- The rate of errors of admission reviews.

[kubewebhook-repo]: https://github.com/slok/kubewebhook

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS-DEVOPS",
      "label": "prometheus",
      "description": "The prometheus data source where the Kubewebhook 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": 7088,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1532622522104,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "panels": [],
      "repeat": "webhook",
      "title": "",
      "type": "row"
    },
    {
      "content": "# $webhook webhook",
      "gridPos": {
        "h": 2,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 9,
      "links": [],
      "mode": "markdown",
      "title": "",
      "transparent": true,
      "type": "text"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#6d1f62"
      ],
      "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": 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": " review in ${range}",
      "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": false
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "sum(increase(kubewebhook_admission_webhook_admission_reviews_total{job=\"${job}\",webhook=\"${webhook}\"}[$range]))",
          "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)",
        "#0a50a1"
      ],
      "datasource": "${DS_PROMETHEUS-DEVOPS}",
      "format": "short",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 6,
        "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": " review/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(kubewebhook_admission_webhook_admission_reviews_total{job=\"${job}\",webhook=\"${webhook}\"}[$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": "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": " review 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(kubewebhook_admission_webhook_admission_review_duration_seconds_bucket{job=\"${job}\",webhook=\"${webhook}\"}[${interval}]))\n  by (le))\n",
          "format": "time_series",
          "intervalFactor": 1,
          "refId": "A"
        }
      ],
      "thresholds": "0.15,0.25",
      "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": " review 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": "sum(rate(kubewebhook_admission_webhook_admission_review_errors_total{job=\"${job}\",webhook=\"${webhook}\"}[$interval])) /\nsum(rate(kubewebhook_admission_webhook_admission_reviews_total{job=\"${job}\",webhook=\"${webhook}\"}[$interval]))\n* 100\nor vector(0)",
          "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",
    "webhooks"
  ],
  "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(kubewebhook_admission_webhook_admission_reviews_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": "webhook",
        "options": [],
        "query": "label_values(kubewebhook_admission_webhook_admission_reviews_total{job=\"${job}\"}, webhook)",
        "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": "Kubewebhook admission webhooks",
  "uid": "Ers73uOik",
  "version": 4,
  "description": "A simple dashboard to check how Kubernetes admission webhooks are performing. This Is based on the metrics exposed by Kubewebhook framework. Kubewebhook is a framework to create Kubernetes validating and mutating admission webhooks."
}