Skip to content

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

@zcarlson-signifai

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...

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