Skip to content

Commit

Permalink
Merge pull request #22 from ton31337/Fix/move_queue_check_outside
Browse files Browse the repository at this point in the history
Move regexp check outside if for queueMetricsCounter
  • Loading branch information
kbudde authored Nov 19, 2016
2 parents b7ade0b + ce59dbb commit cfe83fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ func (e *exporter) fetchRabbit(ch chan<- prometheus.Metric) {
}
for key, countvec := range e.queueMetricsCounter {
for _, queue := range rabbitMqQueueData {
if value, ok := queue.metrics[key]; ok {
if match, _ := regexp.MatchString(config.SkipQueues, strings.ToLower(queue.name)); !match {
if match, _ := regexp.MatchString(config.SkipQueues, strings.ToLower(queue.name)); !match {
if value, ok := queue.metrics[key]; ok {
log.WithFields(log.Fields{"vhost": queue.vhost, "queue": queue.name, "key": key, "value": value}).Debug("Set queue metric for key")
ch <- prometheus.MustNewConstMetric(countvec, prometheus.CounterValue, value, queue.vhost, queue.name)
} else {
ch <- prometheus.MustNewConstMetric(countvec, prometheus.CounterValue, 0, queue.vhost, queue.name)
}
} else {
ch <- prometheus.MustNewConstMetric(countvec, prometheus.CounterValue, 0, queue.vhost, queue.name)
}
}
}
Expand Down

0 comments on commit cfe83fd

Please sign in to comment.