Commit a7ad565
authored
Instrument QueryExecution.assertAnalyzed() to catch DataFrame analysis failures (#11033)
## What Does This Do
Adds instrumentation on `QueryExecution.assertAnalyzed()` to catch Catalyst analysis failures from any entry point: `SparkSession.sql()`, `Dataset.select()`, `Dataset.filter()`, etc.
Previously, only `SparkSession.sql()` failures were caught (PR #10981), but other failures through DataFrame API operations (`df.select()`) were invisible to the tracer.
## Motivation
Addresses case where logs showed `spark.application` span marked SUCCESS when the EMR step failed. The `AnalysisException` (`UNRESOLVED_COLUMN`) was thrown from `Dataset.select()` → `QueryExecution.assertAnalyzed()`, a path not covered by the existing `SparkSqlFailureAdvice` on `SparkSession.sql()`.
## Notes
- `QueryExecution.assertAnalyzed()` is stable (`public void assertAnalyzed()`) across Spark 3.5.x, 4.0.x, 4.1.x
- Existing `SparkSqlFailureAdvice` on `SparkSession.sql()` is kept
- New integration test exercises the DataFrame API path specifically (`sparkSession.range(1).toDF("id").select("nonexistent_column")`)
Co-authored-by: adrien.boitreaud <adrien.boitreaud@datadoghq.com>1 parent 2b95dcf commit a7ad565
2 files changed
Lines changed: 51 additions & 1 deletion
File tree
- dd-java-agent/instrumentation/spark/spark-common/src
- main/java/datadog/trace/instrumentation/spark
- testFixtures/groovy/datadog/trace/instrumentation/spark
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
80 | 89 | | |
81 | 90 | | |
82 | 91 | | |
| |||
141 | 150 | | |
142 | 151 | | |
143 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
144 | 162 | | |
145 | 163 | | |
146 | 164 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
226 | 258 | | |
227 | 259 | | |
228 | 260 | | |
| |||
0 commit comments