Skip to main content

priv/templates/parapet.gen.grafana/main_dashboard.json.eex

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      },
      {
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "enable": true,
        "expr": "parapet_deploy_info",
        "hide": false,
        "iconColor": "rgb(255, 0, 0)",
        "name": "Deploys",
        "step": "1m",
        "tagKeys": "version",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "tags"
        },
        "titleFormat": "Deploy: {{version}}",
        "type": "dashboard"
      {
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRES}"
        },
        "enable": true,
        "hide": false,
        "iconColor": "rgb(255, 0, 255)",
        "name": "AI Config Changes",
        "rawQuery": "SELECT inserted_at AS \"time\", title AS \"text\", runbook_data->>'model' AS \"tags\" FROM parapet_incidents WHERE runbook_data->>'type' = 'config_change'",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "tags"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "panels": [],
      "title": "SLO Burn Rates",
      "type": "row"
    }
<%= for {slo, index} <- Enum.with_index(slos) do %>
    ,{
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "gridPos": {
        "h": 8,
        "w": 16,
        "x": 0,
        "y": <%= index * 8 + 1 %>
      },
      "id": <%= index * 2 + 10 %>,
      "title": "<%= slo.name %> 5m Error Ratio",
      "type": "timeseries",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "slo:error_ratio:rate5m{slo=\"<%= slo.name %>\"}",
          "legendFormat": "Error Ratio (5m)",
          "range": true,
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": <%= 1 - (slo.objective / 100) %>
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      }
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": <%= index * 8 + 1 %>
      },
      "id": <%= index * 2 + 11 %>,
      "title": "<%= slo.name %> 3d Error Budget Spent",
      "type": "gauge",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "slo:error_ratio:rate3d{slo=\"<%= slo.name %>\"} / <%= 1 - (slo.objective / 100) %> * 100",
          "legendFormat": "% Budget Spent (3d)",
          "range": true,
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 80
              },
              {
                "color": "red",
                "value": 100
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true,
        "text": {}
      }
    }
<% end %>
  ],
  "refresh": "1m",
  "schemaVersion": 38,
  "style": "dark",
  "tags": ["parapet", "slo"],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "DS_PROMETHEUS",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {
          "selected": false,
          "text": "PostgreSQL",
          "value": "PostgreSQL"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "DS_POSTGRES",
        "options": [],
        "query": "postgres",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-3h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "<%= Macro.camelize(to_string(app_name)) %> Executive Health & SLOs",
  "uid": "parapet_main",
  "version": 1
}