-
Notifications
You must be signed in to change notification settings - Fork 488
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 templating for MQTT topics #2202
Conversation
This adds the ability to use templates when specifying the MQTT topic. This is much more useful than static topics since you can create topics like this: switches/{{ index .Tags "agent_host" }}/ports/{{ index .Tags "port_num" }}
69d6a6e
to
dc34e23
Compare
Is anyone looking at these? |
@nathanielc @aanthony1243 Can someone look at this? We are using this in production, but we prefer not to have to maintain a custom build of kapacitor. The static topics that kapacitor supports without this change are essentially useless. |
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.
This looks good, there are a few small things that need to change.
…template during handler construction.
@fhriley LGTM, can you fix the conflicts and then I can merge. |
Merge conflict resolved. |
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. I completely forgot but could you add a test for this? Should be as simple as copy pasting this test case here and then using a template as the topic and validating it works.
Test added. |
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!
This adds the ability to use templates when specifying the MQTT
topic. This is much more useful than static topics since you
can create topics like this:
switches/{{ index .Tags "agent_host" }}/ports/{{ index .Tags "port_num" }}
Required for all non-trivial PRs