Skip to content
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

feat(process): ProcessCollector use IntGauge to provide better perfor… #430

Merged
merged 2 commits into from Jan 3, 2022

Conversation

pymongo
Copy link
Contributor

@pymongo pymongo commented Dec 28, 2021

similar change like this PR in Tikv: tikv/tikv#11308

close #429

Signed-off-by: wuaoxiang wuaoxiang@stargraph.cn

wuaoxiang and others added 2 commits December 28, 2021 15:26
Copy link
Member

@lucab lucab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the patch!

@lucab lucab merged commit ac86a26 into tikv:master Jan 3, 2022
@lucab lucab mentioned this pull request Apr 21, 2022
rss: Gauge,
start_time: Gauge,
threads: Gauge,
cpu_total: IntCounter,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally get the performance argument, but could we please keep the cpu_total metric as f64? All the other metrics (file descriptor counts, memory usage, threads) are actual integers, but processes that don't use a lot of CPU will now have 1 second CPU usage spikes every so often instead of a more or less flat usage with actual spikes occurring when they actually do.

E.g. a process using 1% CPU on average, with a 10% spike every minute will now look as if it is using 0% CPU most of the time and spike every 2 minutes out of 3.

I really don't think the marginal performance improvement is worth it. Please keep using Counter for cpu_total.

@@ -90,7 +88,7 @@ impl ProcessCollector {
.unwrap();
descs.extend(rss.desc().into_iter().cloned());

let start_time = Gauge::with_opts(
let start_time = IntGauge::with_opts(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is also not an integer. Although not as critical as CPU usage (because it is essentially a constant) the process start time has fractional seconds (and they may be useful).

JanBerktold pushed a commit to JanBerktold/rust-prometheus that referenced this pull request Nov 12, 2022
…mance, close tikv#429 (tikv#430)

Signed-off-by: wuaoxiang <wuaoxiang@stargraph.cn>

Co-authored-by: Luca Bruno <luca.bruno@coreos.com>
Signed-off-by: Jan Berktold <jberktold@roblox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(process): ProcessCollector use IntGauge to provide better performance
3 participants