Observability and SREVol. 9 · Part IX
0 / 0

Shelves / Observability and SRE

OB·97

The Signals of Observability

What observability means (and how it differs from monitoring), then each telemetry signal from first principles: logs, metrics and traces, plus profiles, events and exemplars; what each is good and bad at, its cost model, and how they connect through shared context (trace IDs, resource attributes, exemplars) so you can move from "something is wrong" to "this line of code, for these users" in a few clicks; continuous profiling; and the modern observability stack.

22 topics · ~14 min read · 28-question quiz
Updated Suggest a correction

Start here: what each signal costs and answers

Monitoring versus observability

Monitoring watches for failures you anticipated: CPU above 90%, disk nearly full, the health check failing. Observability is the property that lets you investigate failures you didn't anticipate, by slicing rich telemetry along any dimension (customer, dish, region, version) after the fact. You need both: monitoring tells you something is wrong; observability lets you find out what.

Each signal answers different questions at a different price

Measured on the two services:

Text
per request: logs 412 bytes (2 lines × 206), traces 6 spans × ~381 bytes OTLP ≈ 2286 bytes
metrics: the latency histogram is 13 time series per service, whatever the traffic
at    10 req/s for a day: logs    0.36 GB, traces (all)    1.98 GB, metrics 0.30 MB
at  1000 req/s for a day: logs   35.58 GB, traces (all)  197.51 GB, metrics 0.30 MB

The crucial difference: metrics cost the same whatever the traffic (13 numbers per scrape for the histogram, whether 10 or 10,000 requests happened), while logs and traces grow with every request. That's why metrics are used for dashboards and alerting over everything, while logs are kept selectively and traces are usually sampled. Metrics' weakness is the mirror image: their cost grows with cardinality (the number of distinct label combinations), so you can't put a customer ID in a metric label (chapter 100).

Question Best signal
Is the error rate above 1% right now? Metrics
Which service in the chain made this request slow? Traces
What exactly went wrong for order 8812? Logs (found through its trace ID)
Did latency rise after the 14:05 deploy? Metrics (with deploy annotations)
Which line of code burns the CPU? Profiles

Correlation is what makes them powerful

Signals are most useful when you can move between them: from a latency spike on a dashboard to example slow requests, from a trace to its logs, from a log line to its trace. The links are shared identifiers and attributes:

  • trace_id and span_id in every log line (the Start Here example);
  • exemplars: a metric sample annotated with the trace ID of one request it counted, so a p99 point on a graph links to a real slow trace (the lab does this);
  • consistent resource attributes: service.name, service.version, deployment.environment on every signal, so all three can be filtered the same way.

How deep to go in the signals of observability

Volume 17 defines six mastery levels. For this chapter they look like this; the chapter aims at L3 everywhere, and its lab at L4.

Level What you can do
L1 Explain logs, metrics, traces and profiles and what each is for
L2 Produce all three from a service with shared identifiers and attributes
L3 Explain cost models, cardinality, sampling and correlation mechanisms
L4 Diagnose missing or uncorrelated telemetry and runaway telemetry costs
L5 Design an observability strategy and stack for a system within a budget
L6 Run observability as a platform: standards, pipelines, cost governance

Monitoring versus observability

Monitoring watches for known failure modes: you decide in advance what to measure (CPU, error rate, queue depth) and alert when it crosses a threshold. It answers "is the thing I anticipated happening?".

Observability is a property of a system: how well you can understand its internal state from its external outputs, including for questions you didn't anticipate. The term comes from control theory (Kálmán, 1960); in software it was popularised by Charity Majors and others around 2016–2018. An observable system lets you ask "why are checkout requests from Android users in Mumbai on app version 7.3 slow since 14:05?" without shipping new code.

The practical difference comes from dimensionality: monitoring works with a few aggregated time series; observability needs rich, high-cardinality context on every event (user, tenant, version, region, feature flag, endpoint) and the ability to slice by any of it.

Monitoring Observability
Questions Known in advance ("known unknowns") Arbitrary, discovered during investigation ("unknown unknowns")
Data Pre-aggregated metrics, dashboards Detailed events and traces with many attributes, plus metrics
Typical use Alerting, capacity trends Debugging novel problems, understanding behaviour
Both needed? Yes Yes: alert on symptoms with metrics, investigate with traces, logs and profiles

The signals

Each telemetry signal is a different way of recording what happened:

metricsis something wrong?how much, since when? traceswhere in the path?which dependency? logswhat exactly happened?error details, state profileswhich code is expensive? exemplar trace_id span_id shared resource attributes: service.name · version · env · k8s.pod · region events (deploys, flagchanges, incidents)annotate all timelines
The main telemetry signals and how they connect. Metrics show that something is wrong and how widespread it is; traces show where in the request path time or errors occur; logs show detailed events and messages; profiles show which code consumed CPU or memory. Shared context (trace and span IDs, resource attributes, exemplars) links them so an investigation can move between signals.

Logs

A log is a timestamped record of a discrete event emitted by code: "payment declined for order 42: card_expired". Logs carry the most detail (arbitrary messages, stack traces, payloads) and are the most familiar signal.

  • Strengths: rich context, easy to emit, good for rare events and error details, audit trails.
  • Weaknesses: expensive at volume (ingestion and storage cost scale with every line), hard to aggregate unless structured, easy to drown in noise; correlation across services is manual unless logs carry trace IDs.
  • Cost model: proportional to events × size.

Chapter 99 covers logging in depth.

Metrics

A metric is a numeric measurement aggregated over time, identified by a name and a set of labels (dimensions): http_server_requests_total{service="orders", route="/orders/{id}", status="500"}. Metrics are cheap to store and fast to query because they're pre-aggregated: a counter that increments a million times is still one time series.

  • Strengths: cheap and fast at any traffic volume, ideal for alerting, dashboards, trends, capacity planning, SLOs.
  • Weaknesses: aggregation loses detail (you know the error rate rose, not which request); cardinality (number of unique label combinations) explodes cost if you add labels like user_id.
  • Cost model: proportional to number of time series (cardinality) × resolution × retention, mostly independent of traffic.

Chapter 100 covers metrics in depth.

Traces

A trace records the path of one request through a distributed system as a tree of spans (units of work with start time, duration, attributes, status, and parent-child links). It shows where time is spent and which service failed.

  • Strengths: causality across services, latency breakdowns, dependency maps, high-cardinality attributes per request.
  • Weaknesses: requires instrumentation and context propagation in every service; volume is high, so traces are usually sampled.
  • Cost model: proportional to spans stored, controlled by sampling.

Chapter 101 covers tracing in depth.

Profiles

A profile shows which code consumes resources: CPU time, memory allocation, lock contention, off-CPU (blocking) time, aggregated by stack trace. Classic profiling is done on demand during development; continuous profiling runs low-overhead sampling profilers always, in production, storing profiles over time.

  • Strengths: answers "why is this service using 4 cores?" or "where do these allocations come from?" down to the function and line; finds performance regressions between versions; reduces cost by targeting optimisation.
  • Weaknesses: needs symbol information; language runtimes differ (JIT, interpreters, managed heaps); overhead must stay low (typically 1–2% with sampling).
  • Tools: Grafana Pyroscope, Parca, Datadog/Elastic/Polar Signals continuous profilers, async-profiler and JFR (Java), pprof (Go, built in), perf + flame graphs (C/C++/Rust/Zig), py-spy (Python), eBPF-based whole-system profilers (the OpenTelemetry eBPF Profiler, donated by Elastic, profiles every process on a host without code changes).
  • OpenTelemetry Profiles became the fourth OTel signal and entered public alpha in March 2026, with a pprof-compatible format and links from profile samples to trace and span IDs.

The visual tool for profiles is the flame graph (Brendan Gregg): each box is a function, its width is the share of samples in which it appears (time or allocations), and stacks grow upward from callers to callees. Wide plateaus at the top are where the time actually goes.

main http.serve handleRequest validate db.Query json.Marshal regexp.Compile ⚠ reflect.Value net.read width = share of CPU samples · stacks grow upward from caller to callee wide boxes near the top = where time is actually spent (compiling a regex per request!)
Reading a flame graph. The x-axis is the share of samples (not time order); each box is a function, stacked on its caller. Here, handleRequest spends most time in JSON serialisation and a database call; the widest top-level box, the regex compile inside validate, is the cheapest optimisation target.

Events

Events in the observability sense are discrete, meaningful occurrences, often outside the request path, that explain changes in the other signals:

  • deployments, configuration changes, feature-flag flips, scaling actions, infrastructure changes;
  • incidents, maintenance windows, upstream provider status changes;
  • business events (a marketing email sent to 2 million users at 10:00).

Overlay them as annotations on dashboards: a latency jump that lines up with a deploy marker or a flag change is the fastest root-cause hint you'll ever get. (OpenTelemetry also models events as structured log records with an event name, and span events as timestamped annotations within a span.)

Some practitioners advocate wide events ("canonical log lines", "observability 2.0"): emit one rich, structured event per request per service with dozens or hundreds of attributes, store them in a columnar store, and derive metrics and traces from them. It's a powerful model for debugging; cost management and tooling decide whether it replaces or complements separate signals.

Exemplars

Exemplars link aggregated metrics to individual traces. When a histogram records a latency observation, it can attach a sample's trace ID (and value and timestamp). On a latency graph, the exemplar dots let you click from "p99 spiked at 14:05" straight to a specific slow trace from that moment.

  • Supported in OpenMetrics/Prometheus (exemplar storage), OpenTelemetry metrics SDKs (exemplars sampled from active spans), Grafana (exemplar display linking to Tempo/Jaeger).
  • They bridge the cheap, aggregate world (metrics) and the detailed, per-request world (traces) without adding cardinality.

Correlating signals

The power of modern observability comes from joining signals:

From To Join key
Metric spike Example trace Exemplar (trace ID on the histogram bucket)
Trace span Logs written during that span trace_id / span_id injected into every log record
Trace span Profile samples span_id attached to profiling samples (Go pprof labels, OTel profiles)
Any signal The service, version, pod, host it came from Resource attributes (service.name, service.version, deployment.environment.name, k8s.pod.name, cloud.region) shared across signals
Anything Deploys, flags, incidents Time + service annotations

A typical investigation (the "metrics → traces → logs → profiles" path):

  1. An SLO burn-rate alert fires: checkout p99 latency is over target (metric).
  2. The latency dashboard shows the spike started at 14:05, only for region=ap-south-1; a deploy annotation sits at 14:03.
  3. Click an exemplar: a slow trace shows 1.8 s inside payments-service → GET fraud-score.
  4. Jump to that span's logs: "fraud model cache miss, loading from S3".
  5. The CPU profile for fraud-score at that time shows model deserialisation dominating; the 14:03 deploy disabled the model cache. Roll back.

This only works if every signal carries the same identifiers, which is the main thing OpenTelemetry standardises (chapter 98).

The observability stack

A telemetry pipeline has four layers:

instrumentation: OTel SDKs · auto-instrumentation · Prometheus clients · eBPF collection: OTel Collector · Prometheus agent · Fluent Bit · Vector metricsPrometheus · Mimir logsLoki · ClickHouse tracesTempo · Jaeger profilesPyroscope · Parca query, dashboards, alerting: Grafana · Alertmanager · on-call (PagerDuty, Opsgenie…)
Layers of an observability stack. Applications are instrumented (SDKs and auto-instrumentation) and emit telemetry, usually via OTLP, to collectors that batch, enrich, sample and route it to storage backends specialised per signal; query and visualisation tools sit on top, along with alerting.
Approach Examples Trade-off
Open-source, self-hosted Prometheus + Thanos/Mimir/VictoriaMetrics, Loki or OpenSearch/ClickHouse for logs, Tempo or Jaeger for traces, Pyroscope, Grafana Full control and low licence cost; you operate stateful storage at scale
Managed open source Grafana Cloud, Amazon Managed Prometheus + Managed Grafana, Google Cloud Managed Service for Prometheus Less ops, open formats
Commercial platforms Datadog, Dynatrace, New Relic, Splunk Observability, Honeycomb, Elastic, Chronosphere, Lightstep successors Integrated UX, analytics, AIOps; cost management becomes a major concern
Cloud-native CloudWatch + X-Ray/Application Signals, Azure Monitor + Application Insights, Google Cloud Observability Deep integration with the provider

OpenTelemetry is what keeps these choices open: instrument once in a vendor-neutral way, then route telemetry to any backend (or several at once).

Telemetry cost

Observability spend can rival compute spend. Control it deliberately:

  • Metrics: watch cardinality; drop unused series; aggregate at the edge.
  • Logs: log less at high volume (sample debug, aggregate repetitive lines), set retention by value, route cold logs to cheap object storage.
  • Traces: head sampling plus tail sampling that keeps errors and slow traces (chapter 101).
  • Profiles: sampling profilers keep overhead and volume low.
  • Measure cost per service and treat telemetry like any other resource with a budget.

The Start Here services (Python, OpenTelemetry SDK 1.45, prometheus_client 0.26), Jaeger 2.14 and Prometheus 3.15 with exemplar storage enabled, after 400 orders.

Experiment 1: bytes per request, per signal

Text
per request: logs 412 bytes (2 lines × 206), traces 6 spans × ~381 bytes OTLP ≈ 2286 bytes
metrics: the latency histogram is 13 time series per service, whatever the traffic
at    10 req/s for a day: logs    0.36 GB, traces (all)    1.98 GB, traces sampled 1%  0.020 GB, metrics 0.30 MB
at  1000 req/s for a day: logs   35.58 GB, traces (all)  197.51 GB, traces sampled 1%  1.975 GB, metrics 0.30 MB

Six spans per request cost five times the request's log lines; at 1,000 requests per second, unsampled traces would be about 200 GB a day before indexing and replication. Observability vendors charge by ingested GB, spans or series, so these ratios decide bills. The typical shape of a cost-aware setup: metrics for everything, logs at INFO for requests and errors with debug logs off, and traces sampled (with every error and slow request kept, chapter 101).

Experiment 2: logs compress very well

Text
800 log lines: 161 KiB raw, 19 KiB gzip (8.6× smaller: repetitive keys compress well)

Structured logs repeat the same keys and many values, so storage and transfer compress them 5–10×. Shippers and backends (Loki, Elasticsearch, ClickHouse-based stores, cloud logging) compress automatically; what you pay for is usually the ingested, uncompressed volume plus indexing, which is why you index few fields and keep the rest as payload.

Experiment 3: from a percentile to a trace with exemplars

The latency histogram attaches the current trace ID to each observation as an exemplar; Prometheus stores them alongside the series:

Text
exemplars stored with the /order histogram: 10; of them over 500 ms: 2
slowest exemplar: 918 ms → trace 1a35826d379f… → its slowest leaf span: 'SELECT stock FROM ingredients' 900 ms

From the metric alone we jumped to a real slow request and its slow database query: no searching. Exemplars are sampled (Prometheus keeps at most one per series per scrape, so 400 requests produced 10), which is fine: you need an example, not all of them. Grafana shows them as dots on latency panels that open the trace.

A pitfall found while building this lab

The first run of experiment 3 reported that 0% of requests were under 500 ms. Prometheus had been restarted together with the services and took its first scrape partway through the burst of requests; rate() only counts increases between samples it has, so the fast requests that finished before the first scrape were invisible while the slow stragglers were counted. Waiting for a few idle scrapes fixed it. In production the same effect appears after counter resets and new pods: short bursts and new series need a few scrape intervals before rates mean anything.

Try it yourself

  1. Add service.version and deployment.environment resource attributes to both services and filter traces by them in Jaeger.
  2. Send the logs to Loki (or OpenSearch) and build a query that finds all log lines for one trace ID.
  3. Profile kitchen with py-spy record while it handles load, and compare the profile with the trace.
  4. Measure the per-request byte cost again with traces sampled at 10% in the SDK (TraceIdRatioBased(0.1)).

Revision sheet: the signals of observability

Key ideas

  • Monitoring vs observability: known conditions vs answering new questions from high-dimensional telemetry.
  • Signals: logs (events), metrics (aggregates), traces (request paths), profiles (where resources go), plus events such as deploys.
  • Cost models: metrics by series count; logs and traces by volume; sampling and retention as levers.
  • Correlation: trace/span IDs in logs, exemplars, resource attributes, consistent naming (OpenTelemetry semantic conventions).
  • Stack: instrumentation (SDKs, auto-instrumentation, eBPF), collection (agents, Collector), storage (Prometheus/Mimir/Thanos, Loki/Elasticsearch/ClickHouse, Tempo/Jaeger), visualisation (Grafana), vendors.

Numbers to remember

  • Lab: 412 bytes of logs and ~2.3 KB of spans per request vs a fixed 13 histogram series; 1,000 req/s ≈ 36 GB logs or ≈ 200 GB unsampled traces per day; logs gzip ~8.6×; 400 requests left 10 exemplars.

Pitfalls

  • High-cardinality metric labels.
  • Logging everything at DEBUG in production.
  • Signals without shared IDs or attributes.
  • Tracing without sampling at scale (or sampling away the errors).
  • Reading rates right after restarts or for brand-new series.

Glossary

  • Cardinality: number of distinct time series (label combinations).
  • Exemplar: example trace ID attached to a metric sample.
  • Resource attributes: attributes describing the emitting entity (service, host, version).
  • Sampling: keeping a subset of traces.
  • Profile: statistical record of where CPU or memory is spent.