Implementing Observability Practices

1. Understanding Three Pillars

PillarQuestion AnsweredTool
MetricsWhat is happening (aggregate)?Prometheus, Datadog
LogsWhat happened (per event)?Loki, ELK
TracesWhere did time go (per request)?Jaeger, Tempo
+ ProfilesWhy is this code slow?Pyroscope, Parca

2. Implementing Health Check Endpoints

Example: Spring Boot Actuator

GET /actuator/health
{
  "status": "UP",
  "components": {
    "db": { "status": "UP" },
    "redis": { "status": "UP" },
    "diskSpace": { "status": "UP", "details": { "free": "12GB" } }
  }
}

3. Implementing Readiness and Liveness Probes

ProbeAction on FailBest Practice
LivenessRestart containerShallow check (process responsive)
ReadinessRemove from Service endpointsIncludes critical dependencies
StartupDelay liveness during bootFor slow-starting apps
Warning: Liveness probes that check downstream dependencies cause cascading restarts during outages.

4. Implementing Profiling and Performance Analysis

TypeTool
CPU samplingasync-profiler, perf, pprof
AllocationJFR, async-profiler --alloc
Lock contentionJFR, async-profiler --lock
ContinuousPyroscope, Parca, Datadog Continuous Profiler

5. Understanding Black-Box vs White-Box Monitoring

Black-Box

  • External probe; no app knowledge
  • Synthetic checks (Pingdom)
  • Detects user-visible failures

White-Box

  • Internal metrics, traces, logs
  • Predicts failures
  • Diagnoses root cause

6. Implementing Synthetic Monitoring

AspectDetail
PurposeContinuous probe critical user journeys
ToolsDatadog Synthetics, Pingdom, Grafana Cloud, k6 cloud
Frequency1-5 min per check
Multi-regionDetect localized outages

7. Implementing Real User Monitoring (RUM)

MetricDetail
Core Web VitalsLCP, FID/INP, CLS
Page loadFCP, TTFB
JS errorswindow.onerror, unhandledrejection
ToolsDatadog RUM, NR Browser, Sentry, SpeedCurve

8. Implementing Error Tracking and Alerting

FeatureDetail
Group similar errorsBy stack trace fingerprint
Release trackingAssign to deploy / commit
Source mapsDe-minify JS stacks
ToolsSentry, Rollbar, Bugsnag

9. Understanding Observability-Driven Development

PracticeDetail
Instrument firstAdd metrics/traces with new code
High-cardinality eventsHoneycomb-style wide events
Test in productionFeature flags + monitoring
Debug unknown unknownsSlice by any dimension

10. Implementing Debugging in Production

ToolUse
Dynamic loggingToggle DEBUG without restart
Tracing slow requestsTail-based sampling captures outliers
Live debuggerLightrun, Rookout (snapshot at code line)
Heap / thread dumpjcmd, jstack
eBPF tracingbpftrace one-liners