diff --git a/.gitignore b/.gitignore index febfe10..72e5faa 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,10 @@ debug-*.log # Local observability stack host data (Docker bind mounts) observability/local/.storage/ + +# ContextStream logs/support exports +contextstream-logs-*.json +contextstream-support-case-*.md + +# Session metrics (local only) +logs/claude-session-metrics.jsonl diff --git a/observability/local/grafana/provisioning/dashboards/claude-code-overview.json b/observability/local/grafana/provisioning/dashboards/claude-code-overview.json new file mode 100644 index 0000000..b1bcc40 --- /dev/null +++ b/observability/local/grafana/provisioning/dashboards/claude-code-overview.json @@ -0,0 +1,538 @@ +{ + "id": null, + "uid": "claude-code-overview", + "title": "Claude Code — Session Overview", + "description": "Full observability for Claude Code sessions: tool calls, agents, errors, and cross-session trends.", + "tags": ["claude-code", "observability"], + "timezone": "browser", + "editable": true, + "graphTooltip": 1, + "time": { "from": "now-6h", "to": "now" }, + "refresh": "30s", + "schemaVersion": 39, + "fiscalYearStartMonth": 0, + "liveNow": false, + "style": "dark", + "templating": { + "list": [ + { + "name": "session_id", + "label": "Session", + "type": "query", + "datasource": { "type": "loki", "uid": "loki_local" }, + "query": "{app=\"claude-dev-logging\", component=\"lifecycle\"} | json | hook_type=\"session-start\"", + "regex": "session_id\":\"([^\"]+)", + "refresh": 2, + "includeAll": true, + "allValue": ".*", + "current": { "text": "All", "value": "$__all" }, + "sort": 2 + }, + { + "name": "project", + "label": "Project", + "type": "query", + "datasource": { "type": "loki", "uid": "loki_local" }, + "query": "{app=\"claude-dev-logging\", component=\"lifecycle\"} | json | hook_type=\"session-start\"", + "regex": "project\":\"([^\"]+)", + "refresh": 2, + "includeAll": true, + "allValue": ".*", + "current": { "text": "All", "value": "$__all" }, + "sort": 1 + } + ] + }, + "panels": [ + { + "type": "row", + "title": "Session At-a-Glance", + "collapsed": false, + "gridPos": { "x": 0, "y": 0, "w": 24, "h": 1 } + }, + { + "id": 1, + "title": "Tool Calls", + "type": "stat", + "transparent": true, + "gridPos": { "x": 0, "y": 1, "w": 5, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=~\"tool|mcp-.*\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__range])", + "queryType": "range" + } + ], + "options": { + "colorMode": "background-gradient", + "graphMode": "area", + "textMode": "auto", + "wideLayout": true, + "justifyMode": "auto", + "orientation": "auto", + "text": { "titleSize": 12, "valueSize": 32 }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#5794F2" }, + "thresholds": { "mode": "absolute", "steps": [{ "value": null, "color": "#5794F2" }] } + }, + "overrides": [] + } + }, + { + "id": 2, + "title": "Errors", + "type": "stat", + "transparent": true, + "gridPos": { "x": 5, "y": 1, "w": 5, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", level=\"ERROR\"} | json | session_id=~\"$session_id\" [$__range])", + "queryType": "range" + } + ], + "options": { + "colorMode": "background-gradient", + "graphMode": "area", + "textMode": "auto", + "wideLayout": true, + "justifyMode": "auto", + "orientation": "auto", + "text": { "titleSize": 12, "valueSize": 32 }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "thresholds" }, + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { "value": null, "color": "#73BF69" }, + { "value": 1, "color": "#FF9830" }, + { "value": 5, "color": "#F2495C" } + ] + } + }, + "overrides": [] + } + }, + { + "id": 3, + "title": "Agents Spawned", + "type": "stat", + "transparent": true, + "gridPos": { "x": 10, "y": 1, "w": 5, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"agent\"} | json | session_id=~\"$session_id\" | hook_type=\"subagent-start\" [$__range])", + "queryType": "range" + } + ], + "options": { + "colorMode": "background-gradient", + "graphMode": "area", + "textMode": "auto", + "wideLayout": true, + "justifyMode": "auto", + "orientation": "auto", + "text": { "titleSize": 12, "valueSize": 32 }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#B877D9" }, + "noValue": "0", + "thresholds": { "mode": "absolute", "steps": [{ "value": null, "color": "#B877D9" }] } + }, + "overrides": [] + } + }, + { + "id": 4, + "title": "User Prompts", + "type": "stat", + "transparent": true, + "gridPos": { "x": 15, "y": 1, "w": 5, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"user\"} | json | session_id=~\"$session_id\" | hook_type=\"user-prompt-submit\" [$__range])", + "queryType": "range" + } + ], + "options": { + "colorMode": "background-gradient", + "graphMode": "area", + "textMode": "auto", + "wideLayout": true, + "justifyMode": "auto", + "orientation": "auto", + "text": { "titleSize": 12, "valueSize": 32 }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#8AB8FF" }, + "noValue": "0", + "thresholds": { "mode": "absolute", "steps": [{ "value": null, "color": "#8AB8FF" }] } + }, + "overrides": [] + } + }, + { + "id": 5, + "title": "Permission Requests", + "type": "stat", + "transparent": true, + "gridPos": { "x": 20, "y": 1, "w": 4, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"user\"} | json | session_id=~\"$session_id\" | hook_type=\"permission-request\" [$__range])", + "queryType": "range" + } + ], + "options": { + "colorMode": "background-gradient", + "graphMode": "area", + "textMode": "auto", + "wideLayout": true, + "justifyMode": "auto", + "orientation": "auto", + "text": { "titleSize": 12, "valueSize": 32 }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#FF9830" }, + "noValue": "0", + "thresholds": { "mode": "absolute", "steps": [{ "value": null, "color": "#FF9830" }] } + }, + "overrides": [] + } + }, + { + "type": "row", + "title": "Activity Over Time", + "collapsed": false, + "gridPos": { "x": 0, "y": 7, "w": 24, "h": 1 } + }, + { + "id": 6, + "title": "Tool Call Rate by Component", + "description": "Stacked view of tool usage across all component types over time.", + "type": "timeseries", + "transparent": true, + "gridPos": { "x": 0, "y": 8, "w": 24, "h": 10 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (component) (count_over_time({app=\"claude-dev-logging\", component=~\"tool|mcp-.*\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__interval]))", + "legendFormat": "{{component}}", + "queryType": "range" + } + ], + "options": { + "legend": { "displayMode": "table", "placement": "right", "calcs": ["sum", "mean"] }, + "tooltip": { "mode": "multi", "sort": "desc" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "palette-classic" }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 2, + "fillOpacity": 15, + "gradientMode": "opacity", + "showPoints": "never", + "barAlignment": 0, + "spanNulls": false, + "axisBorderShow": false, + "stacking": { "mode": "none", "group": "A" } + } + }, + "overrides": [ + { "matcher": { "id": "byName", "options": "tool" }, "properties": [{ "id": "color", "value": { "fixedColor": "#5794F2", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp-contextstream" }, "properties": [{ "id": "color", "value": { "fixedColor": "#B877D9", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp-sentry" }, "properties": [{ "id": "color", "value": { "fixedColor": "#FF9830", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp-ollama" }, "properties": [{ "id": "color", "value": { "fixedColor": "#73BF69", "mode": "fixed" } }] } + ] + } + }, + { + "type": "row", + "title": "Breakdown", + "collapsed": false, + "gridPos": { "x": 0, "y": 19, "w": 24, "h": 1 } + }, + { + "id": 7, + "title": "Component Distribution", + "type": "piechart", + "transparent": true, + "gridPos": { "x": 0, "y": 20, "w": 8, "h": 9 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (component) (count_over_time({app=\"claude-dev-logging\"} | json | session_id=~\"$session_id\" [$__range]))", + "queryType": "range" + } + ], + "options": { + "pieType": "donut", + "displayLabels": ["percent"], + "legend": { "displayMode": "table", "placement": "right", "values": ["value", "percent"] }, + "tooltip": { "mode": "multi" }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { "color": { "mode": "palette-classic" } }, + "overrides": [ + { "matcher": { "id": "byName", "options": "tool" }, "properties": [{ "id": "color", "value": { "fixedColor": "#5794F2", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp-contextstream" }, "properties": [{ "id": "color", "value": { "fixedColor": "#B877D9", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "user" }, "properties": [{ "id": "color", "value": { "fixedColor": "#8AB8FF", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "lifecycle" }, "properties": [{ "id": "color", "value": { "fixedColor": "#73BF69", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "agent" }, "properties": [{ "id": "color", "value": { "fixedColor": "#FF9830", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "transcript" }, "properties": [{ "id": "color", "value": { "fixedColor": "#FADE2A", "mode": "fixed" } }] } + ] + } + }, + { + "id": 8, + "title": "Hook Type Breakdown", + "type": "barchart", + "transparent": true, + "gridPos": { "x": 8, "y": 20, "w": 8, "h": 9 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (hook_type) (count_over_time({app=\"claude-dev-logging\"} | json | session_id=~\"$session_id\" | hook_type!=\"\" [$__range]))", + "queryType": "range" + } + ], + "options": { + "orientation": "horizontal", + "barWidth": 0.7, + "groupWidth": 0.7, + "showValue": "auto", + "stacking": "none", + "legend": { "displayMode": "hidden" }, + "tooltip": { "mode": "multi" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "palette-classic" }, + "custom": { "fillOpacity": 80, "gradientMode": "hue" } + }, + "overrides": [] + } + }, + { + "id": 9, + "title": "Top Tools Used", + "type": "barchart", + "transparent": true, + "gridPos": { "x": 16, "y": 20, "w": 8, "h": 9 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (tool_name) (count_over_time({app=\"claude-dev-logging\", component=~\"tool|mcp-.*\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__range]))", + "queryType": "range" + } + ], + "options": { + "orientation": "horizontal", + "barWidth": 0.7, + "groupWidth": 0.7, + "showValue": "auto", + "stacking": "none", + "legend": { "displayMode": "hidden" }, + "tooltip": { "mode": "multi" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#5794F2" }, + "custom": { "fillOpacity": 80, "gradientMode": "hue" } + }, + "overrides": [] + } + }, + { + "type": "row", + "title": "Agent Activity", + "collapsed": false, + "gridPos": { "x": 0, "y": 30, "w": 24, "h": 1 } + }, + { + "id": 10, + "title": "Agent Lifecycle Timeline", + "description": "Subagent start/stop events over time.", + "type": "state-timeline", + "transparent": true, + "gridPos": { "x": 0, "y": 31, "w": 24, "h": 6 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "{app=\"claude-dev-logging\", component=\"agent\"} | json | session_id=~\"$session_id\"", + "queryType": "range" + } + ], + "options": { + "showValue": "auto", + "mergeValues": true, + "alignValue": "left", + "legend": { "displayMode": "list", "placement": "bottom" }, + "tooltip": { "mode": "multi" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "thresholds" }, + "custom": { "fillOpacity": 70 }, + "thresholds": { "mode": "absolute", "steps": [{ "value": null, "color": "#B877D9" }] } + }, + "overrides": [] + } + }, + { + "type": "row", + "title": "Cross-Session Trends", + "collapsed": false, + "gridPos": { "x": 0, "y": 38, "w": 24, "h": 1 } + }, + { + "id": 11, + "title": "Tool Calls per Session", + "type": "barchart", + "transparent": true, + "gridPos": { "x": 0, "y": 39, "w": 12, "h": 8 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (session_id) (count_over_time({app=\"claude-dev-logging\", component=~\"tool|mcp-.*\"} | json | hook_type=\"post-tool-use\" [$__range]))", + "queryType": "range" + } + ], + "options": { + "orientation": "vertical", + "barWidth": 0.6, + "showValue": "auto", + "stacking": "none", + "xTickLabelRotation": -45, + "xTickLabelMaxLength": 8, + "legend": { "displayMode": "hidden" }, + "tooltip": { "mode": "multi" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#5794F2" }, + "custom": { "fillOpacity": 80, "gradientMode": "hue" } + }, + "overrides": [] + } + }, + { + "id": 12, + "title": "Errors per Session", + "type": "barchart", + "transparent": true, + "gridPos": { "x": 12, "y": 39, "w": 12, "h": 8 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (session_id) (count_over_time({app=\"claude-dev-logging\", level=\"ERROR\"} | json [$__range]))", + "queryType": "range" + } + ], + "options": { + "orientation": "vertical", + "barWidth": 0.6, + "showValue": "auto", + "stacking": "none", + "xTickLabelRotation": -45, + "xTickLabelMaxLength": 8, + "legend": { "displayMode": "hidden" }, + "tooltip": { "mode": "multi" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "thresholds" }, + "custom": { "fillOpacity": 80, "gradientMode": "hue" }, + "thresholds": { + "mode": "absolute", + "steps": [ + { "value": null, "color": "#73BF69" }, + { "value": 1, "color": "#FF9830" }, + { "value": 5, "color": "#F2495C" } + ] + } + }, + "overrides": [] + } + }, + { + "type": "row", + "title": "Log Stream", + "collapsed": true, + "gridPos": { "x": 0, "y": 48, "w": 24, "h": 1 }, + "panels": [ + { + "id": 13, + "title": "Full Session Logs", + "type": "logs", + "transparent": true, + "gridPos": { "x": 0, "y": 49, "w": 24, "h": 14 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "{app=\"claude-dev-logging\"} | json | session_id=~\"$session_id\" | line_format \"{{.hook_type}} | {{.component}} | {{.tool_name}}\"", + "queryType": "range" + } + ], + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "sortOrder": "Descending", + "dedupStrategy": "none" + } + } + ] + } + ] +} diff --git a/observability/local/grafana/provisioning/dashboards/contextstream-deep-dive.json b/observability/local/grafana/provisioning/dashboards/contextstream-deep-dive.json new file mode 100644 index 0000000..1a918b1 --- /dev/null +++ b/observability/local/grafana/provisioning/dashboards/contextstream-deep-dive.json @@ -0,0 +1,432 @@ +{ + "id": null, + "uid": "contextstream-deep-dive", + "title": "ContextStream — Deep Dive", + "description": "MCP call patterns, action distribution, object lifecycle, and performance for ContextStream integration.", + "tags": ["claude-code", "contextstream", "mcp"], + "timezone": "browser", + "editable": true, + "graphTooltip": 1, + "time": { "from": "now-6h", "to": "now" }, + "refresh": "30s", + "schemaVersion": 39, + "fiscalYearStartMonth": 0, + "liveNow": false, + "style": "dark", + "templating": { + "list": [ + { + "name": "session_id", + "label": "Session", + "type": "query", + "datasource": { "type": "loki", "uid": "loki_local" }, + "query": "{app=\"claude-dev-logging\", component=\"lifecycle\"} | json | hook_type=\"session-start\"", + "regex": "session_id\":\"([^\"]+)", + "refresh": 2, + "includeAll": true, + "allValue": ".*", + "current": { "text": "All", "value": "$__all" }, + "sort": 2 + }, + { + "name": "cs_action", + "label": "Action", + "type": "query", + "datasource": { "type": "loki", "uid": "loki_local" }, + "query": "{app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | hook_type=\"post-tool-use\"", + "regex": "hook_payload_tool_input_action\":\"([^\"]+)", + "refresh": 2, + "includeAll": true, + "allValue": ".*", + "current": { "text": "All", "value": "$__all" }, + "sort": 1 + } + ] + }, + "panels": [ + { + "type": "row", + "title": "MCP Call Summary", + "collapsed": false, + "gridPos": { "x": 0, "y": 0, "w": 24, "h": 1 } + }, + { + "id": 1, + "title": "Total CS Calls", + "type": "stat", + "transparent": true, + "gridPos": { "x": 0, "y": 1, "w": 6, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__range])", + "queryType": "range" + } + ], + "options": { + "colorMode": "background-gradient", + "graphMode": "area", + "textMode": "auto", + "wideLayout": true, + "justifyMode": "auto", + "orientation": "auto", + "text": { "titleSize": 12, "valueSize": 32 }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#B877D9" }, + "thresholds": { "mode": "absolute", "steps": [{ "value": null, "color": "#B877D9" }] } + }, + "overrides": [] + } + }, + { + "id": 2, + "title": "Failure Rate", + "type": "gauge", + "transparent": true, + "gridPos": { "x": 6, "y": 1, "w": 6, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "errors", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\", level=\"ERROR\"} | json | session_id=~\"$session_id\" [$__range])", + "queryType": "range", + "hide": true + }, + { + "refId": "total", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__range])", + "queryType": "range", + "hide": true + }, + { + "refId": "rate", + "datasource": { "type": "__expr__", "uid": "__expr__" }, + "type": "math", + "expression": "$errors / $total * 100" + } + ], + "options": { + "showThresholdLabels": false, + "showThresholdMarkers": true, + "reduceOptions": { "values": false, "calcs": ["lastNotNull"], "fields": "" } + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "min": 0, + "max": 100, + "color": { "mode": "thresholds" }, + "thresholds": { + "mode": "absolute", + "steps": [ + { "value": null, "color": "#73BF69" }, + { "value": 5, "color": "#FF9830" }, + { "value": 20, "color": "#F2495C" } + ] + } + }, + "overrides": [] + } + }, + { + "id": 3, + "title": "Calls by Tool", + "type": "piechart", + "transparent": true, + "gridPos": { "x": 12, "y": 1, "w": 12, "h": 5 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (tool_name) (count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__range]))", + "queryType": "range" + } + ], + "options": { + "pieType": "donut", + "displayLabels": ["percent"], + "legend": { "displayMode": "table", "placement": "right", "values": ["value", "percent"] }, + "tooltip": { "mode": "multi" }, + "reduceOptions": { "values": false, "calcs": ["sum"], "fields": "" } + }, + "fieldConfig": { + "defaults": { "color": { "mode": "palette-classic" } }, + "overrides": [ + { "matcher": { "id": "byName", "options": "mcp__contextstream__memory" }, "properties": [{ "id": "color", "value": { "fixedColor": "#B877D9", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp__contextstream__session" }, "properties": [{ "id": "color", "value": { "fixedColor": "#5794F2", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp__contextstream__search" }, "properties": [{ "id": "color", "value": { "fixedColor": "#73BF69", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp__contextstream__context" }, "properties": [{ "id": "color", "value": { "fixedColor": "#FF9830", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp__contextstream__init" }, "properties": [{ "id": "color", "value": { "fixedColor": "#FADE2A", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp__contextstream__workspace" }, "properties": [{ "id": "color", "value": { "fixedColor": "#8AB8FF", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp__contextstream__project" }, "properties": [{ "id": "color", "value": { "fixedColor": "#CA95E5", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "mcp__contextstream__help" }, "properties": [{ "id": "color", "value": { "fixedColor": "#96D98D", "mode": "fixed" } }] } + ] + } + }, + { + "type": "row", + "title": "Action Patterns", + "collapsed": false, + "gridPos": { "x": 0, "y": 7, "w": 24, "h": 1 } + }, + { + "id": 4, + "title": "Action Breakdown", + "description": "Which MCP actions are called most frequently.", + "type": "barchart", + "transparent": true, + "gridPos": { "x": 0, "y": 8, "w": 12, "h": 10 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (hook_payload_tool_input_action) (count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__range]))", + "queryType": "range" + } + ], + "options": { + "orientation": "horizontal", + "barWidth": 0.7, + "groupWidth": 0.7, + "showValue": "auto", + "stacking": "none", + "legend": { "displayMode": "hidden" }, + "tooltip": { "mode": "multi" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "fixed", "fixedColor": "#B877D9" }, + "custom": { "fillOpacity": 80, "gradientMode": "hue" } + }, + "overrides": [] + } + }, + { + "id": 5, + "title": "Action Mix Over Time", + "description": "How action usage patterns shift during a session.", + "type": "timeseries", + "transparent": true, + "gridPos": { "x": 12, "y": 8, "w": 12, "h": 10 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (hook_payload_tool_input_action) (count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" [$__interval]))", + "legendFormat": "{{hook_payload_tool_input_action}}", + "queryType": "range" + } + ], + "options": { + "legend": { "displayMode": "table", "placement": "right", "calcs": ["sum"] }, + "tooltip": { "mode": "multi", "sort": "desc" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "palette-classic" }, + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 2, + "fillOpacity": 10, + "gradientMode": "opacity", + "showPoints": "never", + "spanNulls": false, + "axisBorderShow": false, + "stacking": { "mode": "none", "group": "A" } + } + }, + "overrides": [] + } + }, + { + "type": "row", + "title": "Object Lifecycle", + "collapsed": false, + "gridPos": { "x": 0, "y": 19, "w": 24, "h": 1 } + }, + { + "id": 6, + "title": "CRUD Operations", + "description": "Create, read, update, and query operation distribution.", + "type": "barchart", + "transparent": true, + "gridPos": { "x": 0, "y": 20, "w": 12, "h": 9 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "Create", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" | hook_payload_tool_input_action=~\"create.*|capture.*|import.*|remember\" [$__range])", + "legendFormat": "Create", + "queryType": "range" + }, + { + "refId": "Read", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" | hook_payload_tool_input_action=~\"get.*|list.*\" [$__range])", + "legendFormat": "Read", + "queryType": "range" + }, + { + "refId": "Update", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" | hook_payload_tool_input_action=~\"update.*|supersede.*|complete.*|reorder.*\" [$__range])", + "legendFormat": "Update", + "queryType": "range" + }, + { + "refId": "Query", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" | hook_payload_tool_input_action=~\"search|recall|decisions|summary|timeline|smart_search|decision_trace\" [$__range])", + "legendFormat": "Query", + "queryType": "range" + } + ], + "options": { + "orientation": "vertical", + "barWidth": 0.6, + "groupWidth": 0.7, + "showValue": "always", + "stacking": "none", + "legend": { "displayMode": "list", "placement": "bottom" }, + "tooltip": { "mode": "multi" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "palette-classic" }, + "custom": { "fillOpacity": 80, "gradientMode": "hue" } + }, + "overrides": [ + { "matcher": { "id": "byName", "options": "Create" }, "properties": [{ "id": "color", "value": { "fixedColor": "#73BF69", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "Read" }, "properties": [{ "id": "color", "value": { "fixedColor": "#5794F2", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "Update" }, "properties": [{ "id": "color", "value": { "fixedColor": "#FF9830", "mode": "fixed" } }] }, + { "matcher": { "id": "byName", "options": "Query" }, "properties": [{ "id": "color", "value": { "fixedColor": "#B877D9", "mode": "fixed" } }] } + ] + } + }, + { + "id": 7, + "title": "Context & Search Patterns", + "description": "Context refresh frequency and search mode usage over time.", + "type": "timeseries", + "transparent": true, + "gridPos": { "x": 12, "y": 20, "w": 12, "h": 9 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "context", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (tool_name) (count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" | tool_name=~\".*init|.*context\" [$__interval]))", + "legendFormat": "{{tool_name}}", + "queryType": "range" + }, + { + "refId": "search", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "sum by (hook_payload_tool_input_mode) (count_over_time({app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | hook_type=\"post-tool-use\" | tool_name=~\".*search\" [$__interval]))", + "legendFormat": "search:{{hook_payload_tool_input_mode}}", + "queryType": "range" + } + ], + "options": { + "legend": { "displayMode": "table", "placement": "right", "calcs": ["sum"] }, + "tooltip": { "mode": "multi", "sort": "desc" } + }, + "fieldConfig": { + "defaults": { + "color": { "mode": "palette-classic" }, + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 2, + "fillOpacity": 15, + "gradientMode": "opacity", + "showPoints": "never", + "spanNulls": false, + "axisBorderShow": false, + "stacking": { "mode": "none", "group": "A" } + } + }, + "overrides": [] + } + }, + { + "type": "row", + "title": "Errors & Failures", + "collapsed": false, + "gridPos": { "x": 0, "y": 30, "w": 24, "h": 1 } + }, + { + "id": 8, + "title": "Error Log", + "description": "All ContextStream MCP errors.", + "type": "logs", + "transparent": true, + "gridPos": { "x": 0, "y": 31, "w": 24, "h": 8 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "{app=\"claude-dev-logging\", component=\"mcp-contextstream\", level=\"ERROR\"} | json | session_id=~\"$session_id\"", + "queryType": "range" + } + ], + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "sortOrder": "Descending", + "dedupStrategy": "none" + } + }, + { + "type": "row", + "title": "Full Log Stream", + "collapsed": true, + "gridPos": { "x": 0, "y": 40, "w": 24, "h": 1 }, + "panels": [ + { + "id": 9, + "title": "ContextStream Logs", + "type": "logs", + "transparent": true, + "gridPos": { "x": 0, "y": 41, "w": 24, "h": 14 }, + "datasource": { "type": "loki", "uid": "loki_local" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "loki", "uid": "loki_local" }, + "expr": "{app=\"claude-dev-logging\", component=\"mcp-contextstream\"} | json | session_id=~\"$session_id\" | line_format \"{{.tool_name}} | action={{.hook_payload_tool_input_action}} | {{.hook_type}}\"", + "queryType": "range" + } + ], + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "sortOrder": "Descending", + "dedupStrategy": "none" + } + } + ] + } + ] +}