xBis7 opened a new pull request, #4140: URL: https://github.com/apache/ozone/pull/4140
## What changes were proposed in this pull request? Ratis roles are created as part of the OMMXBean class which makes them available only for `/jmx`. This information should be available for both `/jmx` and `/prom` endpoints of the OM. In order to make the `OmRatisRoles` string available for the `/prom` endpoint we can create a tag with it. We could add this tag in `OMMetrics` but tags can't be updated or changed after being created. As a workaround we created new metrics `OMHAMetrics` which we unregister and create everytime the OM list gets updated, so that the tag also gets updated. There will be a follow up PR, with a similar approach for the SCM. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-7721 ## How was this patch tested? A new test was added under `hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithData.java`. This patch was also tested manually in docker clusters for both HA and non-HA like so * in `/hadoop-ozone/dist/target/ozone-1.4.0-SNAPSHOT/compose/ozone` ``` ❯ docker-compose up --scale datanode=3 -d 0.0.0.0:9874/jmx { "name" : "Hadoop:service=OzoneManager,name=OMHAMetrics", "modelerType" : "OMHAMetrics", "tag.OMRoles" : "STANDALONE", "tag.Context" : "ozone", "tag.Hostname" : "711d2525c257", "NumOfOMNodes" : 1 }, 0.0.0.0:9874/prom # TYPE omha_metrics_num_of_om_nodes gauge omha_metrics_num_of_om_nodes{omroles="STANDALONE",context="ozone",hostname="711d2525c257"} 1 ``` * in `/hadoop-ozone/dist/target/ozone-1.4.0-SNAPSHOT/compose/ozone-ha` edit `docker-compose.yaml` and forward port 9874 for om1 ``` ports: - 9874:9874 - 9862 hostname: om1 command: ["ozone","om"] ``` edit `docker-config` and add ``` OZONE-SITE.XML_ozone.om.http-address=0.0.0.0:9874 ``` ``` ❯ docker-compose up --scale datanode=3 -d 0.0.0.0:9874/jmx { "name" : "Hadoop:service=OzoneManager,name=OMHAMetrics", "modelerType" : "OMHAMetrics", "tag.OMRoles" : " { HostName: om1 | Node-Id: om1 | Ratis-Port : 9872 | Role: FOLLOWER} { HostName: om2 | Node-Id: om2 | Ratis-Port : 9872 | Role: LEADER} { HostName: om3 | Node-Id: om3 | Ratis-Port : 9872 | Role: FOLLOWER} ", "tag.Context" : "ozone", "tag.Hostname" : "om1", "NumOfOMNodes" : 3 }, 0.0.0.0:9874/prom # TYPE omha_metrics_num_of_om_nodes gauge omha_metrics_num_of_om_nodes{omroles=" { HostName: om1 | Node-Id: om1 | Ratis-Port : 9872 | Role: FOLLOWER} { HostName: om2 | Node-Id: om2 | Ratis-Port : 9872 | Role: LEADER} { HostName: om3 | Node-Id: om3 | Ratis-Port : 9872 | Role: FOLLOWER} ",context="ozone",hostname="om1"} 3 ``` -- 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]
