2023-07-26 23:10:18 +02:00
2024-04-16 22:11:50 +02:00
2024-04-14 21:22:20 +02:00
2023-07-15 23:54:35 +02:00
2022-02-20 22:47:48 +01:00
2023-07-26 07:40:31 +02:00
2024-04-16 22:16:44 +02:00
2024-03-10 23:01:36 +01:00
2024-03-10 23:04:31 +01:00
2024-03-28 19:05:59 +01:00
2024-03-28 19:05:59 +01:00
2024-04-16 08:09:41 +02:00

KafkaExLagExporter

This project will collect Kafka consumer lag and provide them via Prometheus.

Metrics

Prometheus is a standard way to represent metrics in a modern cross-platform manner. KafkaExLagExporter exposes several metrics as an HTTP endpoint that can be readily scraped by Prometheus.

kafka_consumergroup_group_topic_sum_lag

Labels: cluster_name, group, topic, consumer_id, member_host

The sum of the difference between the last produced offset and the last consumed offset of all partitions in this topic for this group.

kafka_consumergroup_group_lag

Labels: cluster_name, group, partition, topic, member_host, consumer_id

The difference between the last produced offset and the last consumed offset for this partition in this topic partition for this group.

Start

docker run -ti --net="host" -e KAFKA_BROKERS=localhost:9093,localhost:9094,localhost:9095 -p 4000:4000 \
  lechindianer/kafkaex_lag_exporter:0.2.0

Now you can check the exposed metrics at http://localhost:4000.

Developing

To start the project locally:

KAFKA_BROKERS="localhost:9092" iex -S mix 

There is also a docker-compose file included which will start Kafka, serve Kowl (Web UI for Kafka) and start KafkaexLagExporter:

docker-compose up --build

Kowl is served at http://localhost:8080.

Tests

MIX_ENV=test mix test --no-start

Code style

Don't forget to check credo for code violations:

mix credo

This project also leverages the use of typespecs in order to provide static code checking:

mix dialyzer

Source is on Gitlab.

The initial project Kafka Lag Exporter was a huge inspiration for me creating my first real Elixir project. Thank you!

Description
No description provided
Readme 170 KiB
Languages
Elixir 95.6%
Dockerfile 4.2%
Shell 0.2%