-
Notifications
You must be signed in to change notification settings - Fork 14
Add service runtime statistics and table formatting framework #1299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
4f60230 to
9a26231
Compare
wkz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
Don't these changes depend on the addition of memory stats to initctl -j though?
Thanks!
Yes and no. The code handles it gracefully if those stats aren't there yet, so it won't break anything. I wrote it this way intentionally so we could merge this without waiting for the finit upgrade that adds the memory counters. Basically wanted to keep this decoupled from the buildroot update. |
|
@wkz Can we merge this in its current state? As I mentioned above, the fact that finit don't support mem counters yet should not break anything. |
Add statistics container to service model with memory usage, uptime, and restart count tracking. Updates YANG revision to 2025-12-02. Signed-off-by: Richard Alpe <richard@bit42.se>
Populate operational runtime statistics for services. Signed-off-by: Richard Alpe <richard@bit42.se>
Replace manual f-string formatting with SimpleTable/Column classes. This new "framework" handles ANSI colors and padding. Removing the hassle of manually calculating padding. You simply specify the header with max number of chars the data can be and if you want left/right padding and the "framework" calculates the padding for you. We use this new "framework" to pretty print the newly added services statistics. Signed-off-by: Richard Alpe <richard@bit42.se>
Signed-off-by: Richard Alpe <richard@bit42.se>
- Remove fixed lengths from Column class - Add dynamic width calculation to SimpleTable - Update service table to use new batched printing Signed-off-by: Richard Alpe <richard@bit42.se>
9a26231 to
faebf70
Compare
Description
Add service runtime statistics monitoring with memory usage, uptime, and restart counts. Includes a new SimpleTable framework for clean CLI formatting that handles ANSI colors correctly.
TODO
I realise now that I want to improve the SimpleTable() class to dynamically space columns based on added data. But I submit this as is because I don't want to risk leaving it dangling. Basically it works fine as it is but it can be improved (as always).
Checklist
Tick relevant boxes, this PR is-a or has-a: