Performance metrics/logging with Panel?

In order to track performance of our app, I’m looking into implementing some kind of performance metrics.
In this particular case, it’s Azure Monitor based, but it uses the generic opencensus package to do it.

I’m having trouble figuring out how to trace requests sanely though. This is due to the fact that panel/bokeh really only has one actual request and the rest are WebSocket packets.

Is there any good way to hook into requests and be able to monitor load times etc as the user moves around the app?

For comparison, this is the Python Flask tracer: opencensus-python/flask_middleware.py at master · census-instrumentation/opencensus-python (github.com)

Not a precise answer to your question, and worst I’m going to reply by asking you a question (:upside_down_face:), have you seen the Admin functionality offered by Panel? Performance and Debugging — Panel v0.14.0
You can leverage it to assess the performance of your app.

1 Like

Hi @jensaa

For DIY you can take a look at this PR Add ability to configure exception handler by philippjfr · Pull Request #3896 · holoviz/panel (github.com). I think it hooks into the places of Panel where you want to listen.

But it might be an idea to create a feature request for a way to easily add middle ware like yours to Panel.

1 Like

I have and it is mostly an option. The lack (I’m unsure if the new authentication hooks will solve this) of ability to separately have auth on it makes it hard for us to use in practice as all users would have access to it.
On top of that, we are running in kubernetes with no local storage and will eventually have multiple instances running so the admin panel will not give us a full picture.

However, a lot of the information I need to push to Azure is actually available on the admin panel so I’ll have a look at how it does things and if I can hook into that somehow.

1 Like

The exception handler is definitely a good start!
I’ll try and see if I can formulate a feature request for it! (page rendering times is definitely one of the bigger missing things, but also even just being able to track how long the user spends on each page etc).

@jensaa would be happy to hear you thoughts on Add support for - middleware for component level interactions + custom name for logging purposes by nishikantparmariam · Pull Request #5273 · holoviz/panel · GitHub

2 Likes