{
  "title": "Litebackup",
  "uid": "litebackup",
  "tags": [
    "litebackup",
    "sqlite"
  ],
  "timezone": "utc",
  "schemaVersion": 39,
  "version": 1,
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "refresh": "1m",
  "graphTooltip": 1,
  "templating": {
    "list": [
      {
        "name": "datasource",
        "label": "Data source",
        "type": "datasource",
        "query": "prometheus",
        "current": {},
        "hide": 0
      },
      {
        "name": "instance",
        "label": "Server",
        "type": "query",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "query": {
          "query": "label_values(litebackup_databases, instance)",
          "refId": "instance"
        },
        "definition": "label_values(litebackup_databases, instance)",
        "includeAll": true,
        "multi": true,
        "allValue": ".*",
        "current": {
          "text": "All",
          "value": "$__all"
        },
        "refresh": 2,
        "hide": 0
      }
    ]
  },
  "annotations": {
    "list": []
  },
  "panels": [
    {
      "id": 1,
      "type": "stat",
      "title": "Databases",
      "description": "Databases on the server that are not deleted.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum(litebackup_databases{instance=~\"$instance\"})",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 2,
      "type": "stat",
      "title": "Syncs per minute",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 0
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum(rate(litebackup_syncs_total{instance=~\"$instance\"}[5m])) * 60",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "decimals": 0
        },
        "overrides": []
      }
    },
    {
      "id": 3,
      "type": "stat",
      "title": "Uploads per minute",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 0
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum(rate(litebackup_upload_bytes_total{instance=~\"$instance\"}[5m])) * 60",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 4,
      "type": "stat",
      "title": "Waiting for the bucket",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 0
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum(litebackup_unarchived_versions{instance=~\"$instance\"})",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "decimals": 0
        },
        "overrides": []
      }
    },
    {
      "id": 5,
      "type": "stat",
      "title": "Oldest unarchived",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 0
      },
      "targets": [
        {
          "refId": "A",
          "expr": "max(litebackup_archive_oldest_unarchived_seconds{instance=~\"$instance\"})",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 900
              },
              {
                "color": "red",
                "value": 3600
              }
            ]
          }
        },
        "overrides": []
      }
    },
    {
      "id": 6,
      "type": "stat",
      "title": "License",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "targets": [
        {
          "refId": "A",
          "expr": "max(litebackup_license_state{instance=~\"$instance\"})",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ]
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "value"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 1
              },
              {
                "color": "red",
                "value": 3
              }
            ]
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "Active",
                  "color": "green"
                },
                "1": {
                  "text": "Ending",
                  "color": "orange"
                },
                "2": {
                  "text": "Grace",
                  "color": "orange"
                },
                "3": {
                  "text": "Lapsed",
                  "color": "red"
                },
                "-1": {
                  "text": "None",
                  "color": "text"
                }
              }
            }
          ]
        },
        "overrides": []
      }
    },
    {
      "id": 7,
      "type": "timeseries",
      "title": "Sync rate",
      "description": "Versions committed by sync requests.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 4
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum(rate(litebackup_syncs_total{instance=~\"$instance\"}[5m])) * 60",
          "legendFormat": "Syncs per minute",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 18,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 8,
      "type": "timeseries",
      "title": "Throughput",
      "description": "Bytes per minute.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 4
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum(rate(litebackup_upload_bytes_total{instance=~\"$instance\"}[5m])) * 60",
          "legendFormat": "Received from machines",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "B",
          "expr": "sum(rate(litebackup_archive_bytes_total{instance=~\"$instance\"}[5m])) * 60",
          "legendFormat": "Written to buckets",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 18,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 9,
      "type": "timeseries",
      "title": "Requests by route",
      "description": "Requests per minute.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 12
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum by (route) (rate(litebackup_requests_total{instance=~\"$instance\"}[5m])) * 60",
          "legendFormat": "{{route}}",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 18,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 10,
      "type": "timeseries",
      "title": "Request latency",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 12
      },
      "targets": [
        {
          "refId": "A",
          "expr": "histogram_quantile(0.5, sum by (le) (rate(litebackup_request_seconds_bucket{instance=~\"$instance\"}[5m])))",
          "legendFormat": "p50",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "B",
          "expr": "histogram_quantile(0.95, sum by (le) (rate(litebackup_request_seconds_bucket{instance=~\"$instance\"}[5m])))",
          "legendFormat": "p95",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "C",
          "expr": "histogram_quantile(0.99, sum by (le) (rate(litebackup_request_seconds_bucket{instance=~\"$instance\"}[5m])))",
          "legendFormat": "p99",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 6,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 11,
      "type": "timeseries",
      "title": "Rate-limited requests",
      "description": "HTTP 429 responses with the rate_limited error code per minute, grouped by reason.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 20
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum by (reason) (rate(litebackup_rate_limited_requests_total{instance=~\"$instance\"}[5m])) * 60",
          "legendFormat": "{{reason}}",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 18,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 12,
      "type": "timeseries",
      "title": "Bucket backlog",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 20
      },
      "targets": [
        {
          "refId": "A",
          "expr": "sum(litebackup_unarchived_versions{instance=~\"$instance\"})",
          "legendFormat": "Versions waiting",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "B",
          "expr": "sum(litebackup_late_archive_databases{instance=~\"$instance\"})",
          "legendFormat": "Late uploads (databases)",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 18,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 13,
      "type": "timeseries",
      "title": "Lag",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 28
      },
      "targets": [
        {
          "refId": "A",
          "expr": "max(litebackup_archive_oldest_unarchived_seconds{instance=~\"$instance\"})",
          "legendFormat": "Oldest version not in a bucket",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "B",
          "expr": "max(litebackup_replica_lag_seconds{instance=~\"$instance\"})",
          "legendFormat": "Replica lag",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 6,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 14,
      "type": "timeseries",
      "title": "Host load",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 28
      },
      "targets": [
        {
          "refId": "A",
          "expr": "max(litebackup_cpu_usage_ratio{instance=~\"$instance\"})",
          "legendFormat": "CPU utilization",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "B",
          "expr": "max(litebackup_memory_usage_ratio{instance=~\"$instance\"})",
          "legendFormat": "Memory utilization",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "C",
          "expr": "max by (resource) (litebackup_pressure_some_ratio{instance=~\"$instance\"})",
          "legendFormat": "{{resource}} stall time",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 6,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    },
    {
      "id": 15,
      "type": "timeseries",
      "title": "Disk",
      "description": "",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 36
      },
      "targets": [
        {
          "refId": "A",
          "expr": "min(litebackup_disk_free_bytes{instance=~\"$instance\"})",
          "legendFormat": "Free",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        },
        {
          "refId": "B",
          "expr": "max(litebackup_disk_reserve_bytes{instance=~\"$instance\"})",
          "legendFormat": "Reserve",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          }
        }
      ],
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "custom": {
            "lineWidth": 1,
            "fillOpacity": 10,
            "gradientMode": "opacity",
            "showPoints": "never",
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      }
    }
  ]
}
