0
0
Microservicessystem_design~12 mins

Three pillars (metrics, logs, traces) in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Three pillars (metrics, logs, traces)

This system collects and analyzes three key types of data from microservices: metrics, logs, and traces. These data pillars help monitor service health, diagnose issues, and understand request flows across distributed services.

Key requirements include real-time data collection, scalable storage, and easy querying for troubleshooting and performance optimization.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
+-------------------+       +------------------+       +------------------+
| Microservice A     |<----->| Metrics Collector |<----->| Metrics Database |
| (Logs, Traces)     |       +------------------+       +------------------+
|                   |               ^                          ^
+-------------------+               |                          |
        |                           |                          |
        v                           |                          |
+-------------------+       +------------------+       +------------------+
| Microservice B     |<----->| Logs Collector   |<----->| Logs Storage     |
| (Logs, Traces)     |       +------------------+       +------------------+
|                   |               ^                          ^
+-------------------+               |                          |
        |                           |                          |
        v                           |                          |
+-------------------+       +------------------+       +------------------+
| Microservice C     |<----->| Traces Collector |<----->| Traces Storage   |
| (Logs, Traces)     |       +------------------+       +------------------+
Components
User
user
Initiates requests to microservices
Load Balancer
load_balancer
Distributes incoming requests evenly across microservices
API Gateway
api_gateway
Routes requests to appropriate microservices and enforces security
Microservice A
service
Handles business logic and generates logs, metrics, and traces
Microservice B
service
Handles business logic and generates logs, metrics, and traces
Microservice C
service
Handles business logic and generates logs, metrics, and traces
Metrics Collector
collector
Aggregates metrics data from microservices
Metrics Database
database
Stores time-series metrics data for analysis
Logs Collector
collector
Aggregates logs from microservices
Logs Storage
database
Stores logs for search and troubleshooting
Traces Collector
collector
Aggregates distributed traces from microservices
Traces Storage
database
Stores trace data to analyze request flows
Request Flow - 12 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayMicroservice A
Microservice AMetrics Collector
Microservice ALogs Collector
Microservice ATraces Collector
Metrics CollectorMetrics Database
Logs CollectorLogs Storage
Traces CollectorTraces Storage
Microservice AAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Metrics Database
Impact:Metrics data cannot be stored, so monitoring dashboards may show stale or missing data. Logs and traces remain unaffected.
Mitigation:Use database replication and failover to a standby metrics database. Buffer metrics temporarily in the collector to retry writes.
Architecture Quiz - 3 Questions
Test your understanding
Which component collects logs from microservices?
AMetrics Collector
BAPI Gateway
CLogs Collector
DTraces Storage
Design Principle
This architecture cleanly separates the three pillars of observability—metrics, logs, and traces—using dedicated collectors and storage. This separation allows scalable, specialized processing and querying of each data type, improving monitoring and troubleshooting in microservices.