-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-44863][UI] Add a button to download thread dump as a txt in Spark UI #42575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
also @sarutak and @jasonli-db |
| <div style="display: flex; align-items: center;"> | ||
| <a class="expandbutton" onClick="expandAllThreadStackTrace(true)">Expand All</a> | ||
| <a class="expandbutton d-none" onClick="collapseAllThreadStackTrace(true)">Collapse All</a> | ||
| <a class="downloadbutton" href={"data:text/plain;charset=utf-8," + threadDump.map(_.toString).mkString} download={"threaddump_" + executorId + ".txt"}>Download</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about adding "application id" as part of the file name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it comes to distinguishing files, there are several options such as using app id, attempt id, timestamps, executor details, and more to name the files. However, I prefer to keep it simple to allow for easy renaming when users click the button.
| */ | ||
| override def toString: String = { | ||
| val sb = new StringBuilder() | ||
| val basic = "\"" + threadName + "\" Id=" + threadId + " " + threadState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val basic = s""""$threadName" Id=$threadId $threadState"""
sb.append(basic)
or
sb.append("\"").append(threadName).append("\" Id=").append(threadId).append(" ").append(threadState)
// sb.append("\"", threadName, "\" Id=", threadId, " ", threadState) multiple parameters api needs to wait until only Scala 2.13+ is supported.
The former has better readability, while the latter can avoid creating the intermediate string basic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I choose another simple way val sb = new StringBuilder(s""""$threadName" Id=$threadId $threadState""")
|
cc @jasonli-db and @gengliangwang would you mind take a look? |
LuciferYang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM
jasonli-db
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
thank you all, merged to master |
|
@yaooqinn thank you so much for working on this! |
…ark UI ### What changes were proposed in this pull request? This PR added a button to download thread dump as a txt w.r.t. jstack formatting ### Why are the changes needed? The formatting of raw jstack can be relatively easy to read and analyze using various thread tools. ### Does this PR introduce _any_ user-facing change?  ### How was this patch tested? #### Raw Dump File [driver.txt](https://github.com/apache/spark/files/12388302/driver.txt) #### Reporting by external tools https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjMvMDgvMjAvZHJpdmVyLnR4dC0tMTMtNTMtMjI=& ### Was this patch authored or co-authored using generative AI tooling? no Closes apache#42575 from yaooqinn/SPARK-44863. Authored-by: Kent Yao <[email protected]> Signed-off-by: Kent Yao <[email protected]> (cherry picked from commit f7a0b3a)
### What changes were proposed in this pull request? Improve `ThreadStackTrace` with `synchronizers`, `monitors`, `lockName`, `lockOwnerName`, `suspended`, `inNative` for thread dump. ### Why are the changes needed? ThreadStackTrace does not support stack trace including `synchronizers`, `monitors`, `lockName`, `lockOwnerName`, `suspended`, `inNative` at present. It's recommend to improve `ThreadStackTrace` of thread dump for more details of thread stack trace. ### Does this PR introduce _any_ user-facing change? The response of `ThreadStack` in `/api/v1/thread_dump` adds `synchronizers`, `monitors`, `lockName`, `lockOwnerName`, `suspended`, `inNative` fields. Cherry pick: - apache/spark#42575 - apache/spark#43095 ### How was this patch tested? `ApiV1BaseResourceSuite#thread_dump` Closes #2888 from SteNicholas/CELEBORN-1697. Authored-by: SteNicholas <[email protected]> Signed-off-by: mingji <[email protected]>
What changes were proposed in this pull request?
This PR added a button to download thread dump as a txt w.r.t. jstack formatting
Why are the changes needed?
The formatting of raw jstack can be relatively easy to read and analyze using various thread tools.
Does this PR introduce any user-facing change?
How was this patch tested?
Raw Dump File
driver.txt
Reporting by external tools
https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjMvMDgvMjAvZHJpdmVyLnR4dC0tMTMtNTMtMjI=&
Was this patch authored or co-authored using generative AI tooling?
no