chore: Remove whitespace, update variable naming (#13952)
This commit is contained in:
parent
c65340ac7a
commit
ac4cb12db8
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = []
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue