Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
foxdalas committed Feb 11, 2022
2 parents 08f957f + 6e14e80 commit 4b8cf7e
Show file tree
Hide file tree
Showing 26 changed files with 1,504 additions and 1,004 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.*
vendor
Dockerfile
Makefile
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ kafka_exporter

# Test configuration
test/
.DS_Store
10 changes: 5 additions & 5 deletions .promu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ repository:
build:
flags: -a -tags netgo
ldflags: |
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}}
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}}
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}}
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
-X github.com/prometheus/common/version.Branch={{.Branch}}
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
tarball:
files:
- LICENSE
19 changes: 14 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
sudo: required

services:
- docker

language: go

go:
- 1.9
- 1.17

env:
- GOFLAGS="-mod=readonly"

before_install:
- sudo rm -rf /var/lib/apt/lists/*
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- mkdir -vp ~/.docker/cli-plugins/
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.6.1/buildx-v0.6.1.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx

after_success:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
make docker;
make push;
fi
- if [[ -n "$TRAVIS_TAG" ]]; then
Expand Down
26 changes: 17 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ DOCKER_IMAGE_NAME ?= kafka-exporter
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
TAG := $(shell echo `if [ "$(TRAVIS_BRANCH)" = "master" ] || [ "$(TRAVIS_BRANCH)" = "" ] ; then echo "latest"; else echo $(TRAVIS_BRANCH) ; fi`)

PUSHTAG ?= type=registry,push=true
DOCKER_PLATFORMS ?= linux/amd64,linux/s390x,linux/arm64,linux/ppc64le

all: format build test

style:
Expand All @@ -28,25 +31,30 @@ vet:

build: promu
@echo ">> building binaries"
@$(GO) mod vendor
@$(PROMU) build --prefix $(PREFIX)


crossbuild: promu
@echo ">> crossbuilding binaries"
@$(PROMU) crossbuild
@$(PROMU) crossbuild --go=1.17

tarball: promu
@echo ">> building release tarball"
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)

docker:
docker: build
@echo ">> building docker image"
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" --build-arg BIN_DIR=. .

push:
@echo ">> pushing docker image, $(DOCKER_USERNAME),$(DOCKER_IMAGE_NAME),$(TAG)"
push: crossbuild
@echo ">> building and pushing multi-arch docker images, $(DOCKER_USERNAME),$(DOCKER_IMAGE_NAME),$(TAG)"
@docker login -u $(DOCKER_USERNAME) -p $(DOCKER_PASSWORD)
@docker tag "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_USERNAME)/$(DOCKER_IMAGE_NAME):$(TAG)"
@docker push "$(DOCKER_USERNAME)/$(DOCKER_IMAGE_NAME):$(TAG)"
@docker buildx create --use
@docker buildx build -t "$(DOCKER_USERNAME)/$(DOCKER_IMAGE_NAME):$(TAG)" \
--output "$(PUSHTAG)" \
--platform "$(DOCKER_PLATFORMS)" \
.

release: promu github-release
@echo ">> pushing binary to github with ghr"
Expand All @@ -56,11 +64,11 @@ release: promu github-release
promu:
@GOOS=$(shell uname -s | tr A-Z a-z) \
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) get -u github.com/prometheus/promu
$(GO) install github.com/prometheus/promu@v0.12.0

github-release:
@GOOS=$(shell uname -s | tr A-Z a-z) \
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) get -u github.com/aktau/github-release
$(GO) install github.com/github-release/github-release@v0.10.0

.PHONY: all style format build test vet tarball docker promu
72 changes: 50 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kafka_exporter
==============

[![Build Status](https://travis-ci.org/danielqsj/kafka_exporter.svg?branch=master)](https://travis-ci.org/danielqsj/kafka_exporter)[![Docker Pulls](https://img.shields.io/docker/pulls/danielqsj/kafka-exporter.svg)](https://hub.docker.com/r/danielqsj/kafka-exporter)[![Go Report Card](https://goreportcard.com/badge/github.com/danielqsj/kafka_exporter)](https://goreportcard.com/report/github.com/danielqsj/kafka_exporter)[![Language](https://img.shields.io/badge/language-Go-red.svg)](https://github.com/danielqsj/kafka-exporter)[![GitHub release](https://img.shields.io/badge/release-1.2.0-green.svg)](https://github.com/alibaba/derrick/releases)[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Build Status](https://app.travis-ci.com/danielqsj/kafka_exporter.svg?branch=master)](https://app.travis-ci.com/danielqsj/kafka_exporter)[![Docker Pulls](https://img.shields.io/docker/pulls/danielqsj/kafka-exporter.svg)](https://hub.docker.com/r/danielqsj/kafka-exporter)[![Go Report Card](https://goreportcard.com/badge/github.com/danielqsj/kafka_exporter)](https://goreportcard.com/report/github.com/danielqsj/kafka_exporter)[![Language](https://img.shields.io/badge/language-Go-red.svg)](https://github.com/danielqsj/kafka-exporter)[![GitHub release](https://img.shields.io/badge/release-1.4.2-green.svg)](https://github.com/alibaba/derrick/releases)[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)

Kafka exporter for Prometheus. For other metrics from Kafka, have a look at the [JMX exporter](https://github.com/prometheus/jmx_exporter).

Expand All @@ -23,7 +23,7 @@ Table of Contents
- [Brokers](#brokers)
- [Topics](#topics)
- [Consumer Groups](#consumer-groups)
- [Grafana Dashboard](#grafana-dashboard)
- [Grafana Dashboard](#grafana-dashboard)
- [Contribute](#contribute)
- [Donation](#donation)
- [License](#license)
Expand All @@ -39,7 +39,6 @@ Dependency
- [Prometheus](https://prometheus.io)
- [Sarama](https://shopify.github.io/sarama)
- [Golang](https://golang.org)
- [Dep](https://github.com/golang/dep)

Download
--------
Expand Down Expand Up @@ -90,25 +89,45 @@ Flags

This image is configurable using different flags

| Flag name | Default | Description |
| ---------------------------- | ---------- | --------------------------------------------------------------------------------------------------- |
| kafka.server | kafka:9092 | Addresses (host:port) of Kafka server |
| kafka.version | 1.0.0 | Kafka broker version |
| sasl.enabled | false | Connect using SASL/PLAIN |
| sasl.handshake | true | Only set this to false if using a non-Kafka SASL proxy |
| sasl.username | | SASL user name |
| sasl.password | | SASL user password |
| tls.enabled | false | Connect using TLS |
| tls.ca-file | | The optional certificate authority file for TLS client authentication |
| tls.cert-file | | The optional certificate file for client authentication |
| tls.key-file | | The optional key file for client authentication |
| tls.insecure-skip-tls-verify | false | If true, the server's certificate will not be checked for validity |
| topic.filter | .* | Regex that determines which topics to collect |
| group.filter | .* | Regex that determines which consumer groups to collect |
| web.listen-address | :9308 | Address to listen on for web interface and telemetry |
| web.telemetry-path | /metrics | Path under which to expose metrics |
| log.level | info | Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] |
| log.enable-sarama | false | Turn on Sarama logging |
| Flag name | Default | Description |
|------------------------------|----------------|----------------------------------------------------------------------------------------------------------------------------------------|
| kafka.server | kafka:9092 | Addresses (host:port) of Kafka server |
| kafka.version | 2.0.0 | Kafka broker version |
| sasl.enabled | false | Connect using SASL/PLAIN |
| sasl.handshake | true | Only set this to false if using a non-Kafka SASL proxy |
| sasl.username | | SASL user name |
| sasl.password | | SASL user password |
| sasl.mechanism | | SASL mechanism can be plain, scram-sha512, scram-sha256 |
| sasl.service-name | | Service name when using Kerberos Auth |
| sasl.kerberos-config-path | | Kerberos config path |
| sasl.realm | | Kerberos realm |
| sasl.keytab-path | | Kerberos keytab file path |
| sasl.kerberos-auth-type | | Kerberos auth type. Either 'keytabAuth' or 'userAuth' |
| tls.enabled | false | Connect to Kafka using TLS |
| tls.server-name | | Used to verify the hostname on the returned certificates unless tls.insecure-skip-tls-verify is given. The kafka server's name should be given |
| tls.ca-file | | The optional certificate authority file for Kafka TLS client authentication |
| tls.cert-file | | The optional certificate file for Kafka client authentication |
| tls.key-file | | The optional key file for Kafka client authentication |
| tls.insecure-skip-tls-verify | false | If true, the server's certificate will not be checked for validity |
| server.tls.enabled | false | Enable TLS for web server |
| server.tls.mutual-auth-enabled | false | Enable TLS client mutual authentication |
| server.tls.ca-file | | The certificate authority file for the web server |
| server.tls.cert-file | | The certificate file for the web server |
| server.tls.key-file | | The key file for the web server |
| topic.filter | .* | Regex that determines which topics to collect |
| group.filter | .* | Regex that determines which consumer groups to collect |
| web.listen-address | :9308 | Address to listen on for web interface and telemetry |
| web.telemetry-path | /metrics | Path under which to expose metrics |
| log.enable-sarama | false | Turn on Sarama logging |
| use.consumelag.zookeeper | false | if you need to use a group from zookeeper |
| zookeeper.server | localhost:2181 | Address (hosts) of zookeeper server |
| kafka.labels | | Kafka cluster name |
| refresh.metadata | 30s | Metadata refresh interval |
| offset.show-all | true | Whether show the offset/lag for all consumer group, otherwise, only show connected consumer groups |
| concurrent.enable | false | If true, all scrapes will trigger kafka operations otherwise, they will share results. WARN: This should be disabled on large clusters |
| topic.workers | 100 | Number of topic workers |
| verbosity | 0 | Verbosity log level |


### Notes

Expand Down Expand Up @@ -228,6 +247,15 @@ If you like Kafka Exporter, please give me a star. This will help more people kn

Please feel free to send me [pull requests](https://github.com/danielqsj/kafka_exporter/pulls).

Contributors ✨
----------

Thanks goes to these wonderful people:

<a href="https://github.com/danielqsj/kafka_exporter/graphs/contributors">
<img src="https://contrib.rocks/image?repo=danielqsj/kafka_exporter" />
</a>

Donation
--------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.4.2
22 changes: 22 additions & 0 deletions charts/kafka-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions charts/kafka-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: kafka-exporter
version: 1.2.0
home: https://github.com/abhishekjiitr/kafka-exporter-helm
maintainers:
- name: abhishekjiitr
email: abhi2254015@gmail.com
5 changes: 5 additions & 0 deletions charts/kafka-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1.To see the metrics
{{- if contains "ClusterIP" .Values.service.type }}
kubectl port-forward svc/{{ include "kafka-exporter.fullname" . }} {{ .Values.service.port }}
echo "Visit http://127.0.0.1:{{ .Values.service.port }} to use your application"
{{- end }}
32 changes: 32 additions & 0 deletions charts/kafka-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kafka-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kafka-exporter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kafka-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
Loading

0 comments on commit 4b8cf7e

Please sign in to comment.