Skip to content

Commit e08b477

Browse files
authored
Merge pull request #429 from alexhsamuel/feature/num-tasks
Add number of tasks in event loop to stats.
2 parents 5ee7baf + 7988f55 commit e08b477

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/apsis/apsis.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,18 @@ async def __check_async(self):
610610
Monitors the async event loop.
611611
"""
612612
while True:
613+
num_tasks = len(asyncio.all_tasks())
614+
613615
# Wake up on the next round 10 seconds.
614616
t = now()
615617
next_second = t.EPOCH + math.ceil((t - t.EPOCH + 0.01) / 10) * 10
616618
await asyncio.sleep(next_second - t)
617-
618619
# See how late we are.
619620
latency = now() - next_second
621+
620622
self.__check_async_stats = {
621-
"latency": latency,
623+
"latency" : latency,
624+
"num_tasks" : num_tasks,
622625
}
623626

624627

0 commit comments

Comments
 (0)