-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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 GOMAXPROCS, NumCgoCall, GC CPU time #47216
Comments
cc @mknyszek |
Thanks for the suggestions! |
This proposal has been added to the active column of the proposals project |
ping @mknyszek. any new thoughts? |
Please consider exporting the total time spent perfoming GC as well ( |
@mpx I'm already ahead of you on that one. Total work time also seems fine to me, though it doesn't seem quite as useful without a "total CPU time" counter also (sample them together, take a diff to determine GC CPU utilization since the last sample). We could expose something like that, but measuring exact CPU time is unfortunately kind of tough. In the runtime we just make some assumptions that luckily hold true in 99% (maybe more) of cases. It might be useful to export those assumptions anyway, but I think the aforementioned distribution of GC CPU time is more directly useful for monitoring (and includes those assumptions, necessarily, anyway). Do you have another use-case for total time that I'm not considering? |
Hi all, thanks for the efforts you invest in that issue. As a telemetry consumer telemetry, we use external libraries to measure the total cpu usage of the process. I'm not sure that this is the right place to discuss it. What are the limitations of the solution you present? |
Alrighty, from this issue, I think we should add the following metrics:
I don't think there's any point to doing Any objections? |
Based on the discussion above, this proposal seems like a likely accept. |
@mknyszek For total GC time I'd like to compare it against Recording a histogram of GC times would be interesting, but I don't have a specific use for it atm. |
No change in consensus, so accepted. 🎉 |
Change https://go.dev/cl/404307 mentions this issue: |
Change https://go.dev/cl/404306 mentions this issue: |
Change https://go.dev/cl/404305 mentions this issue: |
For #47216. Change-Id: Ib2d48c4583570a2dae9510a52d4c6ffc20161b31 Reviewed-on: https://go-review.googlesource.com/c/go/+/404305 Reviewed-by: David Chase <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Michael Knyszek <[email protected]>
For #47216. Change-Id: I1c2cd518e6ff510cc3ac8d8f72fd52eadcabc16c Reviewed-on: https://go-review.googlesource.com/c/go/+/404306 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]> Run-TryBot: Michael Knyszek <[email protected]>
I got to everything except the GC CPU stats. To get that right it needs a little more thought and a little more implementation work that I just couldn't get to before the freeze. :( My apologies. It's about 80% done, so my hope is that I can land it early in the 1.20 cycle. |
OpenTelemetry-Go would like runtime/metrics access to GCCPUFraction -- however it would be better expressed as a total number of CPU seconds spent in GC for reasons explained here: open-telemetry/opentelemetry-go-contrib#316 and above I.e., it should have Cumulative=True, ValueKind=Float64, name=/gc/cpu/time:seconds However, to make that useful, we should also have the rusage number we're comparing to in the same snapshot, so metrics like /cpu/user/time:seconds and /cpu/sys/time:seconds containing the cumulative count of CPU seconds used. Then, the former GCCPUFraction would equal to the metric derived from (/gc/cpu:seconds / (/cpu/user:seconds + /cpu/sys:seconds)) or something like that. |
We intentionally omitted
I'm already ahead of you on that. :) Please see https://go/dev/cl/404307 which I hope to land for Go 1.20.
Comparing against The metrics may be updated in the future to reflect true CPU time, and I suspect it's better to have an estimate than to not have anything at all. |
Hi
I was testing and using the runtime/metrics package introduced in 1.16
I'm using go version 1.16.5.
I didn't find the following metrics that exists in runtime package in the runtime/metrics package :
Does it make sense to add them in runtime/metrics pacake?
Does it makes sense to add those values (which are static) as well?
Thanks a lot, G.
The text was updated successfully, but these errors were encountered: