Previously the leadership changed metric was incremented every time a group leader was updated with the new leader or the leader was currently unknown. Technically the change from leader to no leader is a leadership change but it was confusing to users.
Change the metric updates to only account the changes when leader is present. This way after each successful leader election the metric is incremented by one on all partition replicas.
Backports Required
[ ] none - not a bug fix
[ ] none - this is a backport
[ ] none - issue does not exist in previous branches
[ ] none - papercut/not impactful enough to backport
Previously the leadership changed metric was incremented every time a group leader was updated with the new leader or the leader was currently unknown. Technically the change from leader to no leader is a leadership change but it was confusing to users.
Change the metric updates to only account the changes when leader is present. This way after each successful leader election the metric is incremented by one on all partition replicas.
Backports Required
Release Notes
Improvements
vectorized_raft_leadership_changes_total
metric