| name | observability-pattern-detector |
| description | Automated pattern recognition in Claude Code telemetry. Use when detecting failures, slowness, anomalies, trends, inefficiencies, conversation patterns, or tool sequences. |
Observability Pattern Detector
Automated pattern recognition and anomaly detection in Claude Code telemetry data from enhanced hooks.
Data Source
Primary: {job="claude_code_enhanced"} in Loki
Operations
detect-failures
Group similar failures and identify patterns.
{job="claude_code_enhanced", event_type="tool_result", status="error"} | json
Algorithm: Group by error_type → Calculate frequency → Rank by impact.
Output: Failure patterns with occurrences, affected tools, first/last seen, trend.
detect-slowness
Identify large response patterns (proxy for slowness).
{job="claude_code_enhanced", event_type="tool_result"} | json | response_length > 100000
Algorithm: Flag responses >100k chars → Group by tool → Identify patterns.
Output: Slow operations with response sizes, affected tools.
detect-anomalies
Statistical anomaly detection in sessions.
{job="claude_code_enhanced", event_type="session_end"} | json | turn_count > 50
Methods: High turn count, long duration, many errors per session.
Output: Anomalous sessions with metrics, likely cause.
detect-trends
Long-term trend analysis.
sum(count_over_time({job="claude_code_enhanced", event_type="tool_call"} [1d]))