apiVersion: v1
kind: ConfigMap
metadata:
  name: pipeline-health
  labels:
    grafana_dashboard: "true"
data:
  pipeline-health.json: |-
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "limit": 100,
            "name": "Annotations & Alerts",
            "showIn": 0,
            "type": "dashboard"
          },
          {
            "datasource": "Prometheus",
            "enable": true,
            "expr": "ALERTS{alertname=\"MessageThroughput\"}",
            "hide": false,
            "iconColor": "rgba(255, 96, 96, 1)",
            "limit": 100,
            "name": "Prometheus Alerts",
            "showIn": 0,
            "step": "5m",
            "tags": [],
            "textFormat": "{{topic}}",
            "titleFormat": "{{alertname}}",
            "type": "tags"
          }
        ]
      },
      "editable": true,
      "gnetId": null,
      "graphTooltip": 0,
      "iteration": 1611260467014,
      "links": [],
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "description": "Rate of data written to Kafka topics by topic name (including dataset id). Data is presented in a log scale to show low volume datasets.",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 8,
            "w": 12,
            "x": 0,
            "y": 0
          },
          "hiddenSeries": false,
          "id": 2,
          "interval": "",
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
              "$$hashKey": "object:673",
              "alias": "streaming-dead-letters",
              "color": "#F2495C"
            },
            {
              "$$hashKey": "object:674",
              "alias": "/(raw|reaper).*/",
              "color": "#73BF69"
            },
            {
              "$$hashKey": "object:675",
              "alias": "/validated.*/",
              "color": "#FADE2A"
            },
            {
              "$$hashKey": "object:676",
              "alias": "/(transformed|valkyrie).*/",
              "color": "#5794F2"
            },
            {
              "$$hashKey": "object:677",
              "alias": "/(streaming-persisted|forklift)/",
              "color": "#FFA6B0"
            }
          ],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "pipeline:topic:throughput{dataset_id=~\".*([[dataset_id]]).*\"}",
              "format": "time_series",
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "{{dataset_title}} - {{stage}}",
              "refId": "A"
            },
            {
              "expr": "sum(rate(kafka_topic_partition_current_offset{kubernetes_namespace=\"streaming-prime\", topic=~\"(streaming-persisted|streaming-dead-letters)\"}[2m]) > 0) by (topic)",
              "interval": "",
              "legendFormat": "{{topic}}",
              "refId": "B"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Pipeline Topics Input",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:466",
              "format": "short",
              "label": null,
              "logBase": 2,
              "max": null,
              "min": "0",
              "show": true
            },
            {
              "$$hashKey": "object:467",
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "description": "Rate of events handled by App and Dataset. Data is presented in a Log scale to show lower frequency events.",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 8,
            "w": 12,
            "x": 12,
            "y": 0
          },
          "hiddenSeries": false,
          "id": 15,
          "legend": {
            "alignAsTable": false,
            "avg": false,
            "current": false,
            "hideZero": false,
            "max": false,
            "min": false,
            "rightSide": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null as zero",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "pipeline:event_stream:events_handled{dataset_id=~\".*[[dataset_id]].*\"}",
              "interval": "",
              "legendFormat": "{{dataset_title}} | {{app}} | {{event_type}}",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Rate of Events Handled",
          "tooltip": {
            "shared": true,
            "sort": 2,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:142",
              "format": "short",
              "label": "",
              "logBase": 10,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "$$hashKey": "object:143",
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 8,
            "w": 12,
            "x": 0,
            "y": 8
          },
          "hiddenSeries": false,
          "id": 9,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
              "alias": "/valkyrie.*/",
              "color": "#73BF69"
            },
            {
              "alias": "/voltron.*/",
              "color": "#FADE2A"
            },
            {
              "alias": "/forklift.*/",
              "color": "#5794F2"
            },
            {
              "alias": "/flair.*/",
              "color": "#FF9830"
            },
            {
              "alias": "/streisand.*/",
              "color": "#C0D8FF"
            }
          ],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "pipeline:topic:lag{dataset_id=~\".*([[dataset_id]]).*\"}",
              "interval": "",
              "legendFormat": "{{dataset_title}} | {{app}} | {{stage}}",
              "refId": "B"
            },
            {
              "expr": "pipeline:event_stream:lag",
              "interval": "",
              "legendFormat": "{{app}} - event stream",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Current Lag (By Consumer Group)",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:191",
              "format": "short",
              "label": "",
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
              "$$hashKey": "object:192",
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 8,
            "w": 12,
            "x": 12,
            "y": 8
          },
          "hiddenSeries": false,
          "id": 8,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null as zero",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
              "alias": "forklift",
              "color": "#5794F2"
            },
            {
              "alias": "valkyrie",
              "color": "#73BF69"
            },
            {
              "alias": "voltron",
              "color": "#FADE2A"
            },
            {
              "alias": "reaper",
              "color": "#B877D9"
            }
          ],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "pipeline:log_message_rate",
              "format": "time_series",
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "{{name}}",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Log Messages per Second per App",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:166",
              "format": "short",
              "label": "Log Messages per Sec.",
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
              "$$hashKey": "object:167",
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "Prometheus",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 10,
          "fillGradient": 0,
          "gridPos": {
            "h": 9,
            "w": 12,
            "x": 0,
            "y": 16
          },
          "hiddenSeries": false,
          "id": 13,
          "legend": {
            "avg": false,
            "current": false,
            "hideEmpty": false,
            "hideZero": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 0,
          "links": [],
          "nullPointMode": "null",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": true,
          "targets": [
            {
              "expr": "sum(increase(kube_pod_container_status_restarts_total[5m]) > 0) by (container)",
              "format": "time_series",
              "intervalFactor": 1,
              "legendFormat": "{{container}}",
              "refId": "C"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Apps in Crash Loops",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "datasource": null,
          "fieldConfig": {
            "defaults": {
              "custom": {
                "align": null
              },
              "mappings": [
                {
                  "from": "",
                  "id": 0,
                  "operator": "",
                  "text": "",
                  "to": "",
                  "type": 1
                }
              ],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": []
          },
          "gridPos": {
            "h": 9,
            "w": 12,
            "x": 12,
            "y": 16
          },
          "id": 17,
          "options": {
            "showHeader": true,
            "sortBy": [
              {
                "desc": false,
                "displayName": "dataset_id"
              }
            ]
          },
          "pluginVersion": "7.0.1",
          "targets": [
            {
              "expr": "dataset_info_gauge{dataset_id=~\".*([[dataset_id]]).*\"}",
              "format": "table",
              "instant": true,
              "interval": "",
              "legendFormat": "",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Dataset Info",
          "transformations": [
            {
              "id": "filterFieldsByName",
              "options": {}
            }
          ],
          "type": "table"
        }
      ],
      "refresh": "5m",
      "schemaVersion": 25,
      "style": "dark",
      "tags": [],
      "templating": {
        "list": [
          {
            "allValue": "-",
            "current": {
              "selected": true,
              "text": "All",
              "value": [
                "$__all"
              ]
            },
            "datasource": "Prometheus",
            "definition": "label_values(kafka_topic_partition_current_offset, topic)",
            "hide": 0,
            "includeAll": true,
            "label": null,
            "multi": true,
            "name": "dataset_id",
            "options": [],
            "query": "label_values(kafka_topic_partition_current_offset, topic)",
            "refresh": 1,
            "regex": "/raw-(.*)/",
            "skipUrlSync": false,
            "sort": 0,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
          },
          {
            "datasource": null,
            "filters": [],
            "hide": 0,
            "label": "",
            "name": "Filters",
            "skipUrlSync": false,
            "type": "adhoc"
          }
        ]
      },
      "time": {
        "from": "now-30m-30s",
        "to": "now"
      },
      "timepicker": {
        "nowDelay": "1m",
        "refresh_intervals": [
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ],
        "time_options": [
          "5m",
          "15m",
          "1h",
          "6h",
          "12h",
          "24h",
          "2d",
          "7d",
          "30d"
        ]
      },
      "timezone": "",
      "title": "Pipeline Health",
      "uid": "dvLZAOzZk",
      "version": 1
    }