-
Notifications
You must be signed in to change notification settings - Fork 887
feat(cli): add coder stat
command
#8005
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
Conversation
…acted out the filesystem
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.
- In the style of v1, I think we should show percentages alongside the resource values
- To make room for percentages and reduce noise, I think we should show at most 3 levels of precision
So 246.5/251.4 GB
would be 246 / 251 GB (90%)
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.
Happy that you split a lot of this logic into its own package.
This is AWESOME! How does |
I'm in favour of percentages, agree with limiting precision up to a point. |
There's no difference from its perspective between running in a VM and running on a real piece of metal. |
Precision may not be the right word, I guess I just mean the number of numbers shown. |
The number of significant figures. I agree with showing 3 at max. for cores that can be limited to 2. |
// If the unit prefixes of the used and total values are different, | ||
// display the used value's prefix to avoid confusion. | ||
if usedPrefix != totalPrefix || totalDisplay == "" { | ||
_, _ = sb.WriteString(" ") | ||
_, _ = sb.WriteString(usedPrefix) | ||
_, _ = sb.WriteString(r.Unit) | ||
} |
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.
review: this means you will see output like 16.7 mcores/64 cores (0%)
or 1 B/100 TB (0%)
. I investigated scaling to use the same units, but this was non-trivial.
I don't have enough time today to give the code a good review
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.
Good job!
Is there more to be done after this PR? |
I was originally intending to update the templates and documentation separately, but eneded up doing it here. So, no. |
I synced with @johnstcn today. I'm going to merge this PR. |
Adds a
coder stat
command that emits resource information about the current workspace host or container.Usage in agent metadata:
What this looks like in practice:
Also updated docs and sample docker/kubernetes templates with example usage.
Open question: would it make sense to break thestat
command into individual sub-commands (coder stat cpu
,coder stat container_mem
)?Partially repairsFixes #7076