-
Notifications
You must be signed in to change notification settings - Fork 818
Deadlock on gcCollector #371
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
Conversation
Signed-off-by: Krukov Dima <[email protected]>
Signed-off-by: Krukov Dima <[email protected]>
Signed-off-by: Krukov Dima <[email protected]>
Signed-off-by: Krukov Dima <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this.
Switching to gc.stats sounds good to me, we'll only lose 3.3 support.
I still think we'd be better off using gc.stats. |
@brian-brazil Agree with you. I will prepare PR asap |
Signed-off-by: Krukov Dima <[email protected]>
@brian-brazil I remade PR to using |
Signed-off-by: dmitry.kryukov <[email protected]>
prometheus_client/gc_collector.py
Outdated
|
||
collected = Histogram( | ||
def collect(self): | ||
collected = GaugeMetricFamily( | ||
'python_gc_collected_objects', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these all counters?
object_collected and objects_uncollectable would also be more usual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain to me:
''object_collected'' Are you taking about variables names or about metrics names?
Is your question about choosing the type of metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metric names.
Also, the types don't seem right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the metrics names and redid it with counter type
Signed-off-by: dmitry.kryukov <[email protected]>
'python_gc_collected_objects', | ||
def collect(self): | ||
collected = CounterMetricFamily( | ||
'python_gc_objects_collected', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Counters should end in _total
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CounterMetricFamily
will add it autocratically. You can see it in tests https://github.com/prometheus/client_python/pull/371/files#diff-b8616fecc6de945cdf630d3ad09aebb8R26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, I'd forgotten I'd already added that.
Hello!
Regading #363
We have the same problem with asyncio using (aiohttp, single process, single thread)
As we cannot predict when
gc.collect()
will be executed (withgc.enable
), it is not possible to use something that has locks inside thegc.collect
callbacks. So, YES, we neet to reconsidered how the GC collector works.One way it is remove GC Collector 😎 .
Another way in this PR - Collect metrics in simle structures witout locks and represent it in 'collect' method.
Therd way is to use
gc.stats
(since python 3.4) with Gauge (GaugeMetricFamily
) metrics atcollect
.Or as @megabotan said, just remove lock in
get
methof ofMutexValue