Fix publishing of direct exchange routing key (#5868)

This commit is contained in:
Daniel Nelson 2019-05-17 13:46:13 -07:00 committed by GitHub
parent d25fa3ced3
commit 5bb6e4603d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -12,7 +12,6 @@ import (
"github.com/influxdata/telegraf/internal/tls" "github.com/influxdata/telegraf/internal/tls"
"github.com/influxdata/telegraf/plugins/outputs" "github.com/influxdata/telegraf/plugins/outputs"
"github.com/influxdata/telegraf/plugins/serializers" "github.com/influxdata/telegraf/plugins/serializers"
"github.com/streadway/amqp" "github.com/streadway/amqp"
) )
@ -206,8 +205,8 @@ func (q *AMQP) routingKey(metric telegraf.Metric) string {
func (q *AMQP) Write(metrics []telegraf.Metric) error { func (q *AMQP) Write(metrics []telegraf.Metric) error {
batches := make(map[string][]telegraf.Metric) batches := make(map[string][]telegraf.Metric)
if q.ExchangeType == "direct" || q.ExchangeType == "header" { if q.ExchangeType == "header" {
// Since the routing_key is ignored for these exchange types send as a // Since the routing_key is ignored for this exchange type send as a
// single batch. // single batch.
batches[""] = metrics batches[""] = metrics
} else { } else {