diff --git a/plugins/inputs/kafka_consumer/README.md b/plugins/inputs/kafka_consumer/README.md index 6b5edd348..9474d0e66 100644 --- a/plugins/inputs/kafka_consumer/README.md +++ b/plugins/inputs/kafka_consumer/README.md @@ -43,11 +43,11 @@ to use them. ## Kafka brokers. brokers = ["localhost:9092"] - ## Set the minimal supported Kafka version. Should be a string contains + ## Set the minimal supported Kafka version. Should be a string contains ## 4 digits in case if it is 0 version and 3 digits for versions starting ## from 1.0.0 separated by dot. This setting enables the use of new ## Kafka features and APIs. Must be 0.10.2.0(used as default) or greater. - ## Please, check the list of supported versions at + ## Please, check the list of supported versions at ## https://pkg.go.dev/github.com/Shopify/sarama#SupportedVersions ## ex: kafka_version = "2.6.0" ## ex: kafka_version = "0.10.2.0" @@ -64,10 +64,10 @@ to use them. # topic_tag = "" ## The list of Kafka message headers that should be pass as metric tags - ## works only for Kafka version 0.11+, on lower versions the message headers + ## works only for Kafka version 0.11+, on lower versions the message headers ## are not available # msg_headers_to_tags = [] - + ## Optional Client id # client_id = "Telegraf" diff --git a/plugins/inputs/kafka_consumer/kafka_consumer.go b/plugins/inputs/kafka_consumer/kafka_consumer.go index 23aed9609..b43c021e6 100644 --- a/plugins/inputs/kafka_consumer/kafka_consumer.go +++ b/plugins/inputs/kafka_consumer/kafka_consumer.go @@ -488,15 +488,15 @@ func (h *ConsumerGroupHandler) Handle(session sarama.ConsumerGroupSession, msg * } // Check if any message header should be pass as tag - header_key := "" + headerKey := "" if len(h.MsgHeadersToTags) > 0 { for _, header := range msg.Headers { //convert to a string as the header and value are byte arrays. - header_key = string(header.Key) - if _, exists := h.MsgHeadersToTags[header_key]; exists { + headerKey = string(header.Key) + if _, exists := h.MsgHeadersToTags[headerKey]; exists { // If message header should be pass as tag then add it to the metrics for _, metric := range metrics { - metric.AddTag(header_key, string(header.Value)) + metric.AddTag(headerKey, string(header.Value)) } } } diff --git a/plugins/inputs/kafka_consumer/sample.conf b/plugins/inputs/kafka_consumer/sample.conf index 28fdb215a..1e460e2c3 100644 --- a/plugins/inputs/kafka_consumer/sample.conf +++ b/plugins/inputs/kafka_consumer/sample.conf @@ -3,11 +3,11 @@ ## Kafka brokers. brokers = ["localhost:9092"] - ## Set the minimal supported Kafka version. Should be a string contains + ## Set the minimal supported Kafka version. Should be a string contains ## 4 digits in case if it is 0 version and 3 digits for versions starting ## from 1.0.0 separated by dot. This setting enables the use of new ## Kafka features and APIs. Must be 0.10.2.0(used as default) or greater. - ## Please, check the list of supported versions at + ## Please, check the list of supported versions at ## https://pkg.go.dev/github.com/Shopify/sarama#SupportedVersions ## ex: kafka_version = "2.6.0" ## ex: kafka_version = "0.10.2.0" @@ -24,7 +24,7 @@ # topic_tag = "" ## The list of Kafka message headers that should be pass as metric tags - ## works only for Kafka version 0.11+, on lower versions the message headers + ## works only for Kafka version 0.11+, on lower versions the message headers ## are not available # msg_headers_to_tags = []