Proper solution for logging usage data for analytics/debugging?

I’m pretty sure many Dash applications are deployed in production within many small to medium companies. For this reason, I imagine tracking the users/active sessions of a certain app is not only neat but also needed to identify misusage or possible bottlenecks.

I was surprised to discover that there seems to be no official package developed to do that in a programmatic way. Specifically, I was thinking about having something on the server side which identifies a new session for every IP that connects to the app and tracks the activity of that IP until it eventually leaves the app. Ideally, this information would be stored into a DB and also logged.

For the moment I’m using a callback, which is triggered by the app being rendered, that just logs some of the client data

    Output('client-details', 'data'),
    Input('app-div', 'id')
def ip(id):
    client_address = request.environ.get('HTTP_X_REAL_IP', request.remote_addr)"New session for IP {client_address}")

    return str(request.__dict__)

Furthermore, every computationally intensive function in my app is also decorated with a timer, so that I can see what is requested every time and how long it takes to do the request. Again, this is just logged for now (and it’s not really associated to a certain user/IP because I don’t know how I could track that), but I feel like there should be a better solution.

Any ideas?