How do logs, metrics and distributed traces complement one another?
Answer
Metrics efficiently show numerical trends and alertable symptoms across time. Logs provide detailed discrete events and local context. Traces connect spans across a request path to show timing and dependency relationships. Correlation identifiers and consistent attributes let responders move between the three signals instead of investigating isolated data stores.
Strong answer includes
- trend versus event detail versus request path
- uses correlation and shared context
- selects signals by diagnostic question
Practical example
An alert fires because the p99 latency metric for checkout jumped to 4 seconds. The on-call engineer opens a trace for one of the slow requests and sees the delay is entirely inside a call to the inventory service, not the payment gateway. They then pull logs for that specific inventory-service instance filtered by the trace ID from the span, and find repeated 'connection pool exhausted' log lines — the metric said something was wrong, the trace said where, and the log said why.