adoroszlai commented on a change in pull request #1623:
URL: https://github.com/apache/ozone/pull/1623#discussion_r541544700
##########
File path:
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMContainerMetrics.java
##########
@@ -50,6 +50,7 @@ public void testSCMContainerMetrics() {
put(HddsProtos.LifeCycleState.CLOSED.toString(), 5);
put(HddsProtos.LifeCycleState.DELETING.toString(), 6);
put(HddsProtos.LifeCycleState.DELETED.toString(), 7);
+ put(HddsProtos.LifeCycleState.TOTAL.toString(), 27);
Review comment:
This does not seem to be required, as total is a calculated value.
```suggestion
```
##########
File path: hadoop-hdds/interface-client/src/main/proto/hdds.proto
##########
@@ -169,6 +169,7 @@ enum LifeCycleState {
CLOSED = 4;
DELETING = 5;
DELETED = 6; // object is deleted.
+ TOTAL = 7;
Review comment:
Adding a fake state only for testing metrics collection does not seem
right to me.
```suggestion
```
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMContainerMetrics.java
##########
@@ -84,6 +84,14 @@ public void getMetrics(MetricsCollector collector, boolean
all) {
stateCount.get(DELETING.toString()))
.addGauge(Interns.info("DeletedContainers",
"Number of containers in deleted state"),
+ stateCount.get(DELETED.toString()))
+ .addGauge(Interns.info("TotalContainers",
+ "Number of all containers"),
+ stateCount.get(OPEN.toString())+
+ stateCount.get(CLOSING.toString())+
+ stateCount.get(QUASI_CLOSED.toString())+
+ stateCount.get(CLOSED.toString())+
+ stateCount.get(DELETING.toString())+
Review comment:
Nit: Can this be converted to a loop over all states summing individual
values? That way if a new state is introduced, no further change in counting
totals will be required.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]