How to log response times per action

I want to be able to install a filter (or something) so that if a server action takes longer than a configure threshold (e.g. 5 seconds), it logs the time and the action.

This way I can review my production server performance and work on optimising the code behind that action.

I guess I need to know the Java class and method being called for long running actions.

Sounds like you’re looking for a performance monitor. I would take a look at existing solutions for that before trying to implement one yourself. There are plenty of options to choose from, here are a few:

I am not after an external service to ping my web app. That really isn’t going to work without a secure login which can view client data, which isn’t going to happen.

I want my web app to measure every request and alert me if it exceeds my thresholds.

My problem with Vaadin apps is that I can’t identify what the request is for.

Maybe you could use Aspect-Oriented Programming. There are multiple AOP libraries / frameworks for Java; for example, Spring has AOP: