Skip to content
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 topic_tag option to mqtt_consumer #6266

Merged
merged 1 commit into from
Aug 20, 2019
Merged

Add topic_tag option to mqtt_consumer #6266

merged 1 commit into from
Aug 20, 2019

Conversation

danielnelson
Copy link
Contributor

@danielnelson danielnelson commented Aug 15, 2019

Add a new option topic_tag to the mqtt_consumer input. When unset the default is topic in order to preserve backwards compatibility, when set to "" no topic tag is added, otherwise the value is used for the topic tag. This is the basic pattern I would like to use for all inputs with parsers and want to add metadata.

In 2.0 we should change the default to not add the topic tag. We don't have a mechanism for changing the defaults yet, this is something that needs a plan.

closes: #6262

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@danielnelson danielnelson added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Aug 15, 2019
@danielnelson danielnelson added this to the 1.12.0 milestone Aug 15, 2019
@@ -18,6 +18,10 @@ and creates metrics using one of the supported [input data formats][].
"sensors/#",
]

## The message topic will be stored in a tag specified by this value. If set
## to the empty string no topic tag will be created.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/to the empty string/to an empty string,/ reads better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is only one empty string, generally referred to as the empty string. Check out the usage here: https://en.wikipedia.org/wiki/Empty_string

@danielnelson danielnelson merged commit 92385a4 into master Aug 20, 2019
@danielnelson danielnelson deleted the mqtt-topic-tag branch August 20, 2019 02:05
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Including the MQTT topic as tag or not
2 participants