Design: Metrics Collection System
Design covers metrics ingestion, storage, querying, and aggregation. Out of scope: detailed alerting system, visualization dashboards.
Functional Requirements
Non-Functional Requirements
+----------------+ +----------------+ +------------------+ +------------------+
| Application(s) | ---> | Ingestion API | ---> | Buffering Layer | ---> | Time-Series DB |
+----------------+ +----------------+ +------------------+ +------------------+
|
v
+------------------+
| Query API Server |
+------------------+
|
v
+------------------+
| Cache Layer |
+------------------+COUNT, SUM, and AVG in metrics collection?Orders?COUNT(*) inside SELECT.COUNT(*) correctly. Others have syntax errors or wrong functions.Sales with columns amount and region, what will this query return?SELECT AVG(amount) FROM Sales WHERE region = 'East';
amount values.SELECT SUM(amount) FROM Sales WHERE region == 'West';
customer_id.COUNT(*) > 5 to keep only customers with more than 5 orders.AVG(amount) in SELECT to get average per filtered customer group.Pass the test and this pattern moves unknown