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": "max(irc_now_mrr_cents) / 100", "legendFormat": "MRR" },
            { "expr": "max(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" } }] }
            ]
          }
        },
        {
          "id": 21,
          "title": "HTTP Errors (4xx vs 5xx)",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 40 },
          "targets": [
            { "expr": "sum(rate(http_requests_total{namespace=\"irc-josie-cloud\", status=~\"4..\"}[5m])) by (job)", "legendFormat": "4xx {{ job }}" },
            { "expr": "sum(rate(http_requests_total{namespace=\"irc-josie-cloud\", status=~\"5..\"}[5m])) by (job)", "legendFormat": "5xx {{ job }}" }
          ],
          "fieldConfig": { "defaults": { "unit": "reqps" } }
        },
        {
          "id": 22,
          "title": "Pastes Storage in 30d",
          "type": "stat",
          "gridPos": { "h": 4, "w": 6, "x": 12, "y": 40 },
          "targets": [{ "expr": "predict_linear(max(irc_now_pastes_storage_bytes)[7d:1h], 30*86400)", "legendFormat": "Predicted" }],
          "fieldConfig": { "defaults": { "unit": "bytes", "thresholds": { "steps": [{ "color": "#68AA82", "value": null }] }, "noValue": "N/A" } }
        },
        {
          "id": 23,
          "title": "Images Storage in 30d",
          "type": "stat",
          "gridPos": { "h": 4, "w": 6, "x": 18, "y": 40 },
          "targets": [{ "expr": "predict_linear(max(irc_now_images_storage_bytes)[7d:1h], 30*86400)", "legendFormat": "Predicted" }],
          "fieldConfig": { "defaults": { "unit": "bytes", "thresholds": { "steps": [{ "color": "#68AA82", "value": null }] }, "noValue": "N/A" } }
        },
        {
          "id": 24,
          "title": "Onboarding Funnel (30d)",
          "type": "bargauge",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 44 },
          "targets": [
            { "expr": "max(irc_now_funnel_signups_30d)", "legendFormat": "Signups" },
            { "expr": "max(irc_now_funnel_bouncer_created_30d)", "legendFormat": "Bouncer Created" },
            { "expr": "max(irc_now_funnel_returned_30d)", "legendFormat": "Returned" }
          ],
          "fieldConfig": {
            "defaults": { "thresholds": { "steps": [{ "color": "#5CA882", "value": null }] } },
            "overrides": [
              { "matcher": { "id": "byName", "options": "Signups" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] },
              { "matcher": { "id": "byName", "options": "Bouncer Created" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#72C09A" } }] },
              { "matcher": { "id": "byName", "options": "Returned" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#AA9E68" } }] }
            ]
          }
        },
        {
          "id": 25,
          "title": "Time to First Bouncer",
          "type": "stat",
          "gridPos": { "h": 4, "w": 6, "x": 0, "y": 48 },
          "targets": [{ "expr": "max(irc_now_time_to_first_bouncer_seconds)", "legendFormat": "Avg" }],
          "fieldConfig": { "defaults": { "unit": "s", "thresholds": { "steps": [{ "color": "#68AA82", "value": null }, { "color": "#AA9E68", "value": 3600 }, { "color": "#AA68A0", "value": 86400 }] } } }
        },
        {
          "id": 26,
          "title": "Connected Users (5m)",
          "type": "stat",
          "gridPos": { "h": 4, "w": 6, "x": 6, "y": 48 },
          "targets": [{ "expr": "max(irc_now_bouncer_connected_users_5m)", "legendFormat": "Connected" }],
          "fieldConfig": { "defaults": { "thresholds": { "steps": [{ "color": "#72C09A", "value": null }] } } }
        },
        {
          "id": 27,
          "title": "Deliveries by Network",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 52 },
          "targets": [{ "expr": "max(irc_now_bouncer_deliveries_by_network) by (network)", "legendFormat": "{{ network }}" }],
          "fieldConfig": { "defaults": {} }
        },
        {
          "id": 28,
          "title": "Feature Adoption",
          "type": "bargauge",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 52 },
          "targets": [
            { "expr": "max(irc_now_adoption_permanent_content)", "legendFormat": "Permanent Content" },
            { "expr": "max(irc_now_adoption_bouncer_users)", "legendFormat": "Bouncer Users" },
            { "expr": "max(irc_now_adoption_network_users)", "legendFormat": "Network Users" }
          ],
          "fieldConfig": {
            "defaults": { "thresholds": { "steps": [{ "color": "#5CA882", "value": null }] } },
            "overrides": [
              { "matcher": { "id": "byName", "options": "Permanent Content" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#AA9E68" } }] },
              { "matcher": { "id": "byName", "options": "Bouncer Users" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#5CA882" } }] },
              { "matcher": { "id": "byName", "options": "Network Users" }, "properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "#68A0AA" } }] }
            ]
          }
        },
        {
          "id": 29,
          "title": "Bot Script Runs",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 0, "y": 60 },
          "targets": [
            { "expr": "sum(rate(irc_now_bot_script_runs_total[5m])) by (handler)", "legendFormat": "{{ handler }}" }
          ],
          "fieldConfig": { "defaults": { "unit": "ops" } }
        },
        {
          "id": 30,
          "title": "Bot Script Latency p95",
          "type": "timeseries",
          "gridPos": { "h": 8, "w": 12, "x": 12, "y": 60 },
          "targets": [
            { "expr": "histogram_quantile(0.95, sum(rate(irc_now_bot_script_duration_seconds[5m])) by (handler, le))", "legendFormat": "{{ handler }}" }
          ],
          "fieldConfig": { "defaults": { "unit": "s" } }
        }
      ],
      "schemaVersion": 39
    }
