{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "title": "Goliash",
  "uid": "goliash",
  "description": "What runs where, on which version, drift, delivery speed, image hygiene and the health of Goliash itself. Data from Goliash /metrics.",
  "tags": [
    "goliash",
    "versions",
    "drift",
    "delivery"
  ],
  "timezone": "",
  "schemaVersion": 39,
  "version": 2,
  "editable": true,
  "time": {
    "from": "now-7d",
    "to": "now"
  },
  "refresh": "5m",
  "links": [
    {
      "title": "Goliash",
      "type": "link",
      "url": "https://goliash.dev/",
      "targetBlank": true,
      "icon": "doc"
    }
  ],
  "templating": {
    "list": [
      {
        "name": "datasource",
        "label": "Data source",
        "type": "datasource",
        "query": "prometheus",
        "current": {}
      },
      {
        "name": "environment",
        "label": "Environment",
        "type": "query",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "query": {
          "query": "label_values(goliash_deployed_version_info, environment)",
          "refId": "env"
        },
        "definition": "label_values(goliash_deployed_version_info, environment)",
        "includeAll": true,
        "multi": true,
        "allValue": ".*",
        "current": {
          "text": "All",
          "value": "$__all"
        },
        "refresh": 2,
        "sort": 1
      },
      {
        "name": "service",
        "label": "Service",
        "type": "query",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "query": {
          "query": "label_values(goliash_deployed_version_info{environment=~\"$environment\"}, service)",
          "refId": "svc"
        },
        "definition": "label_values(goliash_deployed_version_info{environment=~\"$environment\"}, service)",
        "includeAll": true,
        "multi": true,
        "allValue": ".*",
        "current": {
          "text": "All",
          "value": "$__all"
        },
        "refresh": 2,
        "sort": 1
      }
    ]
  },
  "panels": [
    {
      "id": 1,
      "type": "stat",
      "title": "Behind upstream",
      "description": "Service × environment pairs behind the newest release by at least the tracked jump.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 0
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "count(goliash_outdated{environment=~\"$environment\", service=~\"$service\"} == 1) or vector(0)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 2,
      "type": "stat",
      "title": "Open drifts",
      "description": "Environment, upstream and inconsistent drift.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 0
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "count(goliash_drift_days{environment=~\"$environment\", service=~\"$service\"}) or vector(0)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 3,
      "type": "stat",
      "title": "Oldest drift",
      "description": "Days the oldest open drift has lasted.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 0
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max(goliash_drift_days{environment=~\"$environment\", service=~\"$service\"}) or vector(0)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "d",
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 7
              },
              {
                "color": "red",
                "value": 30
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 4,
      "type": "stat",
      "title": "Running versions",
      "description": "Distinct service, environment and version combinations running.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 0
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "count(goliash_deployed_version_info{environment=~\"$environment\", service=~\"$service\"}) or vector(0)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 5,
      "type": "table",
      "title": "What runs where",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 12,
        "w": 12,
        "x": 0,
        "y": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_deployed_version_info{environment=~\"$environment\", service=~\"$service\"}",
          "refId": "A",
          "format": "table",
          "instant": true,
          "range": false
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "__name__": true,
              "instance": true,
              "job": true
            },
            "indexByName": {
              "service": 0,
              "environment": 1,
              "version": 2,
              "Value": 3
            },
            "renameByName": {
              "Value": "Replicas",
              "service": "Service",
              "environment": "Environment",
              "version": "Version"
            }
          }
        }
      ],
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "displayName": "Service",
            "desc": false
          }
        ],
        "cellHeight": "sm"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "minWidth": 60,
            "align": "auto"
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Replicas"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          }
        ]
      }
    },
    {
      "id": 6,
      "type": "table",
      "title": "Open drift",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 12,
        "w": 12,
        "x": 12,
        "y": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_drift_days{environment=~\"$environment\", service=~\"$service\"}",
          "refId": "A",
          "format": "table",
          "instant": true,
          "range": false
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "__name__": true,
              "instance": true,
              "job": true
            },
            "indexByName": {
              "service": 0,
              "environment": 1,
              "kind": 2,
              "Value": 3
            },
            "renameByName": {
              "Value": "Days open",
              "service": "Service",
              "environment": "Environment",
              "kind": "Kind"
            }
          }
        }
      ],
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "displayName": "Days open",
            "desc": true
          }
        ],
        "cellHeight": "sm"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "minWidth": 60,
            "align": "auto"
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Days open"
            },
            "properties": [
              {
                "id": "decimals",
                "value": 1
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "text",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 7
                    },
                    {
                      "color": "red",
                      "value": 30
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          }
        ]
      }
    },
    {
      "id": 7,
      "type": "timeseries",
      "title": "Behind upstream by environment",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 16
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (environment) (goliash_outdated{environment=~\"$environment\", service=~\"$service\"})",
          "refId": "A",
          "format": "time_series",
          "instant": false,
          "range": true,
          "legendFormat": "{{environment}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "decimals": 0,
          "min": 0,
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "smooth",
            "fillOpacity": 25,
            "lineWidth": 2,
            "showPoints": "never",
            "gradientMode": "opacity"
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      }
    },
    {
      "id": 8,
      "type": "timeseries",
      "title": "Versions in use per service",
      "description": "More than one line for a service means environments run different versions.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 16
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "count by (service) (count by (service, version) (goliash_deployed_version_info{environment=~\"$environment\", service=~\"$service\"}))",
          "refId": "A",
          "format": "time_series",
          "instant": false,
          "range": true,
          "legendFormat": "{{service}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "decimals": 0,
          "min": 0,
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "smooth",
            "lineWidth": 2,
            "showPoints": "never",
            "fillOpacity": 0,
            "gradientMode": "none"
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      }
    },
    {
      "id": 101,
      "type": "row",
      "title": "Delivery (last 30 days)",
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 24
      },
      "panels": []
    },
    {
      "id": 102,
      "type": "stat",
      "title": "Deploys",
      "description": "Versions that arrived in the selected environments in the last 30 days (sum of goliash_deploys).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 25
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(goliash_deploys{environment=~\"$environment\", service=~\"$service\"}) or vector(0)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 103,
      "type": "stat",
      "title": "Median lead time",
      "description": "Median of the services' median time from one environment to the next, last 30 days. Empty until versions move between two environments (e.g. staging → prod).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 25
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "quantile(0.5, goliash_lead_time_seconds{to=~\"$environment\", service=~\"$service\"})",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 104,
      "type": "stat",
      "title": "Slowest promotion",
      "description": "The longest median lead time of any service and environment pair. Empty until versions move between two environments (e.g. staging → prod).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 25
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max(goliash_lead_time_seconds{to=~\"$environment\", service=~\"$service\"})",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 604800
              },
              {
                "color": "red",
                "value": 1209600
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 105,
      "type": "stat",
      "title": "Services deployed",
      "description": "Services with at least one deploy in the last 30 days.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 25
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "count(sum by (service) (goliash_deploys{environment=~\"$environment\", service=~\"$service\"}) > 0) or vector(0)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 106,
      "type": "barchart",
      "title": "Deploys per service",
      "description": "Versions that arrived in the last 30 days, per service and environment.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 29
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sort_desc(sum by (service) (goliash_deploys{environment=~\"$environment\", service=~\"$service\"}) > 0)",
          "refId": "A",
          "format": "table",
          "instant": true,
          "range": false
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "renameByName": {
              "Value": "Deploys",
              "service": "Service"
            }
          }
        }
      ],
      "options": {
        "orientation": "horizontal",
        "xField": "Service",
        "showValue": "auto",
        "legend": {
          "showLegend": false
        },
        "barWidth": 0.7
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "blue"
          },
          "decimals": 0
        },
        "overrides": []
      }
    },
    {
      "id": 107,
      "type": "table",
      "title": "Lead time",
      "description": "Median time a version took from one environment to the next, last 30 days. Empty until versions move between two environments (e.g. staging → prod).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 29
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_lead_time_seconds{to=~\"$environment\", service=~\"$service\"}",
          "refId": "A",
          "format": "table",
          "instant": true,
          "range": false
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "__name__": true,
              "instance": true,
              "job": true
            },
            "indexByName": {
              "service": 0,
              "from": 1,
              "to": 2,
              "Value": 3
            },
            "renameByName": {
              "Value": "Median",
              "service": "Service",
              "from": "From",
              "to": "To"
            }
          }
        }
      ],
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "displayName": "Median",
            "desc": true
          }
        ],
        "cellHeight": "sm"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto"
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "From"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "To"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Median"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 110
              },
              {
                "id": "unit",
                "value": "s"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 604800
                    },
                    {
                      "color": "red",
                      "value": 1209600
                    }
                  ]
                }
              }
            ]
          }
        ]
      }
    },
    {
      "id": 108,
      "type": "row",
      "title": "Image hygiene",
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 38
      },
      "panels": []
    },
    {
      "id": 109,
      "type": "bargauge",
      "title": "Image hygiene findings",
      "description": "Images with a moving tag (latest, stable…), a tag pushed again with other content, an untrusted registry, or no digest.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 6,
        "w": 12,
        "x": 0,
        "y": 39
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (kind) (goliash_image_hygiene_findings)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false,
          "legendFormat": "{{kind}}"
        }
      ],
      "options": {
        "orientation": "horizontal",
        "displayMode": "gradient",
        "showUnfilled": true,
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        }
      },
      "fieldConfig": {
        "defaults": {
          "decimals": 0,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 110,
      "type": "timeseries",
      "title": "Hygiene findings over time",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 6,
        "w": 12,
        "x": 12,
        "y": 39
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (kind) (goliash_image_hygiene_findings)",
          "refId": "A",
          "format": "time_series",
          "instant": false,
          "range": true,
          "legendFormat": "{{kind}}"
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "fieldConfig": {
        "defaults": {
          "decimals": 0,
          "min": 0,
          "custom": {
            "drawStyle": "line",
            "lineWidth": 2,
            "fillOpacity": 25,
            "stacking": {
              "mode": "normal"
            },
            "lineInterpolation": "smooth",
            "showPoints": "never",
            "gradientMode": "opacity"
          }
        },
        "overrides": []
      }
    },
    {
      "id": 111,
      "type": "row",
      "title": "Goliash itself",
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 45
      },
      "panels": []
    },
    {
      "id": 112,
      "type": "stat",
      "title": "Agents online",
      "description": "Agents that reported in time.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 46
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_agents{status=\"online\"}",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 113,
      "type": "stat",
      "title": "Agents stale",
      "description": "Agents that stopped reporting. Their targets keep their last state.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 46
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_agents{status=\"stale\"}",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 114,
      "type": "stat",
      "title": "Snapshots pending",
      "description": "Snapshots received and not processed yet; a growing number means the server falls behind.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 46
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_snapshots_pending",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 20
              },
              {
                "color": "red",
                "value": 100
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 115,
      "type": "stat",
      "title": "Failing notifications",
      "description": "Notifications not sent that failed at least once. The Notifications page shows the channel's answer.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 46
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_notifications_failing",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 116,
      "type": "stat",
      "title": "Background workers",
      "description": "Must be exactly 1 across all servers sharing a database.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 46
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(goliash_leader)",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              },
              {
                "color": "red",
                "value": 2
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 117,
      "type": "stat",
      "title": "Version",
      "description": "The running Goliash server.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 46
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "goliash_build_info",
          "refId": "A",
          "format": "time_series",
          "instant": true,
          "range": false,
          "legendFormat": "{{version}}"
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "name"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "none",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      },
      {
        "name": "Deploys",
        "enable": true,
        "iconColor": "#5794F2",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "expr": "count by (service, environment, version) (goliash_deployed_version_info{environment=~\"$environment\", service=~\"$service\"} unless goliash_deployed_version_info offset 10m)",
        "step": "5m",
        "titleFormat": "{{service}} {{version}}",
        "textFormat": "deployed to {{environment}}",
        "tagKeys": "environment,service",
        "useValueForTime": false
      },
      {
        "name": "Goliash events (Grafana channel)",
        "enable": false,
        "iconColor": "#FF9830",
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "target": {
          "type": "tags",
          "tags": [
            "goliash"
          ],
          "matchAny": false,
          "limit": 200
        }
      }
    ]
  }
}
