chore: Remove whitespace, update variable naming (#13952)

This commit is contained in:
Joshua Powers 2023-09-20 07:36:11 -06:00 committed by GitHub
parent c65340ac7a
commit ac4cb12db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -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"

View File

@ -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))
}
}
}

View File

@ -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 = []