Skip to content

Commit 139477b

Browse files
committed
Comment out consumerGroupMembers metric which is causing exporter instability
1 parent e8cd9a9 commit 139477b

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

.promu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repository:
2-
path: github.com/danielqsj/kafka_exporter
2+
path: github.com/mr-yum/kafka_exporter
33
build:
44
flags: -a -tags netgo
55
ldflags: |

Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
FROM quay.io/prometheus/busybox:latest
2-
MAINTAINER Daniel Qian <[email protected]>
32

43
ARG TARGETARCH
5-
ARG BIN_DIR=.build/linux-${TARGETARCH}/
4+
ARG BIN_DIR=.build/linux-${TARGETARCH}
65

76
COPY ${BIN_DIR}/kafka_exporter /bin/kafka_exporter
87

Makefile

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
44

55
PREFIX ?= $(shell pwd)
66
BIN_DIR ?= $(shell pwd)
7-
DOCKER_IMAGE_NAME ?= kafka-exporter
7+
DOCKER_IMAGE_NAME ?= ghcr.io/mr-yum/kafka-exporter
88
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
99
TAG := $(shell echo `if [ "$(TRAVIS_BRANCH)" = "master" ] || [ "$(TRAVIS_BRANCH)" = "" ] ; then echo "latest"; else echo $(TRAVIS_BRANCH) ; fi`)
1010

@@ -45,13 +45,12 @@ tarball: promu
4545

4646
docker: build
4747
@echo ">> building docker image"
48-
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" --build-arg BIN_DIR=. .
48+
@docker build -t "$(DOCKER_IMAGE_NAME):latest" --build-arg BIN_DIR=. .
4949

5050
push: crossbuild
51-
@echo ">> building and pushing multi-arch docker images, $(DOCKER_USERNAME),$(DOCKER_IMAGE_NAME),$(TAG)"
52-
@docker login -u $(DOCKER_USERNAME) -p $(DOCKER_PASSWORD)
51+
@echo ">> building and pushing multi-arch docker images, mr-yum,$(DOCKER_IMAGE_NAME),latest"
5352
@docker buildx create --use
54-
@docker buildx build -t "$(DOCKER_USERNAME)/$(DOCKER_IMAGE_NAME):$(TAG)" \
53+
@docker buildx build -t "$(DOCKER_IMAGE_NAME):latest" \
5554
--output "$(PUSHTAG)" \
5655
--platform "$(DOCKER_PLATFORMS)" \
5756
.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/danielqsj/kafka_exporter
1+
module github.com/mr-yum/kafka_exporter
22

33
go 1.17
44

kafka_exporter.go

+15-9
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ var (
5454
consumergroupLag *prometheus.Desc
5555
consumergroupLagSum *prometheus.Desc
5656
consumergroupLagZookeeper *prometheus.Desc
57-
consumergroupMembers *prometheus.Desc
57+
// TODO(adrian.arumugam): Hack to patch kafka_exporter to make it reliable ASAP while
58+
// a better upstream patch is figured out.
59+
//consumergroupMembers *prometheus.Desc
5860
)
5961

6062
// Exporter collects Kafka stats from the given server and exports them using
@@ -573,9 +575,11 @@ func (e *Exporter) collect(ch chan<- prometheus.Metric) {
573575
}
574576
}
575577
}
576-
ch <- prometheus.MustNewConstMetric(
577-
consumergroupMembers, prometheus.GaugeValue, float64(len(group.Members)), group.GroupId,
578-
)
578+
// TODO(adrian.arumugam): Hack to patch kafka_exporter to make it reliable ASAP while
579+
// a better upstream patch is figured out.
580+
//ch <- prometheus.MustNewConstMetric(
581+
// consumergroupMembers, prometheus.GaugeValue, float64(len(group.Members)), group.GroupId,
582+
//)
579583
offsetFetchResponse, err := broker.FetchOffset(&offsetFetchRequest)
580584
if err != nil {
581585
glog.Errorf("Cannot get offset of group %s: %v", group.GroupId, err)
@@ -855,11 +859,13 @@ func setup(
855859
[]string{"consumergroup", "topic"}, labels,
856860
)
857861

858-
consumergroupMembers = prometheus.NewDesc(
859-
prometheus.BuildFQName(namespace, "consumergroup", "members"),
860-
"Amount of members in a consumer group",
861-
[]string{"consumergroup"}, labels,
862-
)
862+
// TODO(adrian.arumugam): Hack to patch kafka_exporter to make it reliable ASAP while
863+
// a better upstream patch is figured out.
864+
// consumergroupMembers = prometheus.NewDesc(
865+
// prometheus.BuildFQName(namespace, "consumergroup", "members"),
866+
// "Amount of members in a consumer group",
867+
// []string{"consumergroup"}, labels,
868+
// )
863869

864870
if logSarama {
865871
sarama.Logger = log.New(os.Stdout, "[sarama] ", log.LstdFlags)

0 commit comments

Comments
 (0)