Microservices, logs and monitoring
How modern back ends are built from services, how to test them, and how logs, traces and monitoring help find the root cause.
Many products are no longer one big application but a set of smaller services that talk to each other: users, catalogue, orders, payments, notifications. This makes teams faster, but it creates new kinds of bugs — and new ways to find them.
Monolith and microservices
| Monolith | Microservices | |
|---|---|---|
| Structure | One application, one deployment | Many small services, deployed independently |
| Communication | Function calls inside the app | HTTP/gRPC calls and message queues |
| Typical bugs | Logic errors, slow queries | Timeouts, version mismatches, lost or duplicated messages |
| Testing focus | End-to-end flows | Contracts between services, resilience, data consistency |
Testing services
- Contract testing: check that a service still returns what its consumers expect (tools such as Pact). A renamed field can silently break another team's service
- Integration testing: run a service with its real database and mocked neighbours
- Resilience: what happens when a downstream service is slow, returns errors or is down? Look for retries, timeouts and clear messages instead of endless spinners
- Message queues: messages processed once, in order where it matters, and not lost when a consumer restarts
- Eventual consistency: after an order, the stock may update a second later; tests must wait for the condition, not assume instant results
Logs
Logs are the system's diary. Good logs are structured (JSON), include a timestamp, level, service name and a correlation ID that follows one user request across all services.
{"time":"2026-11-22T10:15:03Z","level":"error","service":"payments",
"correlation_id":"7f3c-91aa","order_id":1042,
"message":"Provider timeout after 10s","attempt":3}
When you report a back-end bug, add the time, the user and the correlation ID if the app shows one. With centralised logging (Elasticsearch/Kibana, Grafana Loki, Datadog), developers can then find the exact request in seconds.
Traces and metrics
Distributed tracing (OpenTelemetry, Jaeger) shows the full path of one request through all services with timings, so you can see which service made checkout slow. Metrics (Prometheus and Grafana) show trends: error rates, response times, queue lengths. Alerts notify the team when numbers cross a threshold.
Testing in production, safely
- Smoke tests after deploy on critical flows with test accounts
- Feature flags to switch new features on for a small group first
- Canary releases: send a small percentage of traffic to the new version and compare error rates
- Synthetic monitoring: scripted checks every few minutes, such as logging in and adding to cart


