Skip to content
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

HDDS-11206. Statistics storage usage indicators include min, max, median, stdev #6977

Merged
merged 4 commits into from
Jul 29, 2024

Conversation

jianghuazhu
Copy link
Contributor

@jianghuazhu jianghuazhu commented Jul 22, 2024

What changes were proposed in this pull request?

For SCM, it is very useful to count the min, max, median, and stdev of node storage.
After adding the patch:
jmx:
image

ui:
image

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-11206

How was this patch tested?

It is necessary to ensure that jmx can display NodeStatics correctly.
It is necessary to ensure that the UI can display Statistical correctly.

@jianghuazhu
Copy link
Contributor Author

Can you help review this PR, @sumitagrawl @ArafatKhan2198 .
Thanks.

Copy link
Contributor

@ivandika3 ivandika3 left a comment

Choose a reason for hiding this comment

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

Thank for the patch @jianghuazhu , left a few comments.

@@ -48,4 +49,8 @@ public interface NodeManagerMXBean {
*/
Map<String, Map<String, String>> getNodeStatusInfo();

default Map<String, String> getNodeStatics() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: Statics -> Statistics.

Also applies to other instances of Statics in the patch.

private enum UsageStatics {
MIN("Min"),
MAX("Max"),
MEDINNA("Medina"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: MEDINA -> MEDIAN. Also applies to similar typos.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your comment and review, @ivandika3 .
I'll update later.

Comment on lines 35 to 41
$scope.statistical = {
usages : {}
}
$scope.statistical.usages.min = "";
$scope.statistical.usages.max = "";
$scope.statistical.usages.medina = "";
$scope.statistical.usages.stdev = "";
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: statistical -> statistics.

I think it's also better to be more specific that it is the statistics for DNs (since technically we can have statistics for SCM in the future). Maybe scope.statistics.nodes.usages. prefix is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated it.

Copy link
Contributor

@ivandika3 ivandika3 left a comment

Choose a reason for hiding this comment

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

Thanks for updating the patch. LGTM +1.

Comment on lines 1223 to 1225
Map<String, String> nodeStatics = new HashMap<>();
// Statistics node usaged
nodeUsageStatics(nodeStatics);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Statics -> Stats / Statistics

@ArafatKhan2198
Copy link
Contributor

@jianghuazhu Can you please update the PR description with the latest screenshots.

@devabhishekpal
Copy link
Contributor

devabhishekpal commented Jul 26, 2024

Hello @jianghuazhu, thank you for this patch.
It is really helpful that we are able to see the statistics for storage usage.
I had one suggestion, if we could divide the data into different rows instead of a single row:

Statistical

DataNodes usages% (Min / Median / Max / stdDev) 11.79% / 52.96% / 95.03% / 22.91%

to

Statistics

Datanode Usage in percentage (%)
Min 11.79
Median 52.96
Max 95.03
Standard Deviation 22.91

@jianghuazhu
Copy link
Contributor Author

Thanks for your comments and reviews, @ArafatKhan2198 @devabhishekpal .
I updated the description of this PR, here are the latest UI and JMX.
JMX:
image

UI:
image

Comment on lines 35 to 43
$scope.statistics = {
nodes : {
usages : {}
}
}
$scope.statistics.nodes.usages.min = "";
$scope.statistics.nodes.usages.max = "";
$scope.statistics.nodes.usages.median = "";
$scope.statistics.nodes.usages.stdev = "";
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @jianghuazhu, was there any reason behind separating these values out?
I believe we can declare them in the statistics object.
Also I think initializing them to something like "N/A" would be better as in case there is any error, the default value won't be empty but rather show something to let the user know something went wrong.

Suggested change
$scope.statistics = {
nodes : {
usages : {}
}
}
$scope.statistics.nodes.usages.min = "";
$scope.statistics.nodes.usages.max = "";
$scope.statistics.nodes.usages.median = "";
$scope.statistics.nodes.usages.stdev = "";
$scope.statistics = {
nodes : {
usages : {
min: "N/A",
max: "N/A",
median: "N/A",
stdev: "N/A"
}
}
}

@@ -81,6 +90,18 @@
$scope.totalItems = nodeStatusCopy.length;
$scope.lastIndex = Math.ceil(nodeStatusCopy.length / $scope.RecordsToDisplay);
$scope.nodeStatus = nodeStatusCopy.slice(0, $scope.RecordsToDisplay);

ctrl.nodemanagermetrics.NodeStatistics.map(({ key, value }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

While using a .map() will give us the same result, but it will also return an array (empty in this case) which we are ignoring as the value is not being assigned.
This might not be affecting the performance or anything, as it is a minor operation, but I would suggest to use .forEach in this scenario.

Copy link
Contributor

@devabhishekpal devabhishekpal left a comment

Choose a reason for hiding this comment

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

Thanks @jianghuazhu for your changes.
Just a few minor comments, and then it looks good to me.

@@ -81,6 +91,18 @@
$scope.totalItems = nodeStatusCopy.length;
$scope.lastIndex = Math.ceil(nodeStatusCopy.length / $scope.RecordsToDisplay);
$scope.nodeStatus = nodeStatusCopy.slice(0, $scope.RecordsToDisplay);

ctrl.nodemanagermetrics.NodeStatistics.forEach(function(obj) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just fyi, can de-structure this as well like you did for map().
Since obj = { key: abc, value: xyz }, we can destructure it as:
{key, value} = obj

So the function could also be written as:

ctrl.nodemanagermetrics.NodeStatistics.forEach(({key, value}) => {
  ....
});

But your current change is good as well

Copy link
Contributor

@devabhishekpal devabhishekpal left a comment

Choose a reason for hiding this comment

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

Thanks a lot @jianghuazhu for your changes, this addition is great.
Thank you @ivandika3 for reviewing this PR
The changes LGTM, +1

@jianghuazhu
Copy link
Contributor Author

Thanks for your comments and reviews, @devabhishekpal , @ivandika3 .

@ivandika3 ivandika3 merged commit a532b89 into apache:master Jul 29, 2024
39 checks passed
@ivandika3
Copy link
Contributor

Thank you for the patch @jianghuazhu, and @devabhishekpal @ArafatKhan2198 for the reviews.

@ivandika3 ivandika3 added the UI label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants