Browser-based Trio monitor

Since there doesn’t appear to be any up to date monitoring tools, I quickly hacked something together today. This module will offer a browser-interface for realtime monitoring/debugging of your Trio application, even if it is stuck on some synchronous call or busy-looping without any scheduling points.


Code: https://paste.zi.fi/p/trio-monitor.py/view

It would be simple to add more features such as control over Trio’s internal clock, or cancelling any task by clicking :x:. If anyone finds this useful, I do encourage you to take over the project (and invent a name for it); I am willing to contribute but I cannot take yet another project to maintain personally.

Whoops, the spam detection algorithm seems to gotten confused by your post, so it hid it and didn’t send any notifications. I just rescued it from purgatory.

Anyway this is super cool! I know it’s sort of a simple prototype, but even so, it looks very viable as an MVP!

I hear you on not having time to work on it further, and I hope someone steps up. In the mean time, would you be up for stashing the code somewhere more permanent and putting some kind of license on it, so that in case someone comes along 6 months from now, they can build off what you did?

Meanwhile I dumped the project on Github and posted Provide an equivalent of curio.monitor · Issue #413 · python-trio/trio · GitHub

There is a bit of extra background regarding implementation and bugs on the Github page. This test is based on running a separate thread that examines the concurrently running main thread’s stack frames! Surprisingly, this appears to work without crashing despite not using any locks beside the GIL.

Oh duh, I did see that comment but I am super out of it today.

Thanks for posting this work! I started working on reviving https://github.com/python-trio/trio-monitor and was thinking about some sort browser monitor with websockets. I’m in the midst of travelling but I’m looking forward to checking out your prior-art research and code when I get back.