Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Fix topic label for Kafka metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Karge committed Mar 8, 2017
1 parent 9452edb commit 61fe000
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion amqp-to-kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func forwardToKafka(delivery amqp.Delivery, kafkaProducer Producer) (forwarded [
messageCounter.WithLabelValues("skipped").Inc()
} else {
forwarded = append(forwarded, delivery)
kafkaOffsets.WithLabelValues(strconv.FormatInt(int64(partition), 10)).Set(float64(offset))
kafkaOffsets.WithLabelValues(kafkaTopic, strconv.FormatInt(int64(partition), 10)).Set(float64(offset))
messageCounter.WithLabelValues("forwarded").Inc()
}
return
Expand Down
4 changes: 2 additions & 2 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
var messageCounter = prometheus.NewCounterVec(prometheus.CounterOpts{Name:"messages", Help: "Messages handled"}, []string{"state"})
var kafkaOffsets = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name:"kafka_offset", Help: "Last known Kafka offsets",
ConstLabels: prometheus.Labels{"topic": kafkaTopic, "direction": "produced"},
}, []string{"partition"})
ConstLabels: prometheus.Labels{"direction": "produced"},
}, []string{"topic", "partition"})

func startPrometheusHttpExporter() {
if metricsAddress == "" {
Expand Down
1 change: 0 additions & 1 deletion test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
environment:
- AMQP_URI=amqp://amqp
- AMQP_EXCHANGE=public
- AMQP_QUEUE=
- AMQP_BINDING_KEY=/messages
- AMQP_CONSUMER_TAG=my-tag
- KAFKA_BROKERS=kafka:9092
Expand Down

0 comments on commit 61fe000

Please sign in to comment.