-
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
Add Kafka output plugin topic_suffix option #3196
Add Kafka output plugin topic_suffix option #3196
Conversation
…cs, based on the metric name or tags
37ad17e
to
6bbcfd8
Compare
6bbcfd8
to
96c6bdf
Compare
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.
Lets combine the tag and tags method using the tags method?
Should we have a separator between the topic and topic_suffix? Maybe rename key_separator
to just separator
?
plugins/outputs/kafka/kafka.go
Outdated
"": TOPIC_SUFFIX_METHOD_EMPTY, | ||
"measurement": TOPIC_SUFFIX_METHOD_MEASUREMENT, | ||
"tag": TOPIC_SUFFIX_METHOD_TAG, | ||
"tags": TOPIC_SUFFIX_METHOD_TAGS, | ||
} |
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.
I would remove the map/enums, they don't really buy us anything from a type safety point of view. You could just have a list of valid strings for validating the config file.
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.
You're probably right about having separator between topic and topic_suffix, I think that follows the principle of least astonishment, good catch.
Renamed key_separator to just separator also.
I'm not sure about maps/enums though, because they kinda make the code less error-prone, it's easier to make a typo in a string than in a constant name. We have testcases covering that though. (And I'm not familiar with commonly accepted practices in Go).
Pushed! Any other thoughts?
Add test for ValidateTopicSuffixMethod Remove k.Connect() from topic suffixes test
Modify existing testcases accordingly Add more testcases for topic names Modify README.md accordingly
Add ability to the Kafka output plugin to send data to different topics, based on the metric name or tags
Required for all PRs:
This addresses #3177