New Analytics Tracking System & Docker Health Checks Implemented
What developments have taken place today?
This commit introduces a new analytics tracking system for the application, designed to capture and transmit user interaction data asynchronously. A TrackAnalyticsForWebsite
middleware is implemented within the Gin framework to gather request-level information such as cookies, IP addresses, user agents, timestamps, event types, device dimensions, website IDs, and authorization tokens. This collected data is then sent via a gRPC channel to a dedicated gRPC server running on port 15018 for processing or storage.
To prevent blocking the main request thread, an asynchronous channel (trackChannel
) has been established and utilized by a background goroutine that continuously processes incoming analytics data and transmits it to the gRPC endpoint. Furthermore, the Docker health check script has been updated to verify the operational status of critical components – database, Elasticsearch, the application itself, the API, and the gRPC server – before proceeding with subsequent steps. Secure credentials are currently set for simplicity but require proper authentication in a production environment.
These changes improve data collection efficiency by decoupling analytics processing from request handling, leading to improved responsiveness. The asynchronous nature of the channel prevents performance bottlenecks. Integrating Docker health checks ensures the stability and reliability of the application deployment pipeline by verifying that all necessary components are running correctly before continuing operations. This system provides a robust foundation for gathering valuable insights into user behavior and application performance.