ctop
ctop copied to clipboard
add 'uptime ' to main view
One of the main metrics I use for judging a container is how long it has been running. This feature would be super useful to me if it's trivial to implement :1st_place_medal:
There is a lot of info that may be retrieved from container but we should try to show only most important information. It's not so complicated to add a new column. Why is uptime is so important? From docker inspect we can see more details:
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 0,
"Error": "",
"StartedAt": "2018-08-02T10:16:49.187187456Z",
"FinishedAt": "2018-08-02T10:16:58.27795818Z"
}
So to get uptime we need to count duration from StartedAt
to FinishedAt
. Maybe instead of uptime you just need this two columns?
I created a pull request but please note that it will show uptime on the moment of last refresh. Please try to test my PR and leave your throughths and opinions.
@stokito how often does that refresh happen? My uptime is stuck on the uptime when ctop was launched. CPU/Memory etc all refresh every second, uptime is stale
@timwsuqld as far I remember the uptime is just taken from docker ps
output. E.g. it's not refreshed by the ctop. This makes it simple but yes, may be misleading if your top is open for long