Observability with OpenTelemetry

Observability for cloud native systems: metrics, logs, traces and profiles; monitoring vs observability; the RED and USE methods; OpenTelemetry SDKs, Collector and semantic conventions; Prometheus and the Grafana stack; eBPF instrumentation; cardinality and cost; correlation; and a reference telemetry pipeline on Kubernetes.

On this page

Simple definition#

Monitoring tells you whether known things are wrong (dashboards and alerts on predefined metrics). Observability lets you ask why — including questions you did not anticipate — by exploring rich, correlated telemetry: metrics, logs, traces and increasingly profiles.

The signals#

Signal Answers Example
Metrics How much / how often, over time? Cheap, aggregatable http_server_request_duration_seconds histogram
Logs What exactly happened in this component? Structured JSON with trace ID
Traces Where did time go across services for one request? Spans: gateway → orders → payments → DB
Profiles Which code uses CPU/memory? Continuous profiling flame graphs
Events What changed? Deployments, config changes, Kubernetes events

Correlation is the superpower: a latency alert (metric) → an exemplar trace → the slow span → logs with the same trace ID → the profile for that service — in a few clicks.

Methods for what to measure#

  • RED (for services): Rate, Errors, Duration.
  • USE (for resources): Utilisation, Saturation, Errors.
  • Golden signals (Google SRE): latency, traffic, errors, saturation.
  • Plus SLIs from SRE fundamentals.

OpenTelemetry#

OpenTelemetry (OTel) is the vendor-neutral standard for generating, collecting and exporting telemetry. It became a CNCF graduated project in 2026.

Component Role
API & SDKs Instrument code in Java, Go, Python, .NET, JS and more
Auto-instrumentation Java agent, zero-code instrumentation; the OTel Operator injects it into Pods
Semantic conventions Standard attribute names (http.request.method, k8s.pod.name, gen_ai.*)
OTLP The wire protocol for all signals
Collector Receive, process (batch, sample, redact, enrich) and export to any backend

Status (2026): traces, metrics and logs are stable; declarative configuration reached 1.0; profiles entered public alpha — promising but not yet for critical use.

Reference pipeline on Kubernetes#

OpenTelemetry pipeline on Kubernetes · drawn with Archify · zoom, guided views, search and SVG/PNG export. © 2026 Samir Kumar Sahoo, all rights reserved. Open full screen ↗
  1. Sources — services instrumented with OTel SDKs or auto-instrumentation; nodes and Kubernetes (kubelet, cAdvisor, kube-state-metrics, eBPF).
  2. Collector agent (DaemonSet) on every node — receives OTLP, scrapes, adds Kubernetes metadata.
  3. Collector gateway (Deployment) — tail sampling, PII redaction, routing, rate limiting.
  4. Backends — metrics (Prometheus, Mimir, Thanos, VictoriaMetrics), logs (Loki, Elasticsearch/OpenSearch), traces (Tempo, Jaeger), or commercial platforms.
  5. Use — Grafana dashboards, SLOs and burn-rate alerts to on-call.

Prometheus essentials#

  • Pull model: Prometheus scrapes /metrics endpoints discovered via Kubernetes service discovery or ServiceMonitors (Prometheus Operator).
  • PromQL for queries and alert rules; Alertmanager routes and deduplicates alerts.
  • Long-term, multi-cluster storage: Thanos, Mimir, Cortex or managed Prometheus services.
# p95 latency per route over 5 minutes
histogram_quantile(0.95,
  sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket[5m])))

eBPF-based observability#

eBPF programs in the kernel capture network flows, latency and even HTTP/gRPC calls without code changes (Cilium Hubble, Pixie, Grafana Beyla, Coroot) and enable low-overhead continuous profiling. Great for coverage of uninstrumented services; combine with SDK instrumentation for business context.

Cost and cardinality#

Observability can become one of the largest platform costs.

  • Cardinality: every unique label combination is a new time series. Never use user IDs, request IDs or unbounded values as metric labels.
  • Sampling: head sampling (decide at start) or tail sampling in the Collector (keep errors and slow traces, sample the rest).
  • Log levels and retention per environment; drop noisy logs at the Collector.
  • Tiered storage and downsampling for old data.

Logging practices#

  • Structured JSON logs with timestamp, level, service, trace and span IDs.
  • Log to stdout/stderr; let the platform collect.
  • Never log secrets or unnecessary personal data; redact at the Collector.

Common mistakes#

Quick check#

What is the difference between monitoring and observability? Monitoring checks known conditions with predefined metrics and alerts; observability lets you explore correlated telemetry to answer new questions about why the system behaves as it does.

Name the main telemetry signals. Metrics, logs, traces and profiles (plus events).

What does the OpenTelemetry Collector do? Receives telemetry, processes it (batching, sampling, redaction, enrichment) and exports it to one or more backends.

What are the RED and USE methods? RED — rate, errors, duration for services; USE — utilisation, saturation, errors for resources.

What is high cardinality and why is it a problem? Too many unique label combinations creating huge numbers of time series, which increases cost and can overload metrics backends.

What is tail sampling? Deciding which traces to keep after they complete — for example keeping all errors and slow traces and a fraction of the rest.

Summary#

  • Observability = correlated metrics, logs, traces and profiles to answer “why”.
  • Instrument with OpenTelemetry; run Collector agents and gateways; export anywhere.
  • Prometheus and Grafana-stack backends are common; eBPF fills coverage gaps.
  • Control cardinality, sampling and retention; alert on SLOs.

References#