12 Commits

Author SHA1 Message Date
d3933374af refactor(middleware, monitoring, public): streamline metrics handling and remove top referers display
- Simplified MetricsMiddleware by removing unnecessary comments and focusing on essential request logging.
- Updated RequestLog structure to exclude the Referer field from JSON serialization, enhancing data privacy.
- Removed top referers tracking and associated HTML/CSS elements to declutter the user interface and improve performance.
- Cleaned up CSS styles related to referers for a more streamlined design.
2024-12-02 05:35:24 +08:00
50e6abaa2f refactor(monitoring): enhance TopReferers handling and JSON serialization
- Improved LogRequest function to correctly increment counts for referers, ensuring accurate tracking of direct and indirect accesses.
- Added MarshalJSON method to SystemMetrics for proper serialization of TopReferers, facilitating better JSON representation of metrics.
- Updated comments for clarity and maintainability, enhancing code readability.
2024-12-01 01:46:57 +08:00
813d87531f refactor(monitoring, public): enhance system metrics and update display logic
- Streamlined SystemMetrics by removing unnecessary fields and focusing on essential metrics such as AverageLatency and MemoryStats.
- Updated LogRequest to improve handling of referers and average latency calculations, ensuring accurate metrics collection.
- Enhanced the HTML display to include a dedicated section for system metrics, ensuring graceful handling of undefined values.
- Improved the presentation of top referers with a time-based reset mechanism, contributing to a cleaner and more efficient user interface.
2024-12-01 01:43:54 +08:00
8d0d502910 refactor(monitoring, public): remove recent requests tracking and update metrics display
- Removed the RecentRequests field from SystemMetrics and its associated logic in LogRequest to streamline metrics collection.
- Updated the HTML to eliminate the recent requests section, focusing on the top referers display for improved performance and clarity.
- Enhanced the overall metrics presentation by ensuring only relevant data is displayed, contributing to a cleaner user interface.
2024-12-01 01:25:24 +08:00
0a41bebf39 fix(monitoring): add global locks to LogRequest for thread safety
- Introduced global locks to protect concurrent writes to metrics maps in the LogRequest function.
- Ensured thread safety for updating status codes, path latencies, and recent requests, preventing data races.
- Improved overall reliability of metrics logging during high concurrency scenarios.
2024-12-01 00:50:09 +08:00
386e80914f refactor(monitoring, public): streamline latency formatting and metrics logging
- Removed the obsolete formatLatency function from metrics.go to simplify the codebase.
- Updated the HTML to utilize the new latency formatting method, ensuring consistent display of average latency metrics.
- Enhanced the LogRequest function to accurately calculate and update average latency based on request counts, improving metrics accuracy.
2024-12-01 00:46:16 +08:00
1248508302 refactor(handlers, monitoring): improve API request handling and metrics logging
- Refactored HandleAPIRequest to use a result channel for better error handling and response management.
- Updated metrics logging to directly use the full referer instead of just the main domain, enhancing data accuracy.
- Fixed recent requests display in HTML to correctly format timestamps for better readability.
2024-12-01 00:37:50 +08:00
2720f6ebf0 feat(monitoring, public): improve latency formatting and enhance metrics logging
- Updated latency formatting in Go and JavaScript to display three decimal places for improved precision.
- Enhanced LogRequest function to store only the main domain of the referer, improving data clarity.
- Added MarshalJSON method to SystemMetrics for better JSON representation of request counts.
2024-12-01 00:29:48 +08:00
80d18f2b88 feat(config, handlers, middleware): enhance configuration and API request handling
- Added performance settings to the configuration, including max concurrent requests and caching options.
- Updated API request handling to use context for timeouts and improved logging with Unix timestamps.
- Introduced rate limiting middleware to manage request load effectively.
- Enhanced metrics logging to include atomic counters for request counts and improved data structure for performance metrics.
- Implemented caching for CSV content to optimize data retrieval and reduce load times.
2024-12-01 00:14:21 +08:00
83e0226e41 feat(monitoring, public): enhance metrics logging and display
- Added a new function to format latency metrics in both Go and JavaScript for improved readability.
- Updated the LogRequest function to parse and store only the domain of the referer, enhancing data clarity.
- Modified the recent requests and top referers display logic in the HTML to improve performance and maintainability.
- Ensured that the recent requests are displayed in a more user-friendly format, including formatted latency values.
2024-12-01 00:03:26 +08:00
1b2fd3ea85 feat(handlers, monitoring, public): enhance API request handling and improve metrics logging
- Implemented detailed logging for API requests, including real IP, referer, and latency metrics.
- Added dynamic routing for handling requests to /pic/ and /video/ endpoints.
- Enhanced error handling for CSV content fetching and improved response messages.
- Updated the HTML and JavaScript to load and display statistics more efficiently, including filtering based on endpoint configuration.
- Introduced new metrics collection logic to only log relevant API requests, optimizing performance and clarity.
2024-11-30 23:52:31 +08:00
e70ca4cf52 feat(docker, config, api): update docker-compose for logging, enhance app structure, and add system metrics display
- Updated docker-compose.yml to mount logs directory.
- Changed BASE_URL environment variable to point to the new API endpoint.
- Refactored main.go to implement a structured App type, improving initialization and graceful shutdown.
- Enhanced config management with JSON loading and environment variable support.
- Added monitoring capabilities in api_handler for logging request metrics.
- Introduced new metrics display in index.html with corresponding CSS styles for better visualization.
2024-11-30 23:23:58 +08:00