apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
  name: irc-now-overview
  namespace: irc-josie-cloud
spec:
  instanceSelector:
    matchLabels:
      dashboards: irc-now
  folder: admin
  json: |
    {
      "uid": "irc-now-overview",
      "title": "irc.now Overview",
      "timezone": "browser",
      "refresh": "30s",
      "time": { "from": "now-24h", "to": "now" },
      "panels": [
        {
          "id": 1,
          "title": "Users",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 0, "y": 0 },
          "targets": [{ "expr": "max(irc_now_users_total)", "legendFormat": "Total" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#5CA882", "value": null }] } } }
        },
        {
          "id": 2,
          "title": "Active Users (24h)",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 4, "y": 0 },
          "targets": [{ "expr": "max(irc_now_active_users_24h)", "legendFormat": "DAU" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#72C09A", "value": null }] } } }
        },
        {
          "id": 3,
          "title": "Logins",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 8, "y": 0 },
          "targets": [{ "expr": "sum(increase(irc_now_logins_total[24h]))", "legendFormat": "24h" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#AA68A0", "value": null }] } } }
        },
        {
          "id": 4,
          "title": "Users by Plan",
          "type": "piechart",
          "gridPos": { "h": 8, "w": 6, "x": 12, "y": 0 },
          "targets": [{ "expr": "max(irc_now_users_by_plan) by (plan)", "legendFormat": "{{ plan }}" }],
          "fieldConfig": {
            "defaults": {},
            "overrides": [
              { "matcher": { "id": "byName", "options": "free" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#68AA82" } }] },
              { "matcher": { "id": "byName", "options": "pro" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] }
            ]
          }
        },
        {
          "id": 5,
          "title": "Pastes",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 0, "y": 4 },
          "targets": [{ "expr": "max(irc_now_pastes_total)", "legendFormat": "Total" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#AA9E68", "value": null }] } } }
        },
        {
          "id": 6,
          "title": "Images",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 4, "y": 4 },
          "targets": [{ "expr": "max(irc_now_images_total)", "legendFormat": "Total" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#68A0AA", "value": null }] } } }
        },
        {
          "id": 7,
          "title": "Bots",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 8, "y": 4 },
          "targets": [{ "expr": "max(irc_now_bots_total)", "legendFormat": "Total" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#88AA58", "value": null }] } } }
        },
        {
          "id": 8,
          "title": "Bots Running",
          "type": "gauge",
          "gridPos": { "h": 4, "w": 6, "x": 18, "y": 0 },
          "targets": [{ "expr": "max(irc_now_bots_running)", "legendFormat": "Running" }],
          "fieldConfig": { "defaults": { "max": 10, "thresholds": { "steps": [{ "color": "#68AA82", "value": null }, { "color": "#AA9E68", "value": 5 }, { "color": "#AA68A0", "value": 8 }] } } }
        },
        {
          "id": 9,
          "title": "Users Over Time",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 },
          "targets": [
            { "expr": "max(irc_now_users_total)", "legendFormat": "Total" },
            { "expr": "max(irc_now_active_users_24h)", "legendFormat": "Active (24h)" }
          ],
          "fieldConfig": {
            "defaults": {},
            "overrides": [
              { "matcher": { "id": "byName", "options": "Total" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] },
              { "matcher": { "id": "byName", "options": "Active (24h)" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#72C09A" } }] }
            ]
          }
        },
        {
          "id": 10,
          "title": "Content Over Time",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 },
          "targets": [
            { "expr": "max(irc_now_pastes_total)", "legendFormat": "Pastes" },
            { "expr": "max(irc_now_images_total)", "legendFormat": "Images" },
            { "expr": "max(irc_now_bots_total)", "legendFormat": "Bots" }
          ],
          "fieldConfig": {
            "defaults": {},
            "overrides": [
              { "matcher": { "id": "byName", "options": "Pastes" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#AA9E68" } }] },
              { "matcher": { "id": "byName", "options": "Images" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#68A0AA" } }] },
              { "matcher": { "id": "byName", "options": "Bots" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#88AA58" } }] }
            ]
          }
        },
        {
          "id": 11,
          "title": "Storage (Bytes)",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 16 },
          "targets": [
            { "expr": "max(irc_now_pastes_storage_bytes)", "legendFormat": "Pastes" },
            { "expr": "max(irc_now_images_storage_bytes)", "legendFormat": "Images" }
          ],
          "fieldConfig": {
            "defaults": { "unit": "bytes" },
            "overrides": [
              { "matcher": { "id": "byName", "options": "Pastes" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#AA9E68" } }] },
              { "matcher": { "id": "byName", "options": "Images" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#68A0AA" } }] }
            ]
          }
        },
        {
          "id": 12,
          "title": "IRC Bouncer",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 16 },
          "targets": [
            { "expr": "max(irc_now_bouncer_networks_total)", "legendFormat": "Networks" },
            { "expr": "max(irc_now_bouncer_channels_total)", "legendFormat": "Channels" },
            { "expr": "max(irc_now_bouncer_active_users)", "legendFormat": "Active Users" }
          ],
          "fieldConfig": {
            "defaults": {},
            "overrides": [
              { "matcher": { "id": "byName", "options": "Networks" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] },
              { "matcher": { "id": "byName", "options": "Channels" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#AA9E68" } }] },
              { "matcher": { "id": "byName", "options": "Active Users" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#72C09A" } }] }
            ]
          }
        },
        {
          "id": 13,
          "title": "HTTP Requests (5m rate)",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 24 },
          "targets": [
            { "expr": "sum(rate(http_requests_total{namespace=\"irc-josie-cloud\"}[5m])) by (job)", "legendFormat": "{{ job }}" }
          ],
          "fieldConfig": {
            "defaults": { "unit": "reqps" },
            "overrides": [
              { "matcher": { "id": "byName", "options": "web-api" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] },
              { "matcher": { "id": "byName", "options": "txt" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#AA9E68" } }] },
              { "matcher": { "id": "byName", "options": "pics" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#68A0AA" } }] },
              { "matcher": { "id": "byName", "options": "bot" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#88AA58" } }] }
            ]
          }
        },
        {
          "id": 14,
          "title": "HTTP Latency p95",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 24 },
          "targets": [
            { "expr": "histogram_quantile(0.95, sum(rate(http_request_duration_seconds{namespace=\"irc-josie-cloud\"}[5m])) by (job, le))", "legendFormat": "{{ job }}" }
          ],
          "fieldConfig": {
            "defaults": { "unit": "s" },
            "overrides": [
              { "matcher": { "id": "byName", "options": "web-api" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] },
              { "matcher": { "id": "byName", "options": "txt" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#AA9E68" } }] },
              { "matcher": { "id": "byName", "options": "pics" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#68A0AA" } }] },
              { "matcher": { "id": "byName", "options": "bot" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#88AA58" } }] }
            ]
          }
        },
        {
          "id": 15,
          "title": "MRR",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 18, "y": 4 },
          "targets": [{ "expr": "max(irc_now_mrr_cents) / 100", "legendFormat": "MRR" }],
          "fieldConfig": { "defaults": { "unit": "currencyUSD", "thresholds": { "steps": [{ "color": "#5CA882", "value": null }] } } }
        },
        {
          "id": 16,
          "title": "Subscriptions",
          "type": "stat",
          "gridPos": { "h": 4, "w": 3, "x": 22, "y": 4 },
          "targets": [{ "expr": "max(irc_now_subscriptions_active)", "legendFormat": "Active" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#72C09A", "value": null }] } } }
        },
        {
          "id": 17,
          "title": "Signups (7d)",
          "type": "stat",
          "gridPos": { "h": 4, "w": 4, "x": 12, "y": 4 },
          "targets": [{ "expr": "max(irc_now_signups_7d)", "legendFormat": "7d" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#68AA82", "value": null }] } } }
        },
        {
          "id": 18,
          "title": "Conversion Rate (30d)",
          "type": "stat",
          "gridPos": { "h": 4, "w": 6, "x": 0, "y": 32 },
          "targets": [{ "expr": "max(irc_now_conversion_rate_30d) * 100", "legendFormat": "Rate" }],
          "fieldConfig": { "defaults": { "unit": "percent", "thresholds": { "steps": [{ "color": "#AA9E68", "value": null }, { "color": "#5CA882", "value": 5 }] } } }
        },
        {
          "id": 19,
          "title": "Churn Rate (30d)",
          "type": "stat",
          "gridPos": { "h": 4, "w": 6, "x": 6, "y": 32 },
          "targets": [{ "expr": "max(irc_now_churn_rate_30d) * 100", "legendFormat": "Rate" }],
          "fieldConfig": { "defaults": { "unit": "percent", "thresholds": { "steps": [{ "color": "#68AA82", "value": null }, { "color": "#AA9E68", "value": 5 }, { "color": "#AA68A0", "value": 10 }] } } }
        },
        {
          "id": 20,
          "title": "Revenue Over Time",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 32 },
          "targets": [
            { "expr": "irc_now_mrr_cents / 100", "legendFormat": "MRR" },
            { "expr": "irc_now_subscriptions_active", "legendFormat": "Subscriptions" }
          ],
          "fieldConfig": {
            "defaults": { "unit": "currencyUSD" },
            "overrides": [
              { "matcher": { "id": "byName", "options": "MRR" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] },
              { "matcher": { "id": "byName", "options": "Subscriptions" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#72C09A" } }] }
            ]
          }
        }
      ],
      "schemaVersion": 39
    }
