-
Notifications
You must be signed in to change notification settings - Fork 579
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
Missing runtime metrics #6321
Comments
any updates? |
The non-deprecated runtime uses runtime/metrics to retrieve metrics data. It looks like you're looking for go.memory.allocated and go.memory.used. The current runtime does expose those two metrics on its latest version, even though it uses the |
Thanks @dmathieu for your reply!
|
cc @dashpole who led this. |
Based on https://github.com/prometheus/client_golang/blob/76b74e25d5660965000a74cf2e918c217ed76da2/prometheus/go_collector.go#L26, this is the mapping from memStats to go runtime metrics:
You can see golang/go#67120 for why we don't provide live + unswept heap memory via
In keeping with that, we would recommend using the |
Hi @dashpole, thanks for your reply and sorry for the delay. I spent a few hours today to revisit the materials mentioned in the above thread. Here's my findings and feel free to correct me if any.
While I can understand This metric is necessary for tuning GOMEMLIMIT. It's also useful for identifying "other" memory, and together with
According to golang/go#67120, I think the reason that Re: the discussion "live+unswept heap memory isn't a terribly useful", it actually refers to With that, I'm still thinking there are some enhancement chances for the new runtime metrics. WDYT? Also, I'm wondering when the deprecated runtime metrics will be completely dropped given there are enhancement chances as well for the deprecated ones. It looks currently the feature flag |
This is definitely the right time to make changes to the new runtime metrics. I don't think there is a rush with disabling the old metrics, and we won't remove them for a while. In particular, we could probably add some metrics which are disabled by default, with options to enable them. A few follow-up questions:
I believe you would want to compare
This seems like the primary use for it, but i'm fuzzy on the actual value here. It would just let us calculate the "released" memory, which from reading doesn't sound that useful.
Do you think we should expose it anyways? Its possible it could be an opt-in metric. But given the go maintainers recommended using
Looking forward to it! We really appreciate the feedback. |
Thanks @dashpole ! I like the idea of "add some metrics which are disabled by default, with options to enable them", so that's the end user who determines whether the metric is needed. A few more comments after you as below:
Just to confirm, by reading the code, it looks
I'd think this might be one candidate of opt-in metrics, because the total memory usage
I agree that it could be an opt-in metric. Strictly, Does it make sense? |
If you do not group by the |
If we want to add |
We should involve the Go folks that worked on the proposal from the Go side. |
Hi @dashpole, my comments as below.
Thanks for the clarification.
Sure, I'd be happy to propose something there, and definitely we should ask advice from Go folks. P.S.: Below is a detailed summary about the potential gaps based on what I learned from the current deprecated metrics, combining with the above discussion in this thread. Let me know if that makes sense, and if yes, I'd be happy to prepare a PR for the semantic convention proposal first.
|
This is equivalent to go.memory.allocated
This makes sense to me as a potential opt-in metric.
We could consider exposing released memory as a separate metric (e.g. go.memory.released). Users could then use
That one doesn't sound very useful...
This one is interesting. We do support
It does seem like having an opt-in metric for the number of live objects would be a reasonable idea. I don't think we want frees as its own metric, though.
Interesting. Its too bad we don't have the previous gc interval as a metric on its own, but it seems reasonable as an opt-in metric.
Can you say more about what this is useful for? |
@dashpole Sorry for the delay. Below are my reply to your comments. Also, I'm preparing a PR for the semantic convention proposal. Let me know if that makes sense or not.
Yes, it's supported in new metrics, but not in old metrics. If we want to keep both new and old in sync, we could add it to the old metrics too.
Yes, since both total and released are collected, we can either expose total, or expose released as
I like the idea of using label. By specifying different labels or w/o specifying label, it can serve different query purposes. Comparing with the regular allocations, tiny allocation is the number of allocations satisfied from the tiny allocation pool, i.e.: usually under 16 bytes, managed by special optimizations. If tiny allocations dominate, it might indicate an opportunity to optimize code, e.g. it may reveal fragmentation or inefficiencies in how memory is utilized.
|
Description
Some runtime metrics, e.g.:
memStats.Alloc
,memStats.Sys
, are missing.Steps To Reproduce
memStats.Alloc
,memStats.Sys
.Expected behavior
Can the missing runtime metrics be added? If a PR is allowed, we'd be happy to contribute.
The text was updated successfully, but these errors were encountered: