Skip to content

Commit 782dc0c

Browse files
authored
Merge pull request #46 from instana/fix_thread_metrics
Fix thread count reporting.
2 parents f68ba06 + 9cfb795 commit 782dc0c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

instana/meter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ def collect_metrics(self):
235235
threshold2=th[2])
236236

237237
thr = t.enumerate()
238-
daemon_threads = len([tr.daemon and tr.is_alive() for tr in thr])
239-
alive_threads = len([not tr.daemon and tr.is_alive() for tr in thr])
240-
dead_threads = len([not tr.is_alive() for tr in thr])
238+
daemon_threads = [tr.daemon and tr.is_alive() for tr in thr].count(True)
239+
alive_threads = [not tr.daemon and tr.is_alive() for tr in thr].count(True)
240+
dead_threads = [not tr.is_alive() for tr in thr].count(True)
241241

242242
m = Metrics(ru_utime=u[0] if not self.last_usage else u[0] - self.last_usage[0],
243243
ru_stime=u[1] if not self.last_usage else u[1] - self.last_usage[1],

0 commit comments

Comments
 (0)