-
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
Weird behavior of json_v2 parser with multiple input lines and lots of decimal places #13805
Comments
This is not an issue with any input plugin, rather with the JSON v2 parser itself. The first version of telegraf I was able to reproduce with was v1.21.0, which introduce the object field/tags in #9449. Adding some debugging it appears that the parser is currently adding the kwh_export/o2 value twice. First, correctly as 0 and again as the kwh_import/o1 568.5 value. The parent node index that is used is somehow wrong. That results in the wrong rename getting used and the o2 value getting updated again and no o1 value. I believe this is all related to the indexing and lookups that happen, somewhere long the way they get off because of the previous values. Specifically, the call to |
Related: there have been incidents where simultaneously with errors in fields also tag values exctracted from the JSON have ended up with wrong tag names, but I am unable to repeat the behavior at the moment. The config involved both object field and object tag. Btw, there were two name objects in the JSON document, one at the top level and one as That problem (with tags) went away when replacing
with
|
If an extra
and included with json_v2.object path:
it ends up as kwh_import/o1 value in last line of output:
|
The problem here seems to be that parse results accumulate in Setting Could not replicate above behaviour with json_v2 tests with multiple inputs. Have seen it on |
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.27.3, Debian 12
Docker
No response
Steps to reproduce
./test-input.txt
as follows:telegraf --debug --config test-config.conf
./test-output.txt
Expected behavior
Each line of output should contain fields o1, o2, o3:
Actual behavior
Last line of output is missing field
o1
:Additional info
Number of decimals in freq field seems to have significance. If input is changed to:
The output is as expected.
Also, there need to be multiple lines before "freq":50 for the anomaly to occur.
Another workaround is to increase decimals for the last freq:
..producing:
The anomaly was first observed with AMQP, but it seems to be reproducible with the tail input plugin.
The text was updated successfully, but these errors were encountered: