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

Add marking and sweeping time as Process stat #300

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

benoittgt
Copy link

@benoittgt benoittgt commented Jan 9, 2024

Add marking and sweeping time as GC stats. It was introduced in https://bugs.ruby-lang.org/issues/19437

I think we should also add GC.latest_gc_info[:major_by]. I can do it in another PR.

--- a/lib/prometheus_exporter/instrumentation/process.rb
+++ b/lib/prometheus_exporter/instrumentation/process.rb
@@ -65,6 +65,7 @@ module PrometheusExporter::Instrumentation
       metric[:allocated_objects_total] = stat[:total_allocated_objects]
       metric[:marking_time] = stat[:marking_time]
       metric[:sweeping_time] = stat[:sweeping_time]
+      metric[:last_major_by] = GC.latest_gc_info[:major_by]

We could store it as a last state like kube-state-metrics does for pod last state.
It's a fast method. At the moment it's not possible because gauge are only numeric in prometheus_exporter.

cc @mtparet @byroot

@SamSaffron
Copy link
Member

should we only add the matrics on Ruby versions that have it?

@benoittgt
Copy link
Author

@SamSaffron Yes it's a good idea. I made the change. Do we want to test this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants