jirwin / burrow_exporter

Prometheus exporter for burrow
Apache License 2.0
78 stars 68 forks source link

Add support for Burrow API v3 #9

Closed solsson closed 6 years ago

solsson commented 6 years ago

Extremely quick shot at https://github.com/jirwin/burrow_exporter/issues/8 to have something to scrape in https://github.com/Yolean/kubernetes-kafka/pull/125.

The only useful value in :8080/metrics after the initial commit is kafka_burrow_topic_partition_offset.

solsson commented 6 years ago

https://github.com/jirwin/burrow_exporter/pull/9/commits/63de27513c0f8607fbfc578837a4cf0f33e84f97 was done only to speed up image pull for the pod. I can revert that if the PR ever gets close to mergeable state.

solsson commented 6 years ago

With the fix above I get the following exports for a mini cluster:

# HELP kafka_burrow_partition_current_offset The latest offset commit on a partition as reported by burrow.
# TYPE kafka_burrow_partition_current_offset gauge
kafka_burrow_partition_current_offset{cluster="local",group="console-consumer-94138",partition="0",topic="test-produce-consume"} 54
# HELP kafka_burrow_partition_lag The lag of the latest offset commit on a partition as reported by burrow.
# TYPE kafka_burrow_partition_lag gauge
kafka_burrow_partition_lag{cluster="local",group="console-consumer-94138",partition="0",topic="test-produce-consume"} 0
# HELP kafka_burrow_partition_max_offset The log end offset on a partition as reported by burrow.
# TYPE kafka_burrow_partition_max_offset gauge
kafka_burrow_partition_max_offset{cluster="local",group="console-consumer-94138",partition="0",topic="test-produce-consume"} 0
# HELP kafka_burrow_topic_partition_offset The latest offset on a topic's partition as reported by burrow.
# TYPE kafka_burrow_topic_partition_offset gauge
kafka_burrow_topic_partition_offset{cluster="local",partition="0",topic="test-kafkacat"} 54
kafka_burrow_topic_partition_offset{cluster="local",partition="0",topic="test-produce-consume"} 54
kafka_burrow_topic_partition_offset{cluster="local",partition="6",topic="__consumer_offsets"} 110
# ... and so on
# HELP kafka_burrow_total_lag The total amount of lag for the consumer group as reported by burrow
# TYPE kafka_burrow_total_lag gauge
kafka_burrow_total_lag{cluster="local",group="console-consumer-94138"} 0

@VictorBHub does this look like an ok fix for #8 ?

I've built solsson/burrow-exporter:api-v3@sha256:dd690c04ae31c62e4d7d5398f24f368fb2c48046ec3ae68bbc7582c114819a7b and updated https://github.com/Yolean/kubernetes-kafka/pull/125

VictorBHub commented 6 years ago

looks great..

ercliou-zz commented 6 years ago

One small detail: I don't think this metric "maxoffset" exists anymore: https://github.com/jirwin/burrow_exporter/blob/master/burrow_exporter/exporter.go#L54

I haven't used v2, not sure what this metric means, but the Burrow wiki for v3 doesn't mention this metric. Also I've just tested on Burrow v3, it's not exposing this field.

(commenting this on another PR too, not sure which will be the final one)

jirwin commented 6 years ago

Does this break compatibility with the v2 api? I'd merge a change that didn't.

ercliou-zz commented 6 years ago

@jirwin Burrow broke backward compat when they went from v2 to v3 (the uri changed among other schema changes). This will break people using Burrow v2.

solsson commented 6 years ago

12 was merged. I've built solsson/burrow-exporter@sha256:379199629e22a25e140a391f0a52bb5e222e6a639ce2314d8a995d0eeecb6c3f from master (with https://github.com/jirwin/burrow_exporter/pull/9/commits/63de27513c0f8607fbfc578837a4cf0f33e84f97 though, for Yolean/kubernetes-kafka).