Log of Heartbeat Calls

I've read that Heartbeat can slow a WP site down and I'm assuming if our admins/store managers have a lot of admin windows/tabs open, this will exacerbate the issue.

If yes, is there a condition to test and log the calls that Heartbeat makes so I can see if the site slowdown could be related to an excess of Heartbeat calls?

I had a look in the documentation and elsewhere but only found ways to deregister the script ( wp_deregister_script('heartbeat'); ) - not what I need.

Or am I barking up the wrong tree and this is something that should be monitored via server logs, by watching: /wp-admin/admin-ajax.php ?

Topic heartbeat-api logging Wordpress

Category Web


From quick look at the code, there is number of hooks firing in wp_ajax_heartbeat(). Out of which heartbeat_tick action seems quite appropriate to hook some logging logic too.

For the sake of completeness, while you are interested in logged in activity, the hook would be heartbeat_nopriv_tick for logged out users.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.