danielqsj / kafka_exporter

Kafka exporter for Prometheus
Apache License 2.0
2.22k stars 618 forks source link

Handle Azure Eventhubs returns list duplicated servers #448

Closed nqminhdl closed 4 months ago

nqminhdl commented 4 months ago

I'm using kafka-exporter to monitor Azure Event Hubs and connect successfully with below flags

./kafka_exporter \
    --kafka.server='<eventhub-namespace>.servicebus.windows.net:9093' \
    --sasl.enabled \
    --sasl.mechanism='plain' \
    --sasl.username='$ConnectionString' \
    --sasl.password='Endpoint=sb://<eventhub-namespace>.servicebus.windows.net/;SharedAccessKeyName=<redacted>;SharedAccessKey=<redacted>=' \
    --tls.enabled \
    --tls.insecure-skip-tls-verify \
    --log.level=debug \
    --verbosity=1 \
    --kafka.version=1.0.0

With latest release 1.7.0, I have the same issue as described in this issue https://github.com/danielqsj/kafka_exporter/issues/349

collected metric "kafka_consumergroup_members" { label:<name:"consumergroup" value:"delivery-*" > gauge:<value:2 > } was collected before with the same name and label values
collected metric "kafka_consumergroup_members" { label:<name:"consumergroup" value:"cashier-*" > gauge:<value:2 > } was collected before with the same name and label values
collected metric "kafka_consumergroup_members" { label:<name:"consumergroup" value:"delivery-*" > gauge:<value:2 > } was collected before with the same name and label values

This PR is to handle the case for Azure Event Hubs returns new servers with different upper case characters after RefreshMetadata.

nqminhdl commented 4 months ago

Hi @danielqsj,

Can you help to review this PR? Thanks!

nqminhdl commented 4 months ago

Hi @danielqsj,

Can you help to review this PR? Thanks!

danielqsj commented 4 months ago

LGTM,thanks @nqminhdl