-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Kafka Origin Topic tag. #5038
Conversation
@@ -256,7 +262,11 @@ func (k *Kafka) onMessage(acc telegraf.TrackingAccumulator, msg *sarama.Consumer | |||
if err != nil { | |||
return err | |||
} | |||
|
|||
if k.AddTopicTag { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be better to just check if the TopicTagName
is not empty and set it if so in order to prevent issues adding a blank tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along these lines, let's just have a single option that controls the topic tag. If it is empty, the default, don't add the tag:
## If set, add the topic with the given tagkey to all metrics.
## ex: topic_tag = "topic"
# topic_tag = ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick feedback, I've updated as requested; this way is a lot clearer and straight forward.
The Kafka consumer input plugin has already the ability to read from multiple topics, however it does not retain the topic which the data was read from. That data is very useful to introduce some smart routing down the line. The change adds the topic as a tag. The tag name is configurable. Added some basic tests, and tested on multiple kafka clusters.
The Kafka consumer input plugin has already the ability to
read from multiple topics, however it does not retain the
topic which the data was read from. That data is very useful
to introduce some smart routing down the line.
The change adds the topic as a tag. The tag name is configurable.
Added some basic tests, and tested on multiple kafka clusters.
Required for all PRs: