Lesson 7 of 9 · 26m
Observability: Signals, Not Noise
Design logs, metrics, traces, and health checks so operators can answer what broke, where, for whom, and whether recovery is working.
A service is not observable because it emits data. It is observable when an operator can answer questions quickly: Is the system degraded? Which dependency caused it? Which tenants are affected? Did the rollback help? I have seen systems emit millions of log lines per hour and still fail those questions. Volume is not signal.
Start with service-level questions
Before adding instrumentation, decide what matters: availability, latency, correctness, saturation, and dependency contribution. In a Spring Boot service, Micrometer is the normal metrics facade. Expose Prometheus metrics through Actuator, but do not turn every actuator endpoint into a public invitation.
Metrics need useful labels and disciplined cardinality
This shape is useful:
Counter.builder("payments.authorization.attempts")
.tag("outcome", outcome.name())
.tag("provider", "stripe")
.register(registry)
.increment();This shape is dangerous:
.tag("customerId", customerId.toString())High-cardinality labels can explode time-series storage and turn a metrics incident into the incident. Label by bounded dimensions: outcome, dependency, route class, tenant tier, deployment version. Use trace context or logs for individual identifiers.
Tracing connects cause and effect
Distributed tracing shows where latency enters a request path. With Micrometer Tracing and OpenTelemetry, propagate context through HTTP clients, messaging headers, schedulers, and asynchronous executors. A trace that stops at the first executor is not observability; it is a prologue.
Logs are events, not autobiography
Structured logs should be concise, consistent, and correlated:
{"level":"WARN","service":"billing","traceId":"8c17f2be7b3a4e4c","event":"payment.authorization.retry_exhausted","outcome":"provider_unavailable","attempts":3}Write what happened, not a narrative. Include the decision-relevant fields, exclude secrets, and use severity honestly. If every third request logs ERROR, operators learn to ignore ERROR.
Health checks must mean different things
Liveness asks whether the process should be restarted. Readiness asks whether it should receive traffic. They are not interchangeable:
management.endpoints.web.exposure.include=health,info,prometheus
management.endpoint.health.probes.enabled=trueA database failure should usually remove readiness, not trigger a restart loop through liveness. Restarting a perfectly healthy process because a shared dependency is down makes outages worse.
Field notes
- Never expose unauthenticated actuator endpoints. Even
envwithout obvious secrets can leak topology and internal hostnames. - Deploy version and instance metadata should be visible in telemetry so bad rollouts are obvious.
- Alert on user-visible symptoms and burn rate; page on actionable failure, not curiosity.
- A missing metric often means the code path never ran. Design absence alerts deliberately.
- Observability data has retention, cost, and privacy consequences. Treat it as a production datastore.
Was this lesson helpful?