Problem/Motivation
There is a common pattern called middlewars among various programming languages, more about on https://igor.io/2013/02/02/http-kernel-middlewares.html
These middlewares allow reusability on the HTTP level between frameworks. There are examples of a session middleware ...
For drupal we could use them beside for the ones defined in http://stackphp.com/middlewares/ also for a statistics.php implementation
which even bypasses routing aka. is as fast as possible.