sindresorhus/speed-test

Feature request: Add a timestamp in the JSON output

gnud opened this issue · 6 comments

gnud commented

It would be lovely if you introduce a timestamp in the JSON output, so that if I probe with this app every few minutes I would know the probe time.

For the moment I need to transform the JSON output each time the app completes, or if we can have append custom object application arguments with data generated from somewhere else.
E.g:
speed-test -v -j -d '{"ts": "fdffd", "hostname": "pc1"}'

that way you don't have to change a lot, just at the end of the result generation to merge the arguments object.

Thanks.

Doesn't seem like adding a timestamp will help you much though since it seems you'll need to add other things to the JSON too. It would probably be easier for you to use something like https://stedolan.github.io/jq/

gnud commented

By adding the timestamp on a fork, works as planned.

My goal was, when it starts the Speedtest probing to record the start time, then I process the output to monitoring software, visualizing the data metrics by download/upload per minute.

Here is a fork as reference: https://github.com/gnud/speed-test

If you approve the changes I can open a PR.

Yeah, looks good. PR welcome.

If anyone wants to work on this, see the initial attempt and feedback in #67.

Hello @sindresorhus, This is my first time doing Open Source and I would like to start helping with this issue, I have read #67 as you suggested and the source code, the documentation about this timestamp could be added in the section Usage in the README file as part of the Options or only as a note that --json adds a timestamp?

gnud commented

@danodlr since I can't allocate any time at the moment, please finish it.