kafka_exporter

package module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 11 Imported by: 0

README

kafka_exporter

Kafka high-level Prometheus metrics exporter. For low-level metrics take a look at jmx_exporter.

This exporter supports multiple, namely kafka-go and confluent-kafka-go. kafka-go has more features and does not require CGO, hence, it's recommended. All releases and Docker images do not support Confluent client. If you want to use it, please build from the source.

Metrics

Below you can find a list of supported metrics. Metrics support is different per client and subject to change in the future.

Brokers
Name Description Clients
kafka_brokers_total A number of brokers in a cluster. ✅ segment ✅ confluent
Topics
Name Description Clients
kafka_topic_partitions_total A number of partitions for a topic. ✅ segment ✅ confluent
kafka_topic_partition_leader Leader's broker Name of a topic at a partition. ✅ segment ✅ confluent
kafka_topic_partition_current_offset A current offset of a topic at a partition. ✅ segment ❌ confluent
kafka_topic_partition_oldest_offset An oldest offset of a topic at a partition. ✅ segment ❌ confluent
kafka_topic_partition_replicas_total A number of replicas of a topic at a partition. ✅ segment ✅ confluent
kafka_topic_partition_in_sync_replicas_total A number of in-sync replicas of a topic at a partition. ✅ segment ✅ confluent
Consumer groups
Name Description Clients
kafka_consumer_groups_total A number of consumer groups. ✅ segment ❌ confluent
kafka_consumer_group_current_offset A current offset of a consumer group for a topic and partition. ✅ segment ❌ confluent

Usage

Usually, you will run kafka_exporter as a docker container and connect it to your Kafka cluster.

The public Docker image is available on Docker Hub.

Alternatively, you can use a binary directly. Check out Building > Binary and run kafka_exporter -h or go run ./cmd/kafka_exporter -h in order to display all available flags.

In the case you want to test it locally, we recommend using docker-compose up -d --build and opening http://localhost:9150 in the browser.

Building

Docker
$ docker build -t kafka_exporter .
Binary
$ go build -o kafka_exporter ./cmd/kafka_exporter

This project was inspired by github.com/danielqsj/kafka_exporter. The main difference is that it supports many Kafka clients.

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(metricsPath, addr string) error

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

func NewCollector

func NewCollector(client KafkaClient) *Collector

func (*Collector) Collect

func (e *Collector) Collect(ch chan<- prometheus.Metric)

func (*Collector) Describe

func (e *Collector) Describe(ch chan<- *prometheus.Desc)

type KafkaClient

type KafkaClient interface {
	Brokers(ctx context.Context) ([]types.Broker, error)
	Topics(ctx context.Context) ([]types.Topic, error)
	Offsets(ctx context.Context) ([]types.Offset, error)
	ConsumerGroups(ctx context.Context) ([]types.ConsumerGroup, error)
	OffsetsForConsumerGroups(ctx context.Context) ([]types.Offset, error)
}

Directories

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL