JSON_v2 parser error: fields or tags of one object may affect the contents or availability of another object #15892
Labels
bug
unexpected problem or unintended behavior
waiting for response
waiting for response from contributor
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.32.0-a0755797
Docker
No response
Steps to reproduce
./telegraf --once --config ./telegraf.conf
Expected behavior
Contents of metrics.prometheus file:
Actual behavior
Contents of metrics.prometheus file:
Additional info
The result of execution is affected by the offset within the parent element of the fields whose value must be found. With minimal change in input data, for example change the value from 3 to 30 the output result becomes correct.
Modified input data:
Contents of metrics.prometheus file:
Presumably the problem is that the subPathResults variable may contain the results of parsing several objects. Later, when calling the existsInpathResults function, the data of another object corresponding to the specified index may be returned. Although an empty result should have been returned.
In my opinion, a possible solution could be to reset the subPathResults variable inside the processObjects function at each iteration cycle of the objects variable.
Code snippet:
The text was updated successfully, but these errors were encountered: