Commit 25c8041
committed
Add regex pattern support for error detection
This commit extends the error detection system with regex pattern matching,
enabling complex error patterns with variable parts (URLs, IPs, hostnames).
Changes:
- Add regex_matches section to errors.yaml
- DNS lookup errors: 'dial tcp:.*no such host'
- Connection refused errors
- Timeout errors (context deadline, i/o timeout, net/http timeout)
- Handles user's example: Get "https://fred.brew.sh/...": dial tcp: lookup fred.brew.sh on 8.8.8.8:53: no such host
- Update ErrorDetector class
- Add regex_patterns list to store compiled regex objects
- Compile patterns with re.IGNORECASE flag for case-insensitive matching
- Check messages against regex patterns in is_error() method
- Update extract_error_info() to return pattern_type ("fuzzy", "exact", or "regex")
- Extend test suite with regex pattern tests
- Test regex pattern loading and compilation
- Test DNS lookup error detection (user's example)
- Test connection refused errors
- Test timeout errors
- Test case-insensitive regex matching
- Test error info extraction with pattern_type
Now supports three pattern types:
- Fuzzy: Fast substring matching for simple patterns
- Exact: Precise prefix/exact matching
- Regex: Flexible pattern matching for complex errors with variable parts
Tested with user's DNS error example - successfully detected!1 parent dba09f5 commit 25c8041
File tree
3 files changed
+116
-2
lines changed- pystackql
- core
- tests
3 files changed
+116
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
| |||
86 | 100 | | |
87 | 101 | | |
88 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
89 | 108 | | |
90 | 109 | | |
91 | 110 | | |
| |||
102 | 121 | | |
103 | 122 | | |
104 | 123 | | |
| 124 | + | |
105 | 125 | | |
106 | | - | |
| 126 | + | |
107 | 127 | | |
108 | 128 | | |
109 | 129 | | |
| 130 | + | |
110 | 131 | | |
111 | 132 | | |
112 | 133 | | |
113 | 134 | | |
114 | 135 | | |
115 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
116 | 145 | | |
117 | 146 | | |
118 | 147 | | |
119 | 148 | | |
120 | | - | |
| 149 | + | |
| 150 | + | |
121 | 151 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
128 | 192 | | |
129 | 193 | | |
130 | 194 | | |
| |||
0 commit comments