dombizita opened a new pull request, #3677:
URL: https://github.com/apache/ozone/pull/3677

   ## What changes were proposed in this pull request?
   
   The Last Leader Election and No. of Elections columns in the Pipelines page 
had incorrect or no data previously. This issue is caused by a few small 
things. These columns only have data, if any metrics service providers like 
Prometheus is configured, which is assumable from a 
[comment](https://github.com/apache/ozone/blob/64032cc223d314ac1e93558dc538663cec4a1a92/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/PipelineEndpoint.java#L108)
 in the code. I added a tooltip to these columns with this information and if 
no metrics service provider is configured in the cluster, the columns will show 
NA.
   
   If you configured Prometheus the No. of Elections had data, but the Last 
Leader Election didn't. This happened, because the Last Leader Election's 
metric name was incorrect. `lastLeaderElapsedTime` was added in this 
[RATIS-1049](https://issues.apache.org/jira/browse/RATIS-1049) to Ratis, but 
that seemed to be 0 for every case. I found `lastLeaderElectionElapsedTime` 
metric in Ratis which gave back the elapsed in milliseconds since a datanode 
was elected in a pipeline, so I used that. The method that queried the right 
metric from the provider didn't queried it correctly, as it always returned the 
first metric for each query. So I made two methods for each metric. For the No. 
of Elections I asked for a pipeline's all metrics, so I got as many metrics as 
many datanodes are in the pipeline. As each metric gives me how many times that 
datanode was elected in the pipeline, I summed up these. For the Last Leader 
Election I asked for the pipeline's leader node's value as that shows me how
  much time elapsed since that datanode was last elected in the pipeline.
   
   I also changed some examples in files as you need to add 
`http://prometheus:9090` (not localhost) if you want to add Prometheus's 
endpoint.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-7045
   
   ## How was this patch tested?
   
   I tested it locally in the `compose/ozone` environment with and without 
Prometheus configured.
   https://github.com/dombizita/ozone/actions/runs/2834395620


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to