{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Continuwuity homeserver metrics, scraped from /_continuwuity/metrics or pushed over OTLP",
  "editable": true,
  "graphTooltip": 1,
  "links": [],
  "panels": [
    {
      "type": "row",
      "title": "Overview",
      "id": 1,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "panels": []
    },
    {
      "type": "stat",
      "title": "Version",
      "description": "",
      "id": 2,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 1
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "count by (service_version) (target_info{instance=~\"$instance\"})",
          "legendFormat": "{{service_version}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "name",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "type": "stat",
      "title": "Uptime",
      "description": "",
      "id": 3,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 1
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max(process_uptime_seconds{instance=~\"$instance\"})",
          "legendFormat": "",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "type": "stat",
      "title": "Requests",
      "description": "",
      "id": 4,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 1
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(http_server_request_duration_seconds_count{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "type": "stat",
      "title": "Server errors",
      "description": "Share of requests answered with a 5xx status",
      "id": 5,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 1
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum(rate(http_server_request_duration_seconds_count{instance=~\"$instance\",http_response_status_code=~\"5..\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 0.01
              },
              {
                "color": "red",
                "value": 0.05
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "type": "stat",
      "title": "p95 latency",
      "description": "Includes long-polling /sync requests",
      "id": 6,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 1
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "type": "stat",
      "title": "Resident memory",
      "description": "",
      "id": 7,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 1
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(process_memory_usage_bytes{instance=~\"$instance\"})",
          "legendFormat": "",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "area",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "type": "row",
      "title": "HTTP",
      "id": 8,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Requests by status class",
      "description": "",
      "id": 9,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 6
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (class) (label_replace(rate(http_server_request_duration_seconds_count{instance=~\"$instance\"}[$__rate_interval]), \"class\", \"${1}xx\", \"http_response_status_code\", \"([0-9])..\"))",
          "legendFormat": "{{class}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 25,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Latency",
      "description": "Includes long-polling /sync requests",
      "id": 10,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 6
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Top routes by request rate",
      "description": "",
      "id": 11,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 14
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "topk(10, sum by (http_request_method, http_route) (rate(http_server_request_duration_seconds_count{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "{{http_request_method}} {{http_route}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true,
          "calcs": [
            "mean",
            "max"
          ]
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Top routes by p95 latency",
      "description": "",
      "id": 12,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 14
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "topk(10, histogram_quantile(0.95, sum by (le, http_request_method, http_route) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval]))))",
          "legendFormat": "{{http_request_method}} {{http_route}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true,
          "calcs": [
            "mean",
            "max"
          ]
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Server errors by route",
      "description": "",
      "id": 13,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 24
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "topk(10, sum by (http_request_method, http_route, http_response_status_code) (rate(http_server_request_duration_seconds_count{instance=~\"$instance\",http_response_status_code=~\"5..\"}[$__rate_interval])))",
          "legendFormat": "{{http_response_status_code}} {{http_request_method}} {{http_route}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Requests in flight",
      "description": "",
      "id": 14,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 12,
        "y": 24
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(http_server_active_requests{instance=~\"$instance\"})",
          "legendFormat": "in flight",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Request body traffic",
      "description": "Request bodies with a Content-Length",
      "id": 54,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 18,
        "y": 24
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(http_server_request_body_size_bytes_sum{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "request",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "Bps",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "row",
      "title": "Incoming federation",
      "id": 15,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 32
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Transactions by outcome",
      "description": "",
      "id": 16,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 33
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (outcome) (rate(continuwuity_federation_incoming_transaction_duration_seconds_count{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{outcome}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 25,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Transaction processing time",
      "description": "",
      "id": 17,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 33
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.5, sum by (le) (rate(continuwuity_federation_incoming_transaction_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(continuwuity_federation_incoming_transaction_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(continuwuity_federation_incoming_transaction_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Transactions in progress",
      "description": "",
      "id": 18,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 33
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(continuwuity_federation_incoming_transactions_active{instance=~\"$instance\"})",
          "legendFormat": "active",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "PDUs by outcome",
      "description": "",
      "id": 19,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 41
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (outcome) (rate(continuwuity_federation_incoming_pdus_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{outcome}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 25,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "PDU handling time",
      "description": "",
      "id": 20,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 41
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.5, sum by (le) (rate(continuwuity_federation_incoming_pdu_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(continuwuity_federation_incoming_pdu_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(continuwuity_federation_incoming_pdu_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "PDU lag",
      "description": "Time between an accepted PDU's origin_server_ts and its arrival; affected by clock skew",
      "id": 21,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 41
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.5, sum by (le) (rate(continuwuity_federation_incoming_pdu_lag_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(continuwuity_federation_incoming_pdu_lag_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(continuwuity_federation_incoming_pdu_lag_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Top PDU types",
      "description": "",
      "id": 22,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 49
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "topk(10, sum by (type) (rate(continuwuity_federation_incoming_pdus_total{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "{{type}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true,
          "calcs": [
            "mean"
          ]
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "EDUs by type",
      "description": "",
      "id": 23,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 49
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (type) (rate(continuwuity_federation_incoming_edus_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{type}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 25,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "EDU handling time by type",
      "description": "",
      "id": 24,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 49
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le, type) (rate(continuwuity_federation_incoming_edu_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
          "legendFormat": "p95 {{type}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "row",
      "title": "Outgoing federation",
      "id": 25,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 57
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Transactions by destination and outcome",
      "description": "",
      "id": 26,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 58
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (destination, outcome) (rate(continuwuity_sender_transaction_duration_seconds_count{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{destination}} {{outcome}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Transaction time",
      "description": "Successful transactions only",
      "id": 27,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 58
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.5, sum by (le) (rate(continuwuity_sender_transaction_duration_seconds_bucket{instance=~\"$instance\",outcome=\"success\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(continuwuity_sender_transaction_duration_seconds_bucket{instance=~\"$instance\",outcome=\"success\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(continuwuity_sender_transaction_duration_seconds_bucket{instance=~\"$instance\",outcome=\"success\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Events sent",
      "description": "",
      "id": 28,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 66
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (destination, kind, outcome) (rate(continuwuity_sender_events_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{destination}} {{kind}} {{outcome}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Events queued",
      "description": "",
      "id": 29,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 66
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (destination, kind) (rate(continuwuity_sender_events_queued_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{destination}} {{kind}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Sender queue depth",
      "description": "",
      "id": 30,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 66
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(continuwuity_sender_queue_depth{instance=~\"$instance\"})",
          "legendFormat": "queued",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Requests by outcome",
      "description": "",
      "id": 31,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 74
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (outcome) (rate(continuwuity_federation_outgoing_request_duration_seconds_count{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{outcome}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 25,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Request latency",
      "description": "Successful requests only",
      "id": 32,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 74
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.5, sum by (le) (rate(continuwuity_federation_outgoing_request_duration_seconds_bucket{instance=~\"$instance\",outcome=\"success\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(continuwuity_federation_outgoing_request_duration_seconds_bucket{instance=~\"$instance\",outcome=\"success\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(continuwuity_federation_outgoing_request_duration_seconds_bucket{instance=~\"$instance\",outcome=\"success\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Remote servers",
      "description": "",
      "id": 33,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 74
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (state) (continuwuity_federation_destinations{instance=~\"$instance\"})",
          "legendFormat": "{{state}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "row",
      "title": "Users & media",
      "id": 34,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 82
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Users",
      "description": "Local users include deactivated accounts",
      "id": 35,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 0,
        "y": 83
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (origin) (continuwuity_users{instance=~\"$instance\"})",
          "legendFormat": "{{origin}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Invites",
      "description": "",
      "id": 36,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 6,
        "y": 83
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (direction, destination, outcome) (rate(continuwuity_invites_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{direction}} {{destination}} {{outcome}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Media traffic",
      "description": "Remote writes are remote media cached locally",
      "id": 37,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 12,
        "y": 83
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (origin) (rate(continuwuity_media_write_size_bytes_sum{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "written {{origin}}",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (origin) (rate(continuwuity_media_read_size_bytes_sum{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "served {{origin}}",
          "refId": "B",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "Bps",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Stored media files",
      "description": "Includes thumbnails",
      "id": 38,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 18,
        "y": 83
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(continuwuity_media_files{instance=~\"$instance\"})",
          "legendFormat": "files",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Antispam checks",
      "description": "Denials include the antispam service being unreachable",
      "id": 39,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 91
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (check, outcome) (rate(continuwuity_antispam_checks_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{check}} {{outcome}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "row",
      "title": "Database & caches",
      "id": 40,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 97
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "RocksDB memory",
      "description": "Unflushed memtables are included in mem_tables",
      "id": 41,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 0,
        "y": 98
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (name) (continuwuity_database_memory_bytes{instance=~\"$instance\"})",
          "legendFormat": "{{name}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "RocksDB block cache",
      "description": "",
      "id": 42,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 6,
        "y": 98
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "topk(10, sum by (column) (continuwuity_database_block_cache_bytes{instance=~\"$instance\"}))",
          "legendFormat": "{{column}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 25,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true,
          "calcs": [
            "lastNotNull"
          ]
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Database size",
      "description": "",
      "id": 43,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 12,
        "y": 98
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(continuwuity_database_size_bytes{instance=~\"$instance\"})",
          "legendFormat": "SST files",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Cache entries",
      "description": "",
      "id": 44,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 18,
        "y": 98
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (name) (continuwuity_cache_entries{instance=~\"$instance\"})",
          "legendFormat": "{{name}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "row",
      "title": "Process",
      "id": 45,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 106
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "CPU",
      "description": "CPU cores in use",
      "id": 46,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 0,
        "y": 107
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (cpu_mode) (rate(process_cpu_time_seconds_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "{{cpu_mode}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 25,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Memory",
      "description": "",
      "id": 47,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 6,
        "y": 107
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(process_memory_usage_bytes{instance=~\"$instance\"})",
          "legendFormat": "resident",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(process_memory_virtual_bytes{instance=~\"$instance\"})",
          "legendFormat": "virtual",
          "refId": "B",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "jemalloc",
      "description": "Only reported when built with the jemalloc_stats feature",
      "id": 48,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 12,
        "y": 107
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (kind) (continuwuity_jemalloc_memory_bytes{instance=~\"$instance\"})",
          "legendFormat": "{{kind}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "File descriptors",
      "description": "",
      "id": 49,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 18,
        "y": 107
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(process_unix_file_descriptor_count{instance=~\"$instance\"})",
          "legendFormat": "fds",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "row",
      "title": "Tokio runtime",
      "id": 50,
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 115
      },
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "Worker utilisation",
      "description": "Average share of time worker threads spend busy",
      "id": 51,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 116
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(continuwuity_tokio_worker_busy_time_seconds_total{instance=~\"$instance\"}[$__rate_interval])) / sum(continuwuity_tokio_workers{instance=~\"$instance\"})",
          "legendFormat": "busy",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Tasks",
      "description": "",
      "id": 52,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 116
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(continuwuity_tokio_alive_tasks{instance=~\"$instance\"})",
          "legendFormat": "alive",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(continuwuity_tokio_global_queue_depth{instance=~\"$instance\"})",
          "legendFormat": "global queue",
          "refId": "B",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "type": "timeseries",
      "title": "Worker parks",
      "description": "",
      "id": 53,
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 116
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(continuwuity_tokio_worker_parks_total{instance=~\"$instance\"}[$__rate_interval]))",
          "legendFormat": "parks",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "ops",
          "min": 0,
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            }
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    }
  ],
  "refresh": "30s",
  "schemaVersion": 41,
  "tags": [
    "continuwuity",
    "matrix"
  ],
  "templating": {
    "list": [
      {
        "name": "datasource",
        "label": "Data source",
        "type": "datasource",
        "query": "prometheus",
        "current": {},
        "hide": 0,
        "refresh": 1,
        "regex": "",
        "options": []
      },
      {
        "name": "instance",
        "label": "Instance",
        "type": "query",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "definition": "label_values(target_info, instance)",
        "query": {
          "query": "label_values(target_info, instance)",
          "refId": "instance"
        },
        "includeAll": true,
        "multi": true,
        "allValue": ".*",
        "current": {},
        "hide": 0,
        "refresh": 2,
        "regex": "",
        "sort": 1,
        "options": []
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "Continuwuity",
  "uid": "continuwuity",
  "version": 1
}
