ansemjo / speedtest-plotter

running scheduled speedtests inside docker and plotting the results with gnuplot
MIT License
59 stars 12 forks source link

Improvement on nan test results #127

Closed metricss closed 1 year ago

metricss commented 1 year ago

Occasionally, you may encounter "nan" test results. For instance, within my home network, it is not unusual to receive a "nan" result for a download test.

When there is a "nan" value, the plot becomes non-consecutive. In reality, it requires two consecutive successful test results to display a continuous line. I am curious if there is any room for improvement, such as disregarding "nan" test results to maintain the continuity of the trend line.

I appreciate your efforts, as your work is both elegant and extremely useful.

Screen shot for this issue: IMG_4871

ansemjo commented 1 year ago

Hey! Sorry, I've been on vacation a few days. 😊

Sure, that seems like an easy and useful fix! Could you provide me with a CSV file of the above timespan, so I can see what exactly the script needs to deal with? I've searched my own CSV dump with grep -i nan and found a few instances of -nan in the columns. Is that the string that you have for those measurements as well?

Aside from that it would be interesting to know why those NaN values occur at all. Have you checked the container logs for any output during any of the measurements? Did the SpeedTest binary print any errors?

metricss commented 1 year ago

Hi, I hope you enjoyed your vacation!

Thank you for your kind response.

Of course, I'm happy to provide the raw data! I've uploaded it to Pastebin: https://pastebin.com/raw/VuYWJKHS

The speedtest binary didn't produce any error logs. I checked the container logs, and when there's a NaN result for one test, the log appears “normal”, just as when there's a numerical result. I've also gathered some consecutive logs (no entries within the timeframe have been redacted), as shown here: https://pastebin.com/raw/6utPFfB5 (the speedtest runs at minute 42 of every hour)

I'm not sure why the speedtest might fail and produce a NaN result. Perhaps it would be helpful to run it in debug mode or specify a different speedtest server? If there's anything I can do to better figure it out, please let me know, and I'll be happy to help.

Hope you have a great day!

ansemjo commented 1 year ago

The fix was rather simple: I just told Gnuplot to treat anything that is not parseable as a number (which the string -nan certainly isn't) as "missing data". This way, the plotted lines are continuous.

- set datafile separator ","
+ set datafile separator "," missing NaN

Plots on some old data; before: before

.. and after: after