Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion kafka_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"time"

"github.com/Shopify/sarama"
kingpin "github.com/alecthomas/kingpin/v2"
"github.com/alecthomas/kingpin/v2"
"github.com/krallistic/kazoo-go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -342,13 +342,16 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
func (e *Exporter) collectChans(quit chan struct{}) {
original := make(chan prometheus.Metric)
container := make([]prometheus.Metric, 0, 100)
done := make(chan struct{})
go func() {
for metric := range original {
container = append(container, metric)
}
close(done)
}()
e.collect(original)
close(original)
<-done
// Lock to avoid modification on the channel slice
e.sgMutex.Lock()
for _, ch := range e.sgChans {
Expand Down