Building a code instrumentation library for event logging





Event Logging and analytics is typically implemented through third party tools that generally tend to keep data on their servers. On the other hand, open-source tools although provide better data privacy are not very clean or easy to implement. Here, I'd like to describe developing a custom service which can provide easy integration and setup along with data privacy.

The tool will provide event logging capabilities to all web and mobile apps. The aim of the tool is to provide easy logging capabilities to multiple apps with focus on data privacy, ease of use and reduced server load.

Implementation: The service contains a library for frontend which encapsulates the frontend code to enable quick integration and a backend container which encapsulates the core python service under a proxy layer to handle concurrent load and enabling the user to configure the databases and batching process.

• Communication between client (frontend) and the backend service will be a http protocol based with higher connection time to reduce frequent connections with the logging backend service. • Backend logger service is built using python programming language using FastAPI framework for managing logging of events to different databases and managing configuration for the service, also this python app is running under a Nginx proxy server layer to provide concurrency handling capability to the service. • The complete backend service is enclosed under a simple container (like docker) to provide ease of setup. • The tool follows a JSON based data protocol to store various events. • The tool provides configurable setting on the backend app service with the option to change database with initial support for NoSQL databases. • The tool can also follow batch-based logging configuration on the backend service which can further reduces load on the db. • The frontend SDK built on ES6 script incapsulates the communication between the client and server and provide batch-based logging configuration to control over parameters like batch size, logging frequency etc.

0 level DFD

Conclusion Thus, having such service will provide a way to implement event logging on any app very quickly with secure database, which can further enable users to implement quick analytics on the events. This can help teams to quickly store app and user events.


  1. Understanding of core python
  2. Knowledge of how client server architecture works and associated network protocol
  3. Basic understanding of server deployment

Video URL:

Speaker Info:

My name is Sumit Rana. I am currently working as a Senior Software developer at BNI. Although I spent most of my time exploring new technologies I love exploring new places and taking unplanned trips.

Speaker Links:

Section: Core Python
Type: Talk
Target Audience: Intermediate
Last Updated: