feat: Claude Code Monitor — lanes, pipelines and a merged workspace

Internal SmartGift build of a Claude Code monitoring dashboard.

Lanes: a durable unit of parallel agent work, one per working directory,
tracked across session restarts. Managed lanes are git worktrees the
dashboard provisions and can reset or remove behind a three-check destroy
guard and a counted preflight; adopted lanes are directories you already
own and are never destroyable.

Pipelines: a lane moves through pipeline stages. A stage the agent declares
with evidence renders green; a stage inferred from the tool-event stream
renders dashed amber and never counts as done. Detection is forward-only
within a 30-minute window, and never writes the declared stage.

Workspace: one page at /run with a lane grid, the selected lane's pipeline,
and a full Claude console behind a disclosure.
This commit is contained in:
2026-07-29 17:07:45 +07:00
commit 57dc91585d
783 changed files with 221743 additions and 0 deletions
@@ -0,0 +1,855 @@
{
"uid": "ccam-overview",
"title": "CCAM — Overview",
"description": "Live metrics scraped from GET /api/metrics on each 15s interval. Every value is read from your SQLite database at scrape time — no sample or synthetic data.",
"tags": ["ccam", "claude-code"],
"timezone": "browser",
"schemaVersion": 39,
"version": 2,
"editable": true,
"refresh": "15s",
"time": { "from": "now-24h", "to": "now" },
"links": [
{
"title": "Sessions & Agents",
"type": "link",
"url": "/d/ccam-sessions-agents/ccam-sessions-agents",
"keepTime": true
},
{
"title": "Tokens & Events",
"type": "link",
"url": "/d/ccam-tokens-events/ccam-tokens-events",
"keepTime": true
},
{
"title": "Platform Health",
"type": "link",
"url": "/d/ccam-platform/ccam-platform",
"keepTime": true
},
{
"title": "Prometheus — total sessions",
"type": "link",
"icon": "external link",
"url": "http://localhost:9090/graph?g0.expr=sum(ccam_sessions)&g0.tab=0",
"targetBlank": true,
"keepTime": true
},
{
"title": "Prometheus — event total",
"type": "link",
"icon": "external link",
"url": "http://localhost:9090/graph?g0.expr=ccam_events_total&g0.tab=0",
"targetBlank": true,
"keepTime": true
}
],
"templating": { "list": [] },
"annotations": { "list": [] },
"panels": [
{
"id": 100,
"type": "row",
"title": "Live fleet",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 }
},
{
"id": 1,
"type": "stat",
"title": "Active sessions",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 0, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_sessions{status=\"active\"}",
"legendFormat": "active"
}
]
},
{
"id": 2,
"type": "stat",
"title": "Working agents",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 4, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "blue", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_agents{status=\"working\"}",
"legendFormat": "working"
}
]
},
{
"id": 3,
"type": "stat",
"title": "Realtime clients",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 8, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "purple", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_websocket_clients",
"legendFormat": "clients"
}
]
},
{
"id": 4,
"type": "stat",
"title": "Enabled remote sources",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 12, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "none",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_remote_sources{enabled=\"true\"}",
"legendFormat": "enabled"
}
]
},
{
"id": 12,
"type": "stat",
"title": "Scrape healthy",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 16, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "background",
"graphMode": "none",
"textMode": "value",
"justifyMode": "center"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"type": "value",
"options": {
"0": { "text": "DOWN", "color": "red" },
"1": { "text": "UP", "color": "green" }
}
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "red", "value": null },
{ "color": "green", "value": 1 }
]
}
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_up",
"legendFormat": "up"
}
]
},
{
"id": 13,
"type": "stat",
"title": "Total sessions",
"description": "Sum of all session statuses in the database (active + completed + error + abandoned).",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 20, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "orange", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "sum(ccam_sessions)",
"legendFormat": "total"
}
]
},
{
"id": 101,
"type": "row",
"title": "Database totals (cumulative — from your SQLite history)",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 5 }
},
{
"id": 14,
"type": "stat",
"title": "Completed sessions",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 0, "y": 6 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_sessions{status=\"completed\"}",
"legendFormat": "completed"
}
]
},
{
"id": 15,
"type": "stat",
"title": "Error sessions",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 4, "y": 6 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "none",
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "red", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_sessions{status=\"error\"}",
"legendFormat": "error"
}
]
},
{
"id": 16,
"type": "stat",
"title": "Total events",
"description": "Monotonic counter since the database was created.",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 8, "y": 6 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "blue", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_events_total",
"legendFormat": "events"
}
]
},
{
"id": 17,
"type": "stat",
"title": "Input tokens",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 12, "y": 6 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "yellow", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_tokens_total{kind=\"input\"}",
"legendFormat": "input"
}
]
},
{
"id": 18,
"type": "stat",
"title": "Output tokens",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 16, "y": 6 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "orange", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_tokens_total{kind=\"output\"}",
"legendFormat": "output"
}
]
},
{
"id": 19,
"type": "stat",
"title": "All tokens (sum)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 20, "y": 6 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "purple", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "sum(ccam_tokens_total)",
"legendFormat": "tokens"
}
]
},
{
"id": 102,
"type": "row",
"title": "Breakdown",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 10 }
},
{
"id": 20,
"type": "piechart",
"title": "Sessions by status",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 0, "y": 11 },
"options": {
"legend": { "displayMode": "table", "placement": "right", "values": ["value", "percent"] },
"pieType": "donut",
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"tooltip": { "mode": "single" }
},
"fieldConfig": {
"defaults": { "unit": "none", "decimals": 0 },
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_sessions",
"legendFormat": "{{status}}",
"instant": true
}
]
},
{
"id": 21,
"type": "bargauge",
"title": "Token totals by kind",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 8, "y": 11 },
"options": {
"orientation": "horizontal",
"displayMode": "gradient",
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"showUnfilled": true
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"color": { "mode": "palette-classic" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_tokens_total",
"legendFormat": "{{kind}}",
"instant": true
}
]
},
{
"id": 22,
"type": "bargauge",
"title": "Agents by status",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 16, "y": 11 },
"options": {
"orientation": "horizontal",
"displayMode": "gradient",
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"showUnfilled": true
},
"fieldConfig": {
"defaults": {
"unit": "none",
"decimals": 0,
"color": { "mode": "palette-classic" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "blue", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_agents",
"legendFormat": "{{status}}",
"instant": true
}
]
},
{
"id": 103,
"type": "row",
"title": "Over time",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 19 }
},
{
"id": 5,
"type": "timeseries",
"title": "Sessions by status",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 20 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "calcs": [] },
"tooltip": { "mode": "multi", "sort": "desc" }
},
"fieldConfig": {
"defaults": {
"unit": "none",
"color": { "mode": "palette-classic" },
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"stacking": { "mode": "none", "group": "A" }
}
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_sessions",
"legendFormat": "{{status}}"
}
]
},
{
"id": 6,
"type": "timeseries",
"title": "Agents by status",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 20 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "calcs": [] },
"tooltip": { "mode": "multi", "sort": "desc" }
},
"fieldConfig": {
"defaults": {
"unit": "none",
"color": { "mode": "palette-classic" },
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"stacking": { "mode": "none", "group": "A" }
}
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_agents",
"legendFormat": "{{status}}"
}
]
},
{
"id": 23,
"type": "timeseries",
"title": "Cumulative events (database total)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 28 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "calcs": ["lastNotNull"] },
"tooltip": { "mode": "single", "sort": "none" }
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0,
"color": { "mode": "palette-classic" },
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 20,
"showPoints": "never",
"stacking": { "mode": "none", "group": "A" }
}
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_events_total",
"legendFormat": "events"
}
]
},
{
"id": 24,
"type": "timeseries",
"title": "Cumulative tokens by kind",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 28 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "calcs": ["lastNotNull"] },
"tooltip": { "mode": "multi", "sort": "desc" }
},
"fieldConfig": {
"defaults": {
"unit": "short",
"color": { "mode": "palette-classic" },
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never",
"stacking": { "mode": "none", "group": "A" }
}
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_tokens_total",
"legendFormat": "{{kind}}"
}
]
},
{
"id": 104,
"type": "row",
"title": "Rates (need a few scrape intervals)",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 36 }
},
{
"id": 7,
"type": "timeseries",
"title": "Event throughput (events/sec)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 37 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "calcs": [] },
"tooltip": { "mode": "single", "sort": "none" }
},
"fieldConfig": {
"defaults": {
"unit": "ops",
"color": { "mode": "palette-classic" },
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 15,
"showPoints": "never"
}
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "rate(ccam_events_total[5m])",
"legendFormat": "events/s"
}
]
},
{
"id": 8,
"type": "timeseries",
"title": "Token usage rate by kind (tokens/sec)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 37 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "calcs": [] },
"tooltip": { "mode": "multi", "sort": "desc" }
},
"fieldConfig": {
"defaults": {
"unit": "none",
"color": { "mode": "palette-classic" },
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never"
}
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "rate(ccam_tokens_total[5m])",
"legendFormat": "{{kind}}"
}
]
},
{
"id": 105,
"type": "row",
"title": "Process",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 45 }
},
{
"id": 9,
"type": "stat",
"title": "Server uptime",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 6, "w": 6, "x": 0, "y": 46 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "none",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_process_uptime_seconds",
"legendFormat": "uptime"
}
]
},
{
"id": 10,
"type": "stat",
"title": "Server memory (RSS)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 6, "w": 6, "x": 6, "y": 46 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false },
"colorMode": "value",
"graphMode": "area",
"textMode": "auto",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"unit": "bytes",
"color": { "mode": "thresholds" },
"thresholds": { "mode": "absolute", "steps": [{ "color": "blue", "value": null }] }
},
"overrides": []
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_process_resident_memory_bytes",
"legendFormat": "rss"
}
]
},
{
"id": 11,
"type": "table",
"title": "Build info",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 6, "w": 12, "x": 12, "y": 46 },
"options": { "showHeader": true },
"fieldConfig": {
"defaults": {},
"overrides": [
{
"matcher": { "id": "byName", "options": "Value" },
"properties": [{ "id": "custom.hidden", "value": true }]
},
{
"matcher": { "id": "byName", "options": "Time" },
"properties": [{ "id": "custom.hidden", "value": true }]
},
{
"matcher": { "id": "byName", "options": "job" },
"properties": [{ "id": "custom.hidden", "value": true }]
}
]
},
"targets": [
{
"refId": "A",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"expr": "ccam_build_info",
"format": "table",
"instant": true
}
]
}
]
}
@@ -0,0 +1,401 @@
{
"uid": "ccam-platform",
"title": "CCAM — Platform Health",
"description": "Scrape health, process resources, remote sources, and build info from live metrics.",
"tags": ["ccam", "claude-code", "platform", "health"],
"timezone": "browser",
"schemaVersion": 39,
"version": 1,
"editable": true,
"refresh": "15s",
"time": { "from": "now-24h", "to": "now" },
"links": [
{
"title": "Overview",
"type": "link",
"url": "/d/ccam-overview/ccam-overview",
"keepTime": true
},
{
"title": "Sessions & Agents",
"type": "link",
"url": "/d/ccam-sessions-agents/ccam-sessions-agents",
"keepTime": true
},
{
"title": "Tokens & Events",
"type": "link",
"url": "/d/ccam-tokens-events/ccam-tokens-events",
"keepTime": true
}
],
"templating": { "list": [] },
"annotations": { "list": [] },
"panels": [
{
"id": 100,
"type": "row",
"title": "Availability",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 }
},
{
"id": 1,
"type": "stat",
"title": "Prometheus scrape",
"description": "up{job=\"ccam\"} — 1 when Prometheus successfully scrapes /api/metrics.",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 5, "w": 6, "x": 0, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"type": "value",
"options": {
"0": { "text": "DOWN", "color": "red" },
"1": { "text": "UP", "color": "green" }
}
}
],
"thresholds": {
"steps": [
{ "color": "red", "value": null },
{ "color": "green", "value": 1 }
]
}
}
},
"targets": [{ "refId": "A", "expr": "up{job=\"ccam\"}", "legendFormat": "scrape" }]
},
{
"id": 2,
"type": "stat",
"title": "CCAM API",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 5, "w": 6, "x": 6, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "background",
"graphMode": "none",
"textMode": "value"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"type": "value",
"options": {
"0": { "text": "DOWN", "color": "red" },
"1": { "text": "UP", "color": "green" }
}
}
],
"thresholds": {
"steps": [
{ "color": "red", "value": null },
{ "color": "green", "value": 1 }
]
}
}
},
"targets": [{ "refId": "A", "expr": "ccam_up", "legendFormat": "api" }]
},
{
"id": 3,
"type": "stat",
"title": "Server uptime",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 5, "w": 6, "x": 12, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "s",
"thresholds": { "steps": [{ "color": "green", "value": null }] }
}
},
"targets": [{ "refId": "A", "expr": "ccam_process_uptime_seconds", "legendFormat": "uptime" }]
},
{
"id": 4,
"type": "stat",
"title": "Memory (RSS)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 5, "w": 6, "x": 18, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "bytes",
"thresholds": { "steps": [{ "color": "blue", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_process_resident_memory_bytes", "legendFormat": "rss" }
]
},
{
"id": 5,
"type": "timeseries",
"title": "Scrape health over time",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 7, "w": 12, "x": 0, "y": 6 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"min": 0,
"max": 1,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 30,
"showPoints": "never",
"spanNulls": false
}
},
"overrides": [
{
"matcher": { "id": "byName", "options": "scrape" },
"properties": [{ "id": "color", "value": { "fixedColor": "green", "mode": "fixed" } }]
},
{
"matcher": { "id": "byName", "options": "api" },
"properties": [{ "id": "color", "value": { "fixedColor": "blue", "mode": "fixed" } }]
}
]
},
"targets": [
{ "refId": "A", "expr": "up{job=\"ccam\"}", "legendFormat": "scrape" },
{ "refId": "B", "expr": "ccam_up", "legendFormat": "api" }
]
},
{
"id": 6,
"type": "timeseries",
"title": "Process memory (RSS)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 6 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"unit": "bytes",
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 20,
"showPoints": "never"
},
"color": { "mode": "fixed", "fixedColor": "blue" }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_process_resident_memory_bytes", "legendFormat": "rss" }
]
},
{
"id": 101,
"type": "row",
"title": "Realtime & federation",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 13 }
},
{
"id": 7,
"type": "stat",
"title": "WebSocket clients",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 0, "y": 14 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"thresholds": { "steps": [{ "color": "purple", "value": null }] }
}
},
"targets": [{ "refId": "A", "expr": "ccam_websocket_clients", "legendFormat": "clients" }]
},
{
"id": 8,
"type": "stat",
"title": "Remote sources (enabled)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 6, "y": 14 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "none"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"thresholds": { "steps": [{ "color": "green", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_remote_sources{enabled=\"true\"}", "legendFormat": "enabled" }
]
},
{
"id": 9,
"type": "stat",
"title": "Remote sources (disabled)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 12, "y": 14 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "none"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"thresholds": { "steps": [{ "color": "orange", "value": null }] }
}
},
"targets": [
{
"refId": "A",
"expr": "ccam_remote_sources{enabled=\"false\"}",
"legendFormat": "disabled"
}
]
},
{
"id": 10,
"type": "stat",
"title": "Hook activity (events/s)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 18, "y": 14 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "ops",
"decimals": 3,
"thresholds": { "steps": [{ "color": "blue", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "rate(ccam_events_total[5m])", "legendFormat": "events/s" }
]
},
{
"id": 11,
"type": "timeseries",
"title": "WebSocket clients over time",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 7, "w": 12, "x": 0, "y": 18 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 25,
"showPoints": "never"
},
"color": { "mode": "fixed", "fixedColor": "purple" }
}
},
"targets": [{ "refId": "A", "expr": "ccam_websocket_clients", "legendFormat": "clients" }]
},
{
"id": 12,
"type": "timeseries",
"title": "Remote data sources",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 18 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 15,
"showPoints": "never"
},
"color": { "mode": "palette-classic" }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_remote_sources", "legendFormat": "enabled={{enabled}}" }
]
},
{
"id": 102,
"type": "row",
"title": "Build",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 25 }
},
{
"id": 13,
"type": "table",
"title": "CCAM build info",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 6, "w": 12, "x": 0, "y": 26 },
"options": { "showHeader": true },
"fieldConfig": {
"defaults": {},
"overrides": [
{
"matcher": { "id": "byName", "options": "Value" },
"properties": [{ "id": "custom.hidden", "value": true }]
},
{
"matcher": { "id": "byName", "options": "Time" },
"properties": [{ "id": "custom.hidden", "value": true }]
},
{
"matcher": { "id": "byName", "options": "job" },
"properties": [{ "id": "custom.hidden", "value": true }]
},
{
"matcher": { "id": "byName", "options": "instance" },
"properties": [{ "id": "custom.hidden", "value": true }]
}
]
},
"targets": [{ "refId": "A", "expr": "ccam_build_info", "format": "table", "instant": true }]
},
{
"id": 14,
"type": "timeseries",
"title": "Server uptime",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 6, "w": 12, "x": 12, "y": 26 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never"
}
}
},
"targets": [{ "refId": "A", "expr": "ccam_process_uptime_seconds", "legendFormat": "uptime" }]
}
]
}
@@ -0,0 +1,371 @@
{
"uid": "ccam-sessions-agents",
"title": "CCAM — Sessions & Agents",
"description": "Session lifecycle and agent fleet metrics from live /api/metrics scrapes.",
"tags": ["ccam", "claude-code", "sessions", "agents"],
"timezone": "browser",
"schemaVersion": 39,
"version": 1,
"editable": true,
"refresh": "15s",
"time": { "from": "now-24h", "to": "now" },
"links": [
{
"title": "Overview",
"type": "link",
"url": "/d/ccam-overview/ccam-overview",
"keepTime": true
},
{
"title": "Tokens & Events",
"type": "link",
"url": "/d/ccam-tokens-events/ccam-tokens-events",
"keepTime": true
},
{
"title": "Platform Health",
"type": "link",
"url": "/d/ccam-platform/ccam-platform",
"keepTime": true
}
],
"templating": { "list": [] },
"annotations": { "list": [] },
"panels": [
{
"id": 100,
"type": "row",
"title": "Sessions",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 }
},
{
"id": 1,
"type": "stat",
"title": "Active",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 0, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "steps": [{ "color": "green", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_sessions{status=\"active\"}", "legendFormat": "active" }
]
},
{
"id": 2,
"type": "stat",
"title": "Completed",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 4, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "steps": [{ "color": "blue", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_sessions{status=\"completed\"}", "legendFormat": "completed" }
]
},
{
"id": 3,
"type": "stat",
"title": "Error",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 8, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "steps": [{ "color": "red", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_sessions{status=\"error\"}", "legendFormat": "error" }
]
},
{
"id": 4,
"type": "stat",
"title": "Abandoned",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 12, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"color": { "mode": "thresholds" },
"thresholds": { "steps": [{ "color": "orange", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_sessions{status=\"abandoned\"}", "legendFormat": "abandoned" }
]
},
{
"id": 5,
"type": "stat",
"title": "Total sessions",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 16, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"unit": "none",
"color": { "mode": "thresholds" },
"thresholds": { "steps": [{ "color": "purple", "value": null }] }
}
},
"targets": [{ "refId": "A", "expr": "sum(ccam_sessions)", "legendFormat": "total" }]
},
{
"id": 6,
"type": "stat",
"title": "Active % of total",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 20, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "none"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"decimals": 1,
"min": 0,
"max": 1,
"color": { "mode": "thresholds" },
"thresholds": { "steps": [{ "color": "green", "value": null }] }
}
},
"targets": [
{
"refId": "A",
"expr": "ccam_sessions{status=\"active\"} / clamp_min(sum(ccam_sessions), 1)",
"legendFormat": "active ratio"
}
]
},
{
"id": 7,
"type": "piechart",
"title": "Sessions by status",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 9, "w": 8, "x": 0, "y": 5 },
"options": {
"legend": { "displayMode": "table", "placement": "right", "values": ["value", "percent"] },
"pieType": "donut",
"reduceOptions": { "calcs": ["lastNotNull"] }
},
"fieldConfig": { "defaults": { "decimals": 0 } },
"targets": [
{ "refId": "A", "expr": "ccam_sessions", "legendFormat": "{{status}}", "instant": true }
]
},
{
"id": 8,
"type": "timeseries",
"title": "Sessions over time",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 9, "w": 16, "x": 8, "y": 5 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom" },
"tooltip": { "mode": "multi" }
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 12,
"showPoints": "never"
},
"color": { "mode": "palette-classic" }
}
},
"targets": [{ "refId": "A", "expr": "ccam_sessions", "legendFormat": "{{status}}" }]
},
{
"id": 101,
"type": "row",
"title": "Agents",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 14 }
},
{
"id": 9,
"type": "stat",
"title": "Working",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 0, "y": 15 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"thresholds": { "steps": [{ "color": "green", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_agents{status=\"working\"}", "legendFormat": "working" }
]
},
{
"id": 10,
"type": "stat",
"title": "Waiting",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 6, "y": 15 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"thresholds": { "steps": [{ "color": "yellow", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_agents{status=\"waiting\"}", "legendFormat": "waiting" }
]
},
{
"id": 11,
"type": "stat",
"title": "Completed",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 12, "y": 15 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"thresholds": { "steps": [{ "color": "blue", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_agents{status=\"completed\"}", "legendFormat": "completed" }
]
},
{
"id": 12,
"type": "stat",
"title": "Error",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 6, "x": 18, "y": 15 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"decimals": 0,
"thresholds": { "steps": [{ "color": "red", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_agents{status=\"error\"}", "legendFormat": "error" }
]
},
{
"id": 13,
"type": "bargauge",
"title": "Agents by status",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 0, "y": 19 },
"options": {
"orientation": "horizontal",
"displayMode": "gradient",
"reduceOptions": { "calcs": ["lastNotNull"] }
},
"fieldConfig": { "defaults": { "decimals": 0, "color": { "mode": "palette-classic" } } },
"targets": [
{ "refId": "A", "expr": "ccam_agents", "legendFormat": "{{status}}", "instant": true }
]
},
{
"id": 14,
"type": "timeseries",
"title": "Agents over time",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 16, "x": 8, "y": 19 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom" },
"tooltip": { "mode": "multi" }
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never"
},
"color": { "mode": "palette-classic" }
}
},
"targets": [{ "refId": "A", "expr": "ccam_agents", "legendFormat": "{{status}}" }]
},
{
"id": 15,
"type": "timeseries",
"title": "Realtime dashboard clients",
"description": "WebSocket clients connected to the CCAM UI.",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 7, "w": 24, "x": 0, "y": 27 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 20,
"showPoints": "never"
},
"color": { "mode": "fixed", "fixedColor": "purple" }
}
},
"targets": [{ "refId": "A", "expr": "ccam_websocket_clients", "legendFormat": "clients" }]
}
]
}
@@ -0,0 +1,350 @@
{
"uid": "ccam-tokens-events",
"title": "CCAM — Tokens & Events",
"description": "Cumulative and rate views of hook events and token usage from live /api/metrics scrapes.",
"tags": ["ccam", "claude-code", "tokens", "events"],
"timezone": "browser",
"schemaVersion": 39,
"version": 1,
"editable": true,
"refresh": "15s",
"time": { "from": "now-24h", "to": "now" },
"links": [
{
"title": "Overview",
"type": "link",
"url": "/d/ccam-overview/ccam-overview",
"keepTime": true
},
{
"title": "Sessions & Agents",
"type": "link",
"url": "/d/ccam-sessions-agents/ccam-sessions-agents",
"keepTime": true
},
{
"title": "Platform Health",
"type": "link",
"url": "/d/ccam-platform/ccam-platform",
"keepTime": true
}
],
"templating": { "list": [] },
"annotations": { "list": [] },
"panels": [
{
"id": 100,
"type": "row",
"title": "Cumulative totals",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 }
},
{
"id": 1,
"type": "stat",
"title": "Total events",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 4, "x": 0, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0,
"thresholds": { "steps": [{ "color": "blue", "value": null }] }
}
},
"targets": [{ "refId": "A", "expr": "ccam_events_total", "legendFormat": "events" }]
},
{
"id": 2,
"type": "stat",
"title": "Input tokens",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 5, "x": 4, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"thresholds": { "steps": [{ "color": "yellow", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_tokens_total{kind=\"input\"}", "legendFormat": "input" }
]
},
{
"id": 3,
"type": "stat",
"title": "Output tokens",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 5, "x": 9, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"thresholds": { "steps": [{ "color": "orange", "value": null }] }
}
},
"targets": [
{ "refId": "A", "expr": "ccam_tokens_total{kind=\"output\"}", "legendFormat": "output" }
]
},
{
"id": 4,
"type": "stat",
"title": "Cache read",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 5, "x": 14, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"thresholds": { "steps": [{ "color": "green", "value": null }] }
}
},
"targets": [
{
"refId": "A",
"expr": "ccam_tokens_total{kind=\"cache_read\"}",
"legendFormat": "cache_read"
}
]
},
{
"id": 5,
"type": "stat",
"title": "Cache write",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 4, "w": 5, "x": 19, "y": 1 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"thresholds": { "steps": [{ "color": "teal", "value": null }] }
}
},
"targets": [
{
"refId": "A",
"expr": "ccam_tokens_total{kind=\"cache_write\"}",
"legendFormat": "cache_write"
}
]
},
{
"id": 6,
"type": "piechart",
"title": "Token share by kind",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 9, "w": 8, "x": 0, "y": 5 },
"options": {
"legend": { "displayMode": "table", "placement": "right", "values": ["value", "percent"] },
"pieType": "pie",
"reduceOptions": { "calcs": ["lastNotNull"] }
},
"fieldConfig": { "defaults": { "unit": "short" } },
"targets": [
{ "refId": "A", "expr": "ccam_tokens_total", "legendFormat": "{{kind}}", "instant": true }
]
},
{
"id": 7,
"type": "timeseries",
"title": "Cumulative tokens by kind",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 9, "w": 16, "x": 8, "y": 5 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom" },
"tooltip": { "mode": "multi" }
},
"fieldConfig": {
"defaults": {
"unit": "short",
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 15,
"showPoints": "never"
},
"color": { "mode": "palette-classic" }
}
},
"targets": [{ "refId": "A", "expr": "ccam_tokens_total", "legendFormat": "{{kind}}" }]
},
{
"id": 8,
"type": "timeseries",
"title": "Cumulative events",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 24, "x": 0, "y": 14 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "calcs": ["lastNotNull"] }
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 25,
"showPoints": "never"
},
"color": { "mode": "fixed", "fixedColor": "blue" }
}
},
"targets": [{ "refId": "A", "expr": "ccam_events_total", "legendFormat": "events" }]
},
{
"id": 101,
"type": "row",
"title": "Throughput rates",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 22 }
},
{
"id": 9,
"type": "timeseries",
"title": "Events per second (5m rate)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 23 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"unit": "ops",
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 20,
"showPoints": "never"
},
"color": { "mode": "fixed", "fixedColor": "blue" }
}
},
"targets": [
{ "refId": "A", "expr": "rate(ccam_events_total[5m])", "legendFormat": "events/s" },
{ "refId": "B", "expr": "ccam:events:rate5m", "legendFormat": "recording rule" }
]
},
{
"id": 10,
"type": "timeseries",
"title": "Tokens per second by kind (5m rate)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 23 },
"options": {
"legend": { "displayMode": "list", "placement": "bottom" },
"tooltip": { "mode": "multi" }
},
"fieldConfig": {
"defaults": {
"unit": "ops",
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 12,
"showPoints": "never"
},
"color": { "mode": "palette-classic" }
}
},
"targets": [
{ "refId": "A", "expr": "rate(ccam_tokens_total[5m])", "legendFormat": "{{kind}}" }
]
},
{
"id": 102,
"type": "row",
"title": "Cache efficiency",
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 31 }
},
{
"id": 11,
"type": "stat",
"title": "Cache read share of prompt tokens",
"description": "cache_read / (input + cache_read) — higher means more prompt served from cache.",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 5, "w": 8, "x": 0, "y": 32 },
"options": {
"reduceOptions": { "calcs": ["lastNotNull"] },
"colorMode": "value",
"graphMode": "area"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"decimals": 1,
"min": 0,
"max": 1,
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "red", "value": null },
{ "color": "yellow", "value": 0.2 },
{ "color": "green", "value": 0.5 }
]
}
}
},
"targets": [
{
"refId": "A",
"expr": "ccam_tokens_total{kind=\"cache_read\"} / clamp_min(ccam_tokens_total{kind=\"input\"} + ccam_tokens_total{kind=\"cache_read\"}, 1)",
"legendFormat": "cache hit ratio"
}
]
},
{
"id": 12,
"type": "timeseries",
"title": "Input vs cache read tokens (cumulative)",
"datasource": { "type": "prometheus", "uid": "ccam-prometheus" },
"gridPos": { "h": 5, "w": 16, "x": 8, "y": 32 },
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
"fieldConfig": {
"defaults": {
"unit": "short",
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "never"
}
}
},
"targets": [
{ "refId": "A", "expr": "ccam_tokens_total{kind=\"input\"}", "legendFormat": "input" },
{
"refId": "B",
"expr": "ccam_tokens_total{kind=\"cache_read\"}",
"legendFormat": "cache_read"
}
]
}
]
}