Skip to content

GCCollector raises an exception in PyPy7.0/Python3.5 #378

Closed

Description

@zcarlson-signifai

When attempting to import prometheus_client in the PyPy 7.0 runtime with the Python 3.5 language implementation, the following exception is raised:

(prometheus-client) [zcarlson@eleusinia-forge prometheus-client]$ python
Python 3.5.3 (928a4f70d3de7d17449456946154c5da6e600162, Feb 09 2019, 11:50:43)
[PyPy 7.0.0 with GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> import prometheus_client
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zcarlson/Code/prometheus-client/env/pypy7.0-python3.5/site-packages/prometheus_client/__init__.py", line 5, in <module>
    from . import gc_collector
  File "/home/zcarlson/Code/prometheus-client/env/pypy7.0-python3.5/site-packages/prometheus_client/gc_collector.py", line 46, in <module>
    GC_COLLECTOR = GCCollector()
  File "/home/zcarlson/Code/prometheus-client/env/pypy7.0-python3.5/site-packages/prometheus_client/gc_collector.py", line 17, in __init__
    registry.register(self)
  File "/home/zcarlson/Code/prometheus-client/env/pypy7.0-python3.5/site-packages/prometheus_client/registry.py", line 24, in register
    names = self._get_names(collector)
  File "/home/zcarlson/Code/prometheus-client/env/pypy7.0-python3.5/site-packages/prometheus_client/registry.py", line 64, in _get_names
    for metric in desc_func():
  File "/home/zcarlson/Code/prometheus-client/env/pypy7.0-python3.5/site-packages/prometheus_client/gc_collector.py", line 37, in collect
    for generation, stat in enumerate(gc.get_stats()):
TypeError: 'GcStats' object is not iterable

I believe this is because pypy has a different GC from stock CPython, and thus gc_stats() returns different information.

prometheus_client 0.5.0 seems to work, however, from initial testing...

Activity

  1. brian-brazil commented on Feb 20, 2019

    @brian-brazil
    Contributor

    Our CI should have caught that as we test on pypy, guess we also need a new test.

  2. Krukov commented on Feb 21, 2019

    @Krukov
    Contributor

    There are no CI jobs with pypy with 3,7 . Only with 2,7
    https://travis-ci.org/prometheus/client_python/jobs/495991719

  3. patallen commented on Feb 26, 2019

    @patallen

    Also is failing with same error on PyPy 6.0 Python 2.7.13

  4. oberstet commented on Feb 26, 2019

    @oberstet

    pip install "prometheus_client==0.5.0" works on PyPy 7

  5. glyph commented on May 17, 2019

    @glyph

    Still failing with this error on PyPy 7.1.1.

  6. brian-brazil commented on Aug 8, 2019

    @brian-brazil
    Contributor

    That doesn't sound right, we no longer use this code on PyPy. Can you confirm you're still seeing this?

  7. glyph commented on Aug 16, 2019

    @glyph

    @brian-brazil You're … right? I am not sure what versions I was testing with when I made the previous comment, but with pypy3-7.1.1 and prometheus_client==0.7.1, it now imports without emitting a traceback. Sorry for the false alarm!

  8. glyph commented on Aug 16, 2019

    @glyph

    @zcarlson-signifai Should this be closed?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions