[improve][broker] Add consumer_address label to per-consumer Prometheus metrics#26102
[improve][broker] Add consumer_address label to per-consumer Prometheus metrics#26102Dream95 wants to merge 2 commits into
Conversation
…us metrics Signed-off-by: Dream95 <zhou_8621@163.com>
|
I’m concerned about adding |
How about just exposing the IP? IPs don't usually change on reconnect. And in large clusters, duplicate IDs are way more likely, so an FQN really becomes a must. |
…metheus label Signed-off-by: Dream95 <zhou_8621@163.com>
Main Issue: #24322
Motivation
Per-consumer metrics only have consumer_name and consumer_id as labels.
Trouble is, consumer_id isn't globally unique — it's assigned per connection and gets reused.
If consumer_name is empty and consumer_id happens to collide, Prometheus can't tell consumers apart. This is probably the reason for the duplicate samples in #24322.
Modifications
consumer_addresslabel to per-consumer Prometheus metrics inTopicStats.writeConsumerMetric(), using the same client source address and port already exposed in consumer stats (consumer.getClientAddressAndPort()).Verifying this change
(Please pick either of the following options)
This change is already covered by existing tests, such as (please describe tests).
PrometheusMetricsTest.testPerConsumerStats()— verifiesconsumer_addressis present on consumer-level metrics and absent on subscription-level metrics, and that the value matches admin topic statsDoes this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes