sys.json
sys.json copied to clipboard
standardizing on an existing lib
What do you think about standardizing on https://github.com/c9s/goprocinfo? It duplicates a lot of the stats you're gathering plus some additional ones and a lot of it is already tested. That'd knock out a couple things from the to do list (standardizing the api + some of the testing).
I did notice though that its disk stats aren't as detailed as sysjson's.
I suggest sys.json
should use a more modular system. Maybe something like this:
- plugin: which is OS depedent, contributor can collect stats data with their own way
- plugin registry: something like the modules table
- stat collector: plugin should return something like [TextMarshaler[(http://golang.org/pkg/encoding/#TextMarshaler) (or something is at least JSON renderable),which the encoder can render the results (maybe with nested struct, just like the
loadModule
) - encoder: which can render the plugin result into other form with specify ways (like JSON over HTTP, JSON over stream)
Of course, this may seems overwhelming for a toy project. :D
Interesting. I'll probably take a closer look at this over the weekend.