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

Enum documentation is incorrect when value is unknown and dest is set #6291

Closed
Woodz opened this issue Aug 21, 2019 · 0 comments · Fixed by #6301
Closed

Enum documentation is incorrect when value is unknown and dest is set #6291

Woodz opened this issue Aug 21, 2019 · 0 comments · Fixed by #6301
Labels
bug unexpected problem or unintended behavior docs Issues related to Telegraf documentation and configuration descriptions
Milestone

Comments

@Woodz
Copy link
Contributor

Woodz commented Aug 21, 2019

The documentation for the default value reads Default value to be used for all values not contained in the mapping table. When unset, the unmodified value for the field will be used if no match is found.

However, if default value is unset and dest is set, the unmodified value is not used - the dest field is missing.

Version: 0a4d74c

Reproducible:

Configuration:

[[processors.enum]]
[[processors.enum.mapping]]
## Name of the field to map
field = "status"
## Name of the tag to map
# tag = "status"
## Destination tag or field to be used for the mapped value. By default the 
## source tag or field is used, overwriting the original value.
dest = "status_code"
## Default value to be used for all values not contained in the mapping
## table. When unset, the unmodified value for the field will be used if no
## match is found.
# default = 0
## Table of mappings
[processors.enum.mapping.value_mappings]
green = 1
amber = 2
red = 3 

Expected (based on doc):

- xyzzy status="black" 1502489900000000000
+ xyzzy status="black",status_code="black" 1502489900000000000

Actual:

- xyzzy status="black" 1502489900000000000
+ xyzzy status="black" 1502489900000000000

Now, I don't think the expected is sensible, but there is no unit test to show the correct expected behaviour, but my recommendation would be to correct the documentation and add a unit test to match the current implementation.

@danielnelson danielnelson added bug unexpected problem or unintended behavior docs Issues related to Telegraf documentation and configuration descriptions labels Aug 23, 2019
@danielnelson danielnelson added this to the 1.13.0 milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior docs Issues related to Telegraf documentation and configuration descriptions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants