-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
runtime/metrics: add goroutine state counts, total goroutines created, total threads #15490
Comments
You can get all of these statistics by parsing the tracing output from
runtime/trace.
|
@minux, while true, runtime/trace seems like a pretty high overhead way to collect what amounts to a fairly small amount of information. It's certainly low overhead for what it does, but what it does is much more than what's needed here. The metrics @deft-code wants are primarily intended for continuous monitoring (based on offline conversations), so it needs to be cheap. |
Here are the notes on the desired metrics I had from our meeting a while ago: Ring buffer of sampled duration between entering and exiting runnable state
Four global stats
Maybe current number of running goroutines |
Assigning to @aclements to decide what we're willing to support long-term. |
Ping @aclements |
Still up to @aclements. |
Ping @aclements. Can you look at this during the release candidate quiet? |
@deft-code, do the specific stats I suggested in #15490 (comment) address your needs? |
Sorry, I'd lost track of the fact that there was a concrete proposal doc for this: https://github.com/deft-code/proposal/blob/master/design/15490-schedstats.md @deft-code, could you mail a CL to add this to the go-proposal repository and, once submitted, edit your first post to link to it? Thanks. |
I'll get on top of it. |
Thanks! |
CL https://golang.org/cl/38180 mentions this issue. |
Do we need to keep this issue open, or should we accept it? |
There's definitely still work to do on how and what exactly the API should expose, but I think it's pretty clear we need to provide some visibility into the scheduler. |
Teams inside Google are patching in CL 38180 and getting some experience with it. If others would like to do the same, please do. We'll probably wait until Go 1.10 to decide to add the API officially. Putting the proposal on hold until then. |
If someone would like to take a stab at implementing this, please be my guest. Otherwise, I'll get to it next cycle. |
@mknyszek Thanks. Should we keep this issue open and retarget to runtime/metrics? Or should we open a new proposal? |
We can keep this issue open and retarget it. I'll update the header and such. |
This proposal has been added to the active column of the proposals project |
Retitled based on #15490 (comment). Have all concerns about this proposal been addressed? |
Yeah, I believe all concerns are addressed. |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. 🎉 |
As for what these metrics should be named, perhaps:
The goroutine state metrics come from https://go-review.googlesource.com/c/go/+/38180/9/src/runtime/pstats.go#18. I figure we can reuse most of that implementation. |
|
This issue is currently labeled as early-in-cycle for Go 1.22. |
This issue is currently labeled as early-in-cycle for Go 1.23. |
Too late for 1.23. |
This issue is currently labeled as early-in-cycle for Go 1.24. |
Update, Jun 7 2023: runtime/metrics now exists, but there are a few metrics in the draft CL here that aren't yet exposed. See #15490 (comment).
MemStats provides a way to monitor allocation and garbage collection.
We need a similar facility to monitor the Scheduler.
Briefly:
The text was updated successfully, but these errors were encountered: