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

processors.enum.mapping to be applied to multiple fields #10892

Closed
djvanhelmond opened this issue Mar 25, 2022 · 5 comments · May be fixed by #16030
Closed

processors.enum.mapping to be applied to multiple fields #10892

djvanhelmond opened this issue Mar 25, 2022 · 5 comments · May be fixed by #16030
Assignees
Labels
feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution plugin/processor size/m 2-4 day effort waiting for response waiting for response from contributor

Comments

@djvanhelmond
Copy link

Feature Request

Proposal:

Make the [processors.enum.mapping] applicable to multiple fields.

Current behavior:

I query a device that gives me json with 8 values that are either "on" or "off".
Currently I have to create an [processors.enum.mapping] per value.

[[processors.enum]]
[[processors.enum.mapping]]
field = "field_1"
[processors.enum.mapping.value_mappings]
off = 0
on = 1
[[processors.enum.mapping]]
field = "field_2"
[processors.enum.mapping.value_mappings]
off = 0
on = 1
etc.

Desired behavior:

[[processors.enum.mapping]]
field = ["field_1", "field_2"]
[processors.enum.mapping.value_mappings]
off = 0
on = 1

Use case:

It makes the telegraf config more readable and prevents discrepancies.

@djvanhelmond djvanhelmond added the feature request Requests for new plugin and for new features to existing plugins label Mar 25, 2022
@telegraf-tiger telegraf-tiger bot added the area/json json and json_v2 parser/serialiser related label Mar 25, 2022
@Hipska Hipska added plugin/processor and removed area/json json and json_v2 parser/serialiser related labels Mar 25, 2022
@reimda
Copy link
Contributor

reimda commented May 16, 2022

This makes sense to me. I think we should leave the field setting as a single string for backward compatibility, but we could a another setting called fields that takes an array of strings like you proposed.

@djvanhelmond Would you like to put together a PR to make this change?

@reimda reimda added the help wanted Request for community participation, code, contribution label May 16, 2022
@djvanhelmond
Copy link
Author

@reimda I appreciate the confidence, but I'm not nearly skilled enough to code something up in Go that would be remotely acceptable.

@DStrand1
Copy link
Member

Next steps: put up PR for multiple field mapping, deprecating the old config option

@DStrand1
Copy link
Member

Could you test if the artifacts in #16030 fix this issue? Thanks!

@srebhan srebhan added the waiting for response waiting for response from contributor label Oct 21, 2024
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Nov 5, 2024

Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Forums or provide additional details in this issue and reqeust that it be re-opened. Thank you!

@telegraf-tiger telegraf-tiger bot closed this as completed Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution plugin/processor size/m 2-4 day effort waiting for response waiting for response from contributor
Projects
None yet
6 participants