-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Refactor collectMetrics command #17111
Refactor collectMetrics command #17111
Conversation
ssz1997
commented
Mar 17, 2023
- We added more information to the response JSON string. Make the whole thing a JSON string for easier parsing.
- Refactor the get metrics part for reusing.
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, could you attach one sample output file/content to the PR? Thanks!
@@ -122,62 +158,46 @@ private void masterMetrics(StringWriter outputBuffer, int i) throws IOException | |||
// Do not break the loop since the HTTP failure can be due to many reasons | |||
// Return the error message instead | |||
LOG.error("Failed to get Alluxio master metrics from URL {}. Exception: ", url, e); | |||
metricsResponse = String.format("Url: %s%nError: %s", url, e.getMessage()); | |||
metricsResponse = String.format("{Url: \"%s\",%n\"Error\": %s}", url, e.getMessage()); |
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.
im fine with this manual wrapping for now. An alternative is to wrap it with an object like
class CollectMetricsResponse {
String url;
String error;
String body;
}
Then use jackson ObjectMapper to convert to json. Up to you :)
collectMetrics.txt |
alluxio-bot, merge this please |
1. We added more information to the response JSON string. Make the whole thing a JSON string for easier parsing. 2. Refactor the get metrics part for reusing. pr-link: Alluxio#17111 change-id: cid-0675889969cfe77f069f84c2eb02ae1aa55a0b0b
1. We added more information to the response JSON string. Make the whole thing a JSON string for easier parsing. 2. Refactor the get metrics part for reusing. pr-link: Alluxio#17111 change-id: cid-0675889969cfe77f069f84c2eb02ae1aa55a0b0b
1. We added more information to the response JSON string. Make the whole thing a JSON string for easier parsing. 2. Refactor the get metrics part for reusing. pr-link: Alluxio#17111 change-id: cid-0675889969cfe77f069f84c2eb02ae1aa55a0b0b