We had some offline discussion about this, so let me summarize. - States as strings really doesn't play well with Grafana, Datadog, New Relic and whatever else people are using with Kafka.
- We might want to add more states in the future (like "never-unfenced", "post-controlled-shutdown", etc.) and that's harder to do if you don't have the states defined. - There is already some precedent for using numbers with the broker state metric So the numbers seem like the lesser evil, for now... best, Colin On Tue, Apr 15, 2025, at 07:41, José Armando García Sancio wrote: > Hi Colin and Kevin, > > On Mon, Apr 14, 2025 at 5:25 PM Colin McCabe <cmcc...@apache.org> wrote: >> How about something like this? >> 10 = fenced >> 20 = controlled shutdown >> 30 = active > > Very few users are going to know what these values mean. For example, > I see myself having to look up the code and KIP to remember these > values when monitoring clusters. > > Did you consider making the metric a string? Most monitoring systems > implement "group by" and count aggregation so users would be able to > count how many brokers are fenced if they need to count them. > > In the raft module we have a similar state metric. Check out the > current-state metric in KIP-595. The implementation of that metric is > in KafkaRaftMetrics#initialize. > > Thanks, > -- > -José