Update docs to include configurable interval

This commit is contained in:
2024-04-16 22:21:46 +02:00
parent 9e9676d4e4
commit 98e79b927d
2 changed files with 14 additions and 5 deletions

View File

@@ -24,12 +24,21 @@ partition for this group.
## Start ## Start
```bash ```bash
docker run -ti --net="host" -e KAFKA_BROKERS=localhost:9093,localhost:9094,localhost:9095 -p 4000:4000 \ docker run -ti --net="host" -e KAFKA_BROKERS=redpanda:29092 -p 4000:4000 lechindianer/kafkaex_lag_exporter:0.2.0
lechindianer/kafkaex_lag_exporter:0.2.0
``` ```
Now you can check the exposed metrics at [http://localhost:4000](http://localhost:4000). Now you can check the exposed metrics at [http://localhost:4000](http://localhost:4000).
## Configuration
KafkaExLagExporter uses 5 seconds as default interval to update the lags. If you want to configure it to use another
value set `KAFKA_EX_INTERVAL_MS`, i.e.
```bash
docker run -ti --net="host" -e KAFKA_BROKERS=redpanda:29092 -e KAFKA_EX_INTERVAL_MS=10000 -p 4000:4000 \
lechindianer/kafkaex_lag_exporter:0.2.0
```
## Developing ## Developing
To start the project locally: To start the project locally:
@@ -38,11 +47,11 @@ To start the project locally:
KAFKA_BROKERS="localhost:9092" iex -S mix 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 There is also a Docker compose file included which will start Kafka, serve Kowl (Web UI for Kafka) and start
KafkaexLagExporter: KafkaexLagExporter:
```bash ```bash
docker-compose up --build docker compose up --build
``` ```
Kowl is served at [http://localhost:8080](http://localhost:8080). Kowl is served at [http://localhost:8080](http://localhost:8080).

View File

@@ -17,7 +17,7 @@ defmodule KafkaexLagExporter.ConsumerOffsetRunner do
endpoints = clients[:kafka_client][:endpoints] || [{"redpanda", 29_092}] endpoints = clients[:kafka_client][:endpoints] || [{"redpanda", 29_092}]
interval = interval =
System.get_env("KAFKA_EX_INTERVAL", "5000") System.get_env("KAFKA_EX_INTERVAL_MS", "5000")
|> String.to_integer() |> String.to_integer()
Logger.info("Reveived Kafka endpoints: #{inspect(endpoints)}") Logger.info("Reveived Kafka endpoints: #{inspect(endpoints)}")