Add uptime messages to control protocol GETINFO
I am helping to maintain a fleet of relays and intended to write a Prometheus exporter (that's a numerical time-series databases and monitoring system) in Python using stem in order to aggregate statistics from them, such as
traffic/written, from which I can then build pretty graphs and metrics visualization/analytics. I discovered that there was no way to get the uptime in the control protocol. My first approach was to parse the heartbeat message in the logs via Logstash, but that's not good enough.
This would very useful to have for sysadmins/SRE/DevOps to monitor their relays.
I have done the implementation which adds two new commands: 'uptime' (seconds) and 'uptime_str' (in the heartbeat format). They're in separate commits.
It's pushed up to this branch: https://github.com/ageis/tor/tree/control-getinfo-uptime
I also have the accompanying update to torspec: https://github.com/ageis/torspec/tree/control-getinfo-uptime
Please review and let me know what else I need to do in order to further this patch along. I actually couldn't find much information about your development/contribution processes.