10000 feat(diagnostics): Add thread dump capturing to diagnostics endpoint by Josh-Matsuoka · Pull Request #639 · cryostatio/cryostat-agent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(diagnostics): Add thread dump capturing to diagnostics endpoint #639

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Josh-Matsuoka
Copy link
Contributor

Related to cryostatio/cryostat#135

Adds the ability to capture thread dumps to the agent's mbean-invoke endpoint. The original implementation of the endpoint is already fairly flexible, essentially acting as a wrapper around the mbean.invoke method, so we just need to extend the check for valid/supported operations, and add a further check if we're doing a thread dump so it can be written to the response body as-is.

Currently supports the threadPrint operation but leaves an opening for the threadDumpToFile operation to be supported later if necessary. Note that the format of threadDumpToFile isn't supported by existing support tooling so it won't work for the purposes of the linked issue, only threadPrint.

Opening as Draft until the other pieces of the feature are in place.

try (OutputStreamWriter writer =
new OutputStreamWriter(
exchange.getResponseBody(), Charsets.UTF_8)) {
writer.write(response.toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this co BBB1 mment to others. Learn more.

The difference in this new branch is basically just whether or not the mapper (JSON serializer) is used, right? Maybe that can be refactored, or at least explained in a comment, to be more obvious?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is some strategy pattern (or similar) that you could apply here to refactor and combine some of the overlap between this response handling and the request validity check, too.

@Josh-Matsuoka Josh-Matsuoka marked this pull request as ready for review June 2, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0