-
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
feat!: Add dynamic name prefix & suffix to reset metric name #13418
Conversation
Thanks so much for the pull request! |
!signed-cla |
@cavivie can you please file an issue and detail what problem you are trying to solve in more detail? Thanks |
@powersj In order to meet the situation discussed below, we provide a similar solution as follows from @sparrc :
Not only do we add and match prefixes, but we also want to remove this prefix from the output to maintain consistency with the input.
See discussions below:
This goal allow us to complete functions similar to |
adca5b8
to
af0ad3b
Compare
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
I asked for you to file an issue and instead you provided me a list of 4 closed issues, all explaining how it is possible to do today. The one remaining open issue proposed creating a namespace for each plugin to control the flow. However, the closed issues have comments about how and why this is not as straightforward as it seems. Without understanding why the current mechanism causes friction I am not inclined to add yet another way to do something. |
@powersj Thank you! I agree and know the truth behind this. I just want to complete routing through namepass/prefix/suffix and remove prefix/suffix when outputting. I know there are already many solutions, but this is the initial solution I came up with, but it cannot be implemented because prefix/suffix only has append but no restore function, which makes me have to give up this processing method. But if other solutions are used, one is ugly, and the other is unclear about the existence of namespaces. I think other solutions can meet the requirements, but they are not elegant enough. Anyway, we can close this PR. |
I don't disagree that they are not elegant ;) however, in order to maintain backwards compatibility a re-write isn't an option currently. Adding new options as I mentioned above, might be ok but we would really want to understand why we are doing that and ensure it makes sense before adding the additional maintenance burden. |
This feature adds dynamic name prefix and suffix to Telegraf. This PR was modified to improve that the name (prefix/suffix) value cannot restore the name prefix suffix.
Here is an example config below:
Keep the final output metric name is the name of the input, more routing metric exmaples:
Metrics are prefixed in the input, which is then used to select the output.
The metric name will be removed/overrode/appended in the outputs before writing.
Required for all PRs
resolves #