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

feat(outputs.mqtt): Add option to specify topic layouts #12697

Merged
merged 6 commits into from
Feb 28, 2023

Conversation

srebhan
Copy link
Contributor

@srebhan srebhan commented Feb 16, 2023

resolves #12589
resolves #10732

This PR adds a new layout option to specify how topics are generated from metrics. While preserving the original batch and non-batch options (rendering batch deprecated), the PR adds two new options, field and homie-v4. The field layout will generate one topic per metric field only containing the field value in string format (solving #10732). The homie-v4 layout allows to output metrics in topics adhering to the Homie v4.0 specification, a standard used for M2M and home-automation purposes.

@telegraf-tiger telegraf-tiger bot added area/mqtt feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Feb 16, 2023
@srebhan
Copy link
Contributor Author

srebhan commented Feb 16, 2023

Based on #12683 and thus marked as draft for now.

@fietser28
Copy link

@srebhan I probably won't have time to setup a test for this the coming week. From the documentation it looks like this will solve my problem in my specific case (single task creating multiple fields that can be translated to separate mqtt topics).

@srebhan
Copy link
Contributor Author

srebhan commented Feb 22, 2023

Ok. Let me know if you were able to really test this.

@srebhan srebhan marked this pull request as ready for review February 22, 2023 17:50
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 22, 2023
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

couple inline questions, otherwise this looks good to go! Thanks!

plugins/outputs/mqtt/README.md Outdated Show resolved Hide resolved
plugins/outputs/mqtt/homie.go Outdated Show resolved Hide resolved
@telegraf-tiger
Copy link
Contributor

@powersj powersj merged commit 6e3af9d into influxdata:master Feb 28, 2023
@srebhan srebhan added this to the v1.26.0 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mqtt feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MQTT.output format optimization Extend MQTT output topic formatting options
3 participants