Commit e2d98c0
authored
fallback to jobGroupid if jobrunid=taskrunid (#11199)
# What Does This Do
On Databricks 18.2, `spark.databricks.job.runId` returns the job run ID instead of the task run ID. This causes `DatabricksParentContext` to compute identical trace and span IDs, orphaning Spark spans from their Databricks parent.
Fix: skip `spark.databricks.job.runId` when it equals the job run ID and fall through to `spark.jobGroup.id` extraction.
# Motivation
Broken parent-child relationship between Databricks job/task spans and Spark spans on Databricks 18.2.
The `spark.databricks.job.runId` property semantics changed in Databricks 18.2 — it now returns the job-level run ID rather than the task-level run ID. Prior versions are unaffected.
# QA Examples
Trace before: https://ddstaging.datadoghq.com/apm/traces?query=%40_trace_root%3A1%20service%3Aall-purpose&agg_m=count&agg_m_source=base&agg_t=count&cols=service%2Cresource_name%2C%40duration%2C%40http.method%2C%40http.status_code%2C%40_span.count%2C%40_duration.by_service&fromUser=false&graphType=flamegraph&historicalData=true&messageDisplay=inline&query_translation_version=v0&shouldShowLegend=true&sort=desc&spanID=2159132286262269065&spanType=trace-root&storage=hot&timeHint=1777044603326&trace=AwAAAZ3AHMG-ib6LIAAAABhBWjNBSGtRNUFBQ19GLUxjWVlIV2t2WWQAAAAkMTE5ZGMwMzgtMmFmOS00NTFlLTk2YWYtZWFjNTQxOWY3YjhhAAAAfg&traceID=2159132286262269063&traceQuery=&view=spans&start=1776931657013&end=1777277257013&paused=false
trace after https://ddstaging.datadoghq.com/apm/traces?query=%40_trace_root%3A1%20service%3Aall-purpose&agg_m=count&agg_m_source=base&agg_t=count&cols=service%2Cresource_name%2C%40duration%2C%40http.method%2C%40http.status_code%2C%40_span.count%2C%40_duration.by_service&fromUser=false&graphType=flamegraph&historicalData=true&messageDisplay=inline&query_translation_version=v0&shouldShowLegend=true&sort=desc&spanID=10469624543607262827&spanType=trace-root&storage=hot&timeHint=1777276836597&trace=AwAAAZ3N9Fr1O6CLVgAAABhBWjNOOXhfLUFBQ3NPZURNalpLQkZrdVIAAAAkZjE5ZGNkZjctMmI4ZC00YWJkLWJlZmYtYThlNGJjMmE3Zjk2AAAAAQ&traceID=10469624543607262825&traceQuery=&view=spans&start=1777190817655&end=1777277217655&paused=false
# Contributor Checklist
- Format the title according to [the contribution guidelines](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#title-format)
- Assign the `type:` and (`comp:` or `inst:`) labels in addition to [any other useful labels](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#labels)
- Avoid using `close`, `fix`, or [any linking keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) when referencing an issue
Use `solves` instead, and assign the PR [milestone](https://github.com/DataDog/dd-trace-java/milestones) to the issue
- Update the [CODEOWNERS](https://github.com/DataDog/dd-trace-java/blob/master/.github/CODEOWNERS) file on source file addition, migration, or deletion
- Update [public documentation](https://docs.datadoghq.com/tracing/trace_collection/library_config/java/) with any new configuration flags or behaviors
<!--
# Opening vs Drafting a PR:
When opening a pull request, please open it as a draft to not auto assign reviewers before you feel the pull request is in a reviewable state.
# Linking a JIRA ticket:
Please link your JIRA ticket by adding its identifier between brackets (ex [PROJ-IDENT]) in the PR description, not the title.
This requirement only applies to Datadog employees.
-->
Co-authored-by: adrien.boitreaud <adrien.boitreaud@datadoghq.com>1 parent 515d17b commit e2d98c0
3 files changed
Lines changed: 54 additions & 6 deletions
File tree
- dd-java-agent/instrumentation/spark/spark-common/src
- main/java/datadog/trace/instrumentation/spark
- testFixtures/groovy/datadog/trace/instrumentation/spark
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| |||
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
1181 | | - | |
| 1180 | + | |
| 1181 | + | |
1182 | 1182 | | |
1183 | | - | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1184 | 1188 | | |
1185 | 1189 | | |
1186 | 1190 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
| 306 | + | |
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
425 | 469 | | |
426 | 470 | | |
427 | 471 | | |
| |||
0 commit comments