Skip to content

Conversation

tcolgate
Copy link
Contributor

We've found this useful in monitoring pythons Garbage Collection. If you are
interested in including this:

  • Should the name default to python_gc perhaps?
  • Are you happy for these all to be histograms?
  • If so, how would you prefer the buckets to be set up (presumably defaulted and
    pass in to the constructor?)
  • I'm not actually sure if having uncollected as a histogram is of much use. Uncollected
    should be monitored, but histogram is probably overkill.
  • I'll fill out the tests?
Copy link
Contributor

@brian-brazil brian-brazil left a comment

Choose a reason for hiding this comment

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

python_gc would be typical.

@tcolgate
Copy link
Contributor Author

tcolgate commented Sep 3, 2018

@brian-brazil removed the configurable namespace (this was cargo-culted from another module in this package). I've also removed the bucket specification for the timings.

re: other packages. The gc.callbacks was added in python 3.3, the gc package is certainly in 2.7 and the docs allude to it having been in as far as 2.2.

I've tested the basic import of gc on jython (2.5.3 available on debian), and this appears to work without problems.

What is your minimal supported version?

@tcolgate tcolgate changed the title [WIP] Add detailed Garbage Collection statistics. Add detailed Garbage Collection statistics. Sep 4, 2018
@tcolgate
Copy link
Contributor Author

tcolgate commented Sep 4, 2018

@brian-brazil udpated to include a test.
pypy has it's own gc, those stats wont get picked up here. Perhaps an interested party will come along.

Copy link
Contributor

@brian-brazil brian-brazil left a comment

Choose a reason for hiding this comment

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

Will this break on any implementations if the gc module doesn't exist?

@tcolgate
Copy link
Contributor Author

tcolgate commented Sep 5, 2018

It would break if no gc module exists, but jython, python and pypy all have one, I can probably do something to work around the eventuality if you prefer.

@brian-brazil
Copy link
Contributor

If the main implementations have one since 2.6 then we're good for now, we can wait until someone complains to see if it's an actual problem.

@tcolgate
Copy link
Contributor Author

tcolgate commented Sep 5, 2018

The docs for the gc module in 2.7 have some functions labeled as "new in 2.2", and I'd seen some other references to 2.2 as well.

@tcolgate
Copy link
Contributor Author

@brian-brazil I've rebased this on master. Reviewed all the comments and , so far as I can tell, they are all resolved.

This patch adds details stats for the python garbage collector. - `python_gc_collected_objects`: Histogram of the number of objects collected, by GC generation. - `python_gc_uncollectable_objects`: Histogram of the number of objects count to be uncollectable, by GC generation. - `python_gc_duration_seconds`: Histogram of the duration of each GC generation. Signed-off-by: Tristan Colgate <tristan@qubit.com>
@tcolgate
Copy link
Contributor Author

@brian-brazil updated.

@brian-brazil brian-brazil merged commit c0cee96 into prometheus:master Sep 24, 2018
@brian-brazil
Copy link
Contributor

Thanks!

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

Labels

None yet

2 participants