You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/09/22 23:30:29 UTC

[GitHub] [kafka] niket-goel opened a new pull request, #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

niket-goel opened a new pull request, #12679:
URL: https://github.com/apache/kafka/pull/12679

   This commit adds KRaft monitoring related metrics to the Kafka docs (docs/ops.html).
   
   All metrics contained in the following classes have been added to the commit:
   ```
   BrokerServerMetrics
   QuorumControllerMetrics
   KafkaRaftMetrics
   ```
   
   KRaft related KIPs mention more metrics, but this commit only adds in the metrics available in the source code at the time of authoring.
   
   


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] hachikuji commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
hachikuji commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r979119104


##########
docs/ops.html:
##########
@@ -1815,6 +1815,206 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h4 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Monitoring Metrics</a></h4>
+The set of metrics that allow monitoring of the KRaft quorum and the metadata log.<br>
+Note: A Controller is defined as a Kafka Broker which has "controller" included among the <code>process.roles</code> config

Review Comment:
   How about this?
   
   > Note that some of the exposed metrics depend on the role of the node as defined by <code>process.roles</code>.



##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -246,7 +246,9 @@ public KafkaRaftClient(
             logContext,
             random);
         this.kafkaRaftMetrics = new KafkaRaftMetrics(metrics, "raft", quorum);
-        kafkaRaftMetrics.updateNumUnknownVoterConnections(quorum.remoteVoters().size());
+        // All Raft voters are statically configured and known at startup
+        // so there are no unknown voter connections. Report this metric as 0.
+        kafkaRaftMetrics.updateNumUnknownVoterConnections(0);

Review Comment:
   Perhaps we should file a jira to follow up with removal of this metric if it is not reporting anything useful. 



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] hachikuji commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
hachikuji commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r979099689


##########
docs/ops.html:
##########
@@ -1815,6 +1815,194 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h4 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Monitoring Metrics</a></h4>
+The set of metrics that allow monitoring of the KRaft quorum and the metadata log
+<h5 class="anchor-heading"><a id="kraft_controller_monitoring" class="anchor-link"></a><a href="#kraft_controller_monitoring">KRaft Controller Monitoring Metrics</a></h5>
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.server:type=raft-metrics,name=current-state</td>

Review Comment:
   I think the raft metrics are reported on both the controller and broker. We could either duplicate them or use a separate section as you suggested offline. 



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] niket-goel commented on pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
niket-goel commented on PR #12679:
URL: https://github.com/apache/kafka/pull/12679#issuecomment-1256592811

   @showuon Thanks for the careful feedback. I have updated the PR with the correct Mbean names and fixed many typos. Please take a look when you have a chance. 


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] niket-goel commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
niket-goel commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r979129298


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -246,7 +246,9 @@ public KafkaRaftClient(
             logContext,
             random);
         this.kafkaRaftMetrics = new KafkaRaftMetrics(metrics, "raft", quorum);
-        kafkaRaftMetrics.updateNumUnknownVoterConnections(quorum.remoteVoters().size());
+        // All Raft voters are statically configured and known at startup
+        // so there are no unknown voter connections. Report this metric as 0.
+        kafkaRaftMetrics.updateNumUnknownVoterConnections(0);

Review Comment:
   Yeah! Was planning on filing a JIRA and KIP for its removal. Will do that next week. :) 



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
showuon commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r978205767


##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>

Review Comment:
   Please correct the mbean name:
   `kafka.server:type=raft-metrics`
   And below. Thanks.



##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>
+  </tr>
+  <tr>
+    <td>Fetch Records</td>
+    <td>The average number of records fetched from the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=fetch-records</td>

Review Comment:
   `name: fetch-records-rate`
   Are your sure it is the avg number?



##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 

Review Comment:
   and [what?]



##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>
+  </tr>
+  <tr>
+    <td>Fetch Records</td>
+    <td>The average number of records fetched from the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=fetch-records</td>
+  </tr>
+  <tr>
+    <td>Append Records</td>
+    <td>The average number of records appended per sec as the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=append-records</td>
+  </tr>
+  <tr>
+    <td>Poll Idle Ratio</td>
+    <td>The average fraction of time the client's poll() is idle as opposed to waiting for the user code to process records.</td>
+    <td>kafka.raft:type=raft-metrics,name=poll-idle-ratio</td>

Review Comment:
   name=poll-idle-ratio-avg



##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>

Review Comment:
   The description of election latency is not clear to me. Maybe:
   `The time in milliseconds spent on electing a leader.`
   WDYT?



##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>

Review Comment:
   Also, there is no `election-latency` metrics, only
   `election-latency-avg`
   `election-latency-max`



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] niket-goel commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
niket-goel commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r978808028


##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 

Review Comment:
   Hmm.! how did that get deleted. Fixing it. Thanks for catching.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] hachikuji commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
hachikuji commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r979099254


##########
docs/ops.html:
##########
@@ -1815,6 +1815,194 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h4 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Monitoring Metrics</a></h4>
+The set of metrics that allow monitoring of the KRaft quorum and the metadata log
+<h5 class="anchor-heading"><a id="kraft_controller_monitoring" class="anchor-link"></a><a href="#kraft_controller_monitoring">KRaft Controller Monitoring Metrics</a></h5>

Review Comment:
   Do you think it's worth pointing out somewhere that a controller means any node which has "controller" included among `process.roles`?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] niket-goel commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
niket-goel commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r978165836


##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>
+  </tr>
+  <tr>
+    <td>Fetch Records</td>
+    <td>The average number of records fetched from the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=fetch-records</td>
+  </tr>
+  <tr>
+    <td>Append Records</td>
+    <td>The average number of records appended per sec as the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=append-records</td>
+  </tr>
+  <tr>
+    <td>Poll Idle Ratio</td>
+    <td>The average fraction of time the client's poll() is idle as opposed to waiting for the user code to process records.</td>
+    <td>kafka.raft:type=raft-metrics,name=poll-idle-ratio</td>
+  </tr>
+  <tr>
+    <td>Active Controller Count</td>
+    <td></td>

Review Comment:
   None of the metrics available in `QuorumControllerMetrics` have a description attached to them. I can write up descriptions for these, but want to make sure that they match up with any literature that we already have. I could not see mentions of these in the KIPs I looked at either. What would be the best course of action here?



##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>
+  </tr>
+  <tr>
+    <td>Fetch Records</td>
+    <td>The average number of records fetched from the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=fetch-records</td>
+  </tr>
+  <tr>
+    <td>Append Records</td>
+    <td>The average number of records appended per sec as the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=append-records</td>
+  </tr>
+  <tr>
+    <td>Poll Idle Ratio</td>
+    <td>The average fraction of time the client's poll() is idle as opposed to waiting for the user code to process records.</td>
+    <td>kafka.raft:type=raft-metrics,name=poll-idle-ratio</td>
+  </tr>
+  <tr>
+    <td>Active Controller Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=ActiveControllerCount</td>
+  </tr>
+  <tr>
+    <td>Event Queue Time Ms</td>
+    <td></td>
+    <td>kafka.controller:type=ControllerEventManager,name=EventQueueTimeMs</td>
+  </tr>
+  <tr>
+    <td>Event Queue Procesing Time Ms</td>
+    <td></td>
+    <td>kafka.controller:type=ControllerEventManager,name=EventQueueProcessingTimeMs</td>
+  </tr>
+  <tr>
+    <td>Fenced Broker Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=FencedBrokerCount</td>
+  </tr>
+  <tr>
+    <td>Active Broker Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=ActiveBrokerCount</td>
+  </tr>
+  <tr>
+    <td>Global Topic Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=GlobalTopicCount</td>
+  </tr>
+  <tr>
+    <td>Global Partition Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=GlobalPartitionCount</td>
+  </tr>
+  <tr>
+    <td>Offline Partitiion Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=OfflinePartitionCount</td>
+  </tr>
+  <tr>
+    <td>Preferred Replica Imbalace Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=PrefferedReplicaImbalanceCount</td>
+  </tr>
+  <tr>
+    <td>Metadata Error Count</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=MetadataErrorCount</td>
+  </tr>
+  <tr>
+    <td>Last Applied Record Offset</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=LastAppliedRecordOffset</td>
+  </tr>
+  <tr>
+    <td>Last Committed Record Offset</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=LastCommittedRecordOffset</td>
+  </tr>
+  <tr>
+    <td>Last Applied Record Timestamp</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=LastAppliedRecordTimestamp</td>
+  </tr>
+  <tr>
+    <td>Last Applied Record Lag Ms</td>
+    <td></td>
+    <td>kafka.controller:type=KafkaController,name=LastAppliedRecordLagMs</td>
+  </tr>
+  <tr>
+    <td>Last Applied Record Offset</td>
+    <td>The offset of the last record from the cluster metadata partition that was applied by the broker</td>
+    <td>kafka.server:type=broker-metadata-metrics,name=last-applied-record-offset</td>
+  </tr>
+  <tr>
+    <td>Last Applied Record Timestamp</td>
+    <td>The timestamp of the last record from the cluster metadata partition that was applied by the broker.</td>
+    <td>kafka.server:type=broker-metadata-metrics,name=last-applied-record-timestamp</td>
+  </tr>
+  <tr>
+    <td>Last Applied Record Lag Ms</td>
+    <td>The difference between now and the timestamp of the last record from the cluster metadata partition that was applied by the broker</td>
+    <td>kafka.server:type=broker-metadata-metrics,name=last-applied-record-lag-ms</td>
+  </tr>
+  <tr>
+    <td>Metadata Load Error Count</td>
+    <td>The number of errors encountered by the BrokerMetadataListener while loading the metadata log and generating a new MetadataDelta based on it.</td>
+    <td>kafka.server:type=broker-metadata-metrics,name=metadata-load-error-count</td>
+  </tr>
+  <tr>
+    <td>Metadata Apply Error Count</td>
+    <td>The number of errors encountered by the BrokerMetadataPublisher while applying a new MetadataImage based on the latest MetadataDelta.</td>
+    <td>kafka.server:type=broker-metadata-metrics,name=metadata-apply-error-count</td>
+  </tr>

Review Comment:
   Assuming this is the complete set of metrics, based on the files I went through. Please point out any files/KIPs that I should look at to add more metrics here.



##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>

Review Comment:
   Not sure if the type etc is correct here.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on pull request #12679: MINOR: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
showuon commented on PR #12679:
URL: https://github.com/apache/kafka/pull/12679#issuecomment-1257540453

   backport to v3.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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] niket-goel commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
niket-goel commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r978811373


##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>
+  </tr>
+  <tr>
+    <td>Fetch Records</td>
+    <td>The average number of records fetched from the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=fetch-records</td>
+  </tr>
+  <tr>
+    <td>Append Records</td>
+    <td>The average number of records appended per sec as the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=append-records</td>
+  </tr>
+  <tr>
+    <td>Poll Idle Ratio</td>
+    <td>The average fraction of time the client's poll() is idle as opposed to waiting for the user code to process records.</td>
+    <td>kafka.raft:type=raft-metrics,name=poll-idle-ratio</td>

Review Comment:
   ack! Will fix all metrics coming from this file.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] niket-goel commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
niket-goel commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r978810724


##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>

Review Comment:
   I was trying to remain true to the code. I agree that it is not the best description. Let me fix both.
   
   RE: the avg and max I think I made a mistake and picked up the sensor name instead of the metric name. this is tru for another few metrics here. Will fix all.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] niket-goel commented on a diff in pull request #12679: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
niket-goel commented on code in PR #12679:
URL: https://github.com/apache/kafka/pull/12679#discussion_r978811138


##########
docs/ops.html:
##########
@@ -1815,6 +1815,162 @@ <h4 class="anchor-heading"><a id="remote_jmx" class="anchor-link"></a><a href="#
       </tr>
   </tbody></table>
 
+<h5 class="anchor-heading"><a id="kraft_monitoring" class="anchor-link"></a><a href="#kraft_monitoring">KRaft Metrics</a></h5>
+All of the following metrics allow monitoring of the KRaft quourm and 
+<table class="data-table">
+  <tbody>
+  <tr>
+    <th>Metric/Attribute name</th>
+    <th>Description</th>
+    <th>Mbean name</th>
+  </tr>
+  <tr>
+    <td>Current State</td>
+    <td>The current state of this member; possible values are leader, candidate, voted, follower, unattached.</td>
+    <td>kafka.raft:type=raft-metrics,name=Current-state</td>
+  </tr>
+  <tr>
+    <td>Current Leader</td>
+    <td>The current quorum leader's id; -1 indicates unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-leader</td>
+  </tr>
+  <tr>
+    <td>Current Voted</td>
+    <td>The current voted leader's id; -1 indicates not voted for anyone.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-vote</td>
+  </tr>
+  <tr>
+    <td>Current Epoch</td>
+    <td>The current quorum epoch.</td>
+    <td>kafka.raft:type=raft-metrics,name=current-epoch</td>
+  </tr>
+  <tr>
+    <td>High Watermark</td>
+    <td>The high watermark maintained on this member; -1 if it is unknown.</td>
+    <td>kafka.raft:type=raft-metrics,name=high-watermark</td>
+  </tr>
+  <tr>
+    <td>Log End Offset</td>
+    <td>The current raft log end offset.</td>
+    <td>kafka.raft:type=raft-metrics,name=log-end-offset</td>
+  </tr>
+  <tr>
+    <td>Election Latency</td>
+    <td>The time in milliseconds to elect a new leader.</td>
+    <td>kafka.raft:type=raft-metrics,name=election-latency</td>
+  </tr>
+  <tr>
+    <td>Fetch Records</td>
+    <td>The average number of records fetched from the leader of the raft quorum.</td>
+    <td>kafka.raft:type=raft-metrics,name=fetch-records</td>

Review Comment:
   The description in code says that it is. Let me verify the value and update both of needed.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on pull request #12679: MINOR: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
showuon commented on PR #12679:
URL: https://github.com/apache/kafka/pull/12679#issuecomment-1257537908

   Failed tests are unrelated:
   ```
   Build / JDK 11 and Scala 2.13 / kafka.admin.LeaderElectionCommandTest.[1] Type=Raft-Distributed, Name=testPathToJsonFile, MetadataVersion=3.3-IV3, Security=PLAINTEXT
   ```


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon merged pull request #12679: MINOR: Adding KRaft Monitoring Related Metrics to docs/ops.html

Posted by GitBox <gi...@apache.org>.
showuon merged PR #12679:
URL: https://github.com/apache/kafka/pull/12679


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org