Skip to content

πŸ”­ Observability - The Three Pillars

Don’t just collect dataβ€”collect insights. A Programmer builds observability into the code from day one using OpenTelemetry (OTel), ensuring that as a request travels through ten microservices, you can trace its path and identify the exact bottleneck.


Metrics are numerical representations of data measured over intervals of time. They are lightweight and ideal for alerting.

  • Prometheus: The standard for cloud-native metrics. It uses a pull-based model to β€œscrape” metrics from your services.
  • Grafana: The visualization layer. It transforms raw Prometheus data into dashboards.
  • The GOLDEN Signals: Every programmers monitors these four metrics for every service:
    1. Latency: The time it takes to service a request.
    2. Traffic: A measure of how much demand is being placed on the system.
    3. Errors: The rate of requests that fail (explicitly, implicitly, or by policy).
    4. Saturation: How β€œfull” your service is (e.g., CPU, Memory usage).

Logs are immutable, timestamped records of discrete events.

  • The ELK Stack (Elasticsearch, Logstash, Kibana):
    • Logstash/Fluentd: Collects and processes logs.
    • Elasticsearch: Indexes and stores the data for fast searching.
    • Kibana: The UI for searching and visualizing logs.
  • Programmer Strategy: Avoid β€œLogging Bloat.” Use Structured Logging (JSON format) instead of plain text. This allows you to query logs like a database (e.g., β€œShow me all 500 errors for User ID 123 in the last 10 minutes”).

Distributed Tracing follows a single request as it moves through various services, databases, and caches.

  • How it works: A trace_id is generated at the entry point and passed via headers to every downstream service.
  • Span: A single unit of work within a trace (e.g., a database query).
  • Tools: Jaeger, Tempo, or Honeycomb.
  • Why it matters: In a microservices architecture, a slow response might be caused by a service three layers deep. Tracing makes this instantly visible.

OpenTelemetry (OTel) is a CNCF project that provides a single, vendor-neutral set of APIs and SDKs to collect all three pillars (Metrics, Logs, Traces).

  • The Benefit: No more vendor lock-in. You instrument your code once with OTel, and you can send that data to Prometheus, Jaeger, Datadog, or New Relic simultaneously.
  • OTel Collector: A standalone proxy that receives, processes, and exports telemetry data. It can β€œbatch” data to save bandwidth and β€œredact” PII (Personally Identifiable Information) before it leaves your network.

Stop alerting on β€œCPU > 80%.” That is noise.

  • Programmer’s Move: Alert on User Experience. For example: β€œFire an alert if more than 1% of users experience latency > 500ms over a 5-minute window.” This is an Error Budget approach.

This is the β€œHoly Grail” of correlation.

  • Strategy: Prometheus now supports Exemplars, which attach a trace_id directly to a metric. When you see a spike in a Grafana graph, you can click a data point and jump directly to the specific Trace that caused that spike.

At high scale, storing 100% of traces and logs is too expensive.

  • Strategy: Implement Head-based or Tail-based sampling. Save 100% of error traces, but only 5% of successful β€œ200 OK” traces.

PillarStandard ToolsBest For
MetricsPrometheus, VictoriaMetricsHealth snapshots, Dashboards, Alerting.
LogsELK, Loki, SplunkDebugging specific errors, Audit trails.
TracingJaeger, Tempo, HoneycombBottleneck identification in Microservices.
CombinedOpenTelemetryUnified instrumentation and data routing.

πŸ’‘ Note: Observability is a culture, not just a set of tools. As a Programmer, you should advocate for β€œObservability-Driven Development.” If a developer can’t explain how they will monitor their new feature in production, the PR isn’t ready.