sindresorhus / speed-test

Test your internet connection speed and ping using speedtest.net from the CLI
MIT License
3.91k stars 164 forks source link

Feature request: Add a timestamp in the JSON output #66

Open gnud opened 4 years ago

gnud commented 4 years ago

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.

sindresorhus commented 4 years ago

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 4 years ago

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.

sindresorhus commented 4 years ago

Yeah, looks good. PR welcome.

sindresorhus commented 3 years ago

If anyone wants to work on this, see the initial attempt and feedback in https://github.com/sindresorhus/speed-test/pull/67.

danodlr commented 2 years ago

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 2 years ago

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