wForget opened a new pull request, #58770:
URL: https://github.com/apache/spark/pull/58770
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR:
https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g.,
'[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a
faster review.
7. If you want to add a new configuration, please read the guideline first
for naming configurations in
'common/utils/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the
guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
Add task attempt spans to `ProfilerExecutorPlugin` using the Span API
introduced by [async-profiler PR
#1755](https://github.com/async-profiler/async-profiler/pull/1755).
Each span records a task attempt’s execution interval on its executor thread
in the same JFR file as the profiling samples. Comma-separated tags include
stage ID, stage attempt number, partition ID, task attempt ID, attempt number,
and completion status.
Spans start in `onTaskStart` and end in the success or failure callback.
Task metadata is retained in thread-local state because `TaskContext` is
cleared before the end callbacks run.
### Why are the changes needed?
The profiling output currently lacks an explicit mapping between Spark task
attempts and executor threads over time. Since an executor thread runs multiple
tasks sequentially, thread identity alone cannot determine which task produced
a profiling sample.
Task spans provide this mapping through their thread, execution interval,
and task identifiers. This allows users to extract profiling samples for
selected task attempts from the JFR file using the task-to-thread mapping and
execution intervals recorded in the spans.
### Does this PR introduce _any_ user-facing change?
Yes. This PR adds `spark.profiler.executor.taskSpan.enabled`, disabled by
default.
### How was this patch tested?
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-6)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]