Commit f4c772d
postgres: fix ERROR-level log spam from explain_parameterized_queries on type mismatch
UndefinedFunction and DatatypeMismatch raised during EXPLAIN EXECUTE (when
_explain_prepared_statement runs with untyped NULL params against non-text columns)
previously escaped the function body to @tracked_method, which logged at ERROR
with no rate limiting and no _explain_errors_cache write — causing hundreds of
thousands of ERROR logs per day on ORM-generated queries.
Catch these errors before they reach the decorator: log at DEBUG, return None as
a sentinel. explain_statement maps None -> DBExplainError.undefined_function so
the failure stays observable in collection_errors telemetry, consistent with how
the PREPARE phase handles the same error class (PRs #19969/#19998).
The April 2025 PREPARE-phase fixes left the EXECUTE phase unpatched; this closes
that gap. Confirmed unfixed through current master (HEAD 22faef8).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 22faef8 commit f4c772d
2 files changed
Lines changed: 53 additions & 1 deletion
File tree
- postgres
- datadog_checks/postgres
- tests
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
163 | 176 | | |
164 | 177 | | |
165 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
250 | 289 | | |
251 | 290 | | |
252 | 291 | | |
| |||
0 commit comments