{
  "uid": "uptime-sentinel",
  "title": "Uptime Sentinel — Operations",
  "tags": ["uptime-sentinel", "monitoring", "phase-3"],
  "timezone": "browser",
  "schemaVersion": 38,
  "version": 1,
  "refresh": "30s",
  "time": { "from": "now-6h", "to": "now" },
  "panels": [
    {
      "id": 1,
      "type": "stat",
      "title": "Monitors by current status",
      "gridPos": { "x": 0, "y": 0, "w": 12, "h": 5 },
      "targets": [
        { "expr": "uptime_sentinel_monitors_total", "legendFormat": "{{status}}" }
      ],
      "options": {
        "reduceOptions": { "calcs": ["last"] },
        "colorMode": "value",
        "textMode": "value_and_name"
      },
      "fieldConfig": {
        "defaults": {
          "mappings": [
            { "type": "value", "options": { "up": { "color": "green" }, "down": { "color": "red" }, "maintenance": { "color": "blue" } } }
          ]
        }
      }
    },
    {
      "id": 2,
      "type": "stat",
      "title": "Pending outbox",
      "gridPos": { "x": 12, "y": 0, "w": 6, "h": 5 },
      "targets": [
        { "expr": "uptime_sentinel_outbox_depth", "legendFormat": "queued" }
      ]
    },
    {
      "id": 3,
      "type": "stat",
      "title": "Active maintenance windows",
      "gridPos": { "x": 18, "y": 0, "w": 6, "h": 5 },
      "targets": [
        { "expr": "uptime_sentinel_maintenance_windows_active", "legendFormat": "windows" }
      ]
    },
    {
      "id": 4,
      "type": "timeseries",
      "title": "Probe rate by status",
      "gridPos": { "x": 0, "y": 5, "w": 12, "h": 8 },
      "targets": [
        { "expr": "sum by (status) (rate(uptime_sentinel_probes_total[5m]))", "legendFormat": "{{status}}" }
      ]
    },
    {
      "id": 5,
      "type": "timeseries",
      "title": "Probe duration p50 / p99 by monitor type",
      "gridPos": { "x": 12, "y": 5, "w": 12, "h": 8 },
      "targets": [
        {
          "expr": "histogram_quantile(0.50, sum by (monitor_type, le) (rate(uptime_sentinel_probe_duration_seconds_bucket[5m])))",
          "legendFormat": "p50 {{monitor_type}}"
        },
        {
          "expr": "histogram_quantile(0.99, sum by (monitor_type, le) (rate(uptime_sentinel_probe_duration_seconds_bucket[5m])))",
          "legendFormat": "p99 {{monitor_type}}"
        }
      ],
      "fieldConfig": { "defaults": { "unit": "s" } }
    },
    {
      "id": 6,
      "type": "timeseries",
      "title": "Notifications dispatched",
      "gridPos": { "x": 0, "y": 13, "w": 12, "h": 8 },
      "targets": [
        {
          "expr": "sum by (channel, outcome) (rate(uptime_sentinel_notifications_total[5m]))",
          "legendFormat": "{{channel}} / {{outcome}}"
        }
      ]
    },
    {
      "id": 7,
      "type": "timeseries",
      "title": "Worker tick latency p99 by tick type",
      "gridPos": { "x": 12, "y": 13, "w": 12, "h": 8 },
      "targets": [
        {
          "expr": "histogram_quantile(0.99, sum by (tick, le) (rate(uptime_sentinel_worker_tick_duration_seconds_bucket[5m])))",
          "legendFormat": "{{tick}}"
        }
      ],
      "fieldConfig": { "defaults": { "unit": "s" } }
    }
  ]
}
