Skip to content

Conversation

carekb684
Copy link

@carekb684 carekb684 commented Jul 25, 2025

Issue Addressed

Closes #3108

Proposed Changes

Changed the Prometheus metric process_cpu_seconds_total from a Gauge to a Counter, which is more appropriate for representing cumulative CPU time.

Additional Info

I found this issue and wanted to contribute.

I chose the approach of resetting the counter and then incrementing it with the new value for simplicity.
An alternative I considered was storing an extra state (previous_seconds) and incrementing only the calculated diff. However, I decided against this to avoid added complexity and state management, since the reset + increment pattern works well in this case.

Copy link

cla-assistant bot commented Jul 25, 2025

CLA assistant check
All committers have signed the CLA.

@dapplion
Copy link
Collaborator

dapplion commented Aug 4, 2025

Hey @carekb684 thanks for contributing! The approach looks solid. Can you run it locally, capture metrics with prometheus and grafana and show in a screen shot that the metric renders nicely?

@carekb684 carekb684 force-pushed the 3108-set_process_cpu_seconds_total_to_type_counter branch from 638e777 to f82cbe9 Compare August 7, 2025 10:24
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.

2 participants