Juniper / fluent-plugin-udp-native-sensors

Apache License 2.0
5 stars 10 forks source link

Code Behaviour #8

Open damianoneill opened 5 years ago

damianoneill commented 5 years ago

Hi @gaddevijay when reviewing this code I couldnt understand what the following is suppose to be doing.

https://github.com/Juniper/fluent-plugin-udp-native-sensors/blob/master/lib/fluent/plugin/parser_juniper_udp_native.rb#L87

It looks like the loop checks the content to see if it is a hash, if its not it sets the value to the value in array element 0.

However it doesnt exit the loop so if there is more than one sensor value then the name is set to the first value, it keeps iterating and modifying the output based on the current loops value.

Can you review / confirm my understanding and let me know if this is an issue or not?

Thanks, Damian.

gaddevijay commented 5 years ago

@damianoneill you observation is correct. Ideally we should append the data.

This logic works as of today because in one packet we would receive data only from one sensor at time.