ctop icon indicating copy to clipboard operation
ctop copied to clipboard

add 'uptime ' to main view

Open storytime opened this issue 6 years ago • 5 comments

storytime avatar Jul 03 '18 09:07 storytime

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:

sabrehagen avatar Nov 06 '18 03:11 sabrehagen

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?

stokito avatar Oct 26 '20 13:10 stokito

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 avatar Oct 26 '20 14:10 stokito

@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 avatar Nov 30 '22 05:11 timwsuqld

@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

stokito avatar Nov 30 '22 08:11 stokito