Skip to content
TrustHappens
Observability & Cloud

Modern Observability: Logs, Metrics and Distributed Tracing Explained

What logs, metrics and distributed traces each tell you, where each one falls short, and how to connect them so incidents are diagnosed in minutes, not hours.

TrustHappens Editorial TeamPublished 7 min read
Illustration for Observability & Cloud
On this page

Every production system already produces telemetry. The difference between a team that resolves incidents quickly and one that spends hours in a war room is rarely the amount of data. It is whether the data answers the right questions, and whether you can move from one kind of data to another without losing the thread.

Logs, metrics and traces are often presented as the "three pillars" of observability. That framing is useful as a vocabulary but misleading as an architecture, because it suggests three separate systems. In practice, each signal is good at one kind of question, and the real value appears when they are linked. This article explains what each signal does well, where it falls short, and how to connect them.

Metrics: is something wrong?

A metric is a numeric measurement recorded over time, identified by a name and a set of labels (also called attributes or dimensions). In the Prometheus data model, each unique combination of metric name and labels is a separate time series.

Metrics come in a few basic types:

  • Counters only go up, and you query their rate of change: requests served, errors returned, bytes sent.
  • Gauges go up and down: queue depth, memory in use, active connections.
  • Histograms count observations into buckets, so you can calculate percentiles and distributions: request duration, payload size.

Metrics are cheap to store and fast to query because they are pre-aggregated. That makes them the right foundation for dashboards and alerting. They tell you that something is wrong and roughly where: error rate on the checkout service rose at 14:02.

Their weakness is the flip side of aggregation. A metric cannot tell you which specific request failed or why, and adding detail through labels is expensive. Every new label value multiplies the number of time series.

RED and USE

Two methods keep metric dashboards focused. For services that handle requests, track RED: rate, errors and duration. For resources such as CPU, memory, disks and connection pools, track USE: utilisation, saturation and errors.

RED queries (PromQL)
# Rate: requests per second by service
sum by (service) (rate(http_requests_total[5m]))

# Errors: share of requests returning 5xx
sum by (service) (rate(http_requests_total{code=~"5.."}[5m]))
/
sum by (service) (rate(http_requests_total[5m]))

# Duration: 99th percentile latency from a histogram
histogram_quantile(0.99, sum by (service, le) (rate(http_request_duration_seconds_bucket[5m])))

Note the use of a histogram for latency. Averages hide the slow tail that users actually feel, and percentiles calculated separately on each instance cannot be meaningfully averaged afterwards. Histograms aggregate correctly across instances, which is why the Prometheus documentation points to histograms whenever you need to aggregate latency across instances.

Logs: what exactly happened?

A log is a timestamped record of an event. Logs are the oldest and most familiar signal, and they carry the most detail: the error message, the stack trace, the parameter that failed validation, the decision a piece of code made.

That detail is also their cost. Logs are high volume, and unstructured text is hard to query at scale. A few practices make logs far more useful:

  • Structure them. Emit JSON or another structured format with consistent field names, so you can filter by service, level or order_id rather than grepping.
  • Log at boundaries and decisions, not on every line. A log per request at the edge, plus logs for errors and significant decisions, beats thousands of debug lines.
  • Include trace context. Add the trace ID and span ID to every log record written while handling a request. This one change turns logs from an isolated stream into something you can join to a trace.
  • Keep secrets and personal data out. Logs are copied, shipped and retained widely; redact at the source or in the pipeline.
A structured log record with trace context
{
  "timestamp": "2026-12-05T14:02:17.481Z",
  "level": "error",
  "service": "checkout-api",
  "message": "payment authorisation failed",
  "payment.provider": "provider-a",
  "error.type": "TimeoutError",
  "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
  "span_id": "00f067aa0ba902b7"
}

Logs answer "what exactly happened in this process at this moment?" They are poor at answering "how often?" (that is a metric) and "where in a chain of services did time go?" (that is a trace).

Traces: where did the time go?

A distributed trace follows one request as it moves through a system. It is made of spans: each span represents one operation, such as an inbound HTTP request, a database query or a call to another service, with a start time, a duration, attributes and a status. Spans have parent-child relationships, so the trace forms a tree that shows exactly which operation called which and how long each took.

Traces answer the questions the other signals struggle with in distributed systems:

  • Which downstream call made this request slow?
  • Did the retry storm start in our service or the one we call?
  • Is the latency in our code, the database or a third-party API?
  • Which services does this endpoint actually touch?

The mechanism that makes this work is context propagation. When one service calls another, it passes the trace ID and its current span ID along, usually in the W3C traceparent HTTP header. The receiving service continues the same trace instead of starting a new one. If any hop drops the header (a proxy, a message queue without context, an async worker), the trace breaks into disconnected pieces.

Traces have their own trade-offs. Recording every span for every request can be expensive at high traffic, so teams decide on a sampling policy: keep a fraction of traces chosen at the start (head sampling), or decide after a trace completes so errors and slow requests are always kept (tail sampling). Whatever you choose, make it a deliberate, documented decision.

How the signals work together

Each signal answers a different question, and an investigation usually uses all three in sequence.

QuestionBest signalWhy
Is something wrong? How bad?MetricsCheap, aggregated, ideal for alerts and trends
Where in the system is it wrong?TracesShow the path and timing across services
Why did this specific request fail?LogsCarry the error message and local detail
Did a change cause it?Deploy and config eventsLine up changes with the start of the symptom

A typical incident flow looks like this:

  1. An SLO burn-rate alert fires on checkout error rate (metric).
  2. The dashboard shows errors concentrated on one endpoint, starting at a specific minute.
  3. You open example traces for failing requests in that window. The traces show the time is spent in a call from the payment service to an external provider, which is timing out.
  4. From one failing span, you jump to the logs for that trace ID and see the provider's error response and the retry behaviour.
  5. You check recent changes and find a timeout setting changed in the last deploy.

None of those steps is exotic. What makes them fast is that each signal carries the identifiers needed to reach the next: shared service names, consistent attributes and trace IDs everywhere.

Linking signals in practice

A few concrete practices make the connections reliable.

Use one naming scheme. Service name, environment and version should be identical across metrics, logs and traces. OpenTelemetry's resource attributes (service.name, service.version, deployment.environment.name) and semantic conventions provide a common vocabulary so the same concept is not called three different things.

Put trace IDs in logs. Most OpenTelemetry language SDKs offer a log bridge or appender that adds the active trace and span IDs automatically. If you cannot use one yet, add them to your log formatter.

Use exemplars. An exemplar attaches a sample trace ID to a metric data point, typically a histogram bucket. When a latency chart spikes, an exemplar takes you straight to a trace from that spike rather than searching for one.

Derive metrics from traces carefully. Generating RED metrics from spans in the pipeline guarantees that metrics and traces agree on names and labels. Make sure the derived metrics are computed before any sampling, or they will under-count.

Record changes as data. Deploys, feature-flag changes and configuration updates belong on the same timeline as your metrics. "What changed?" is the most productive question in incident response.

From signals to objectives

Signals become useful to the wider organisation when they are tied to objectives. A service level indicator (SLI) measures something users care about, such as the proportion of checkout requests that succeed within a latency threshold. A service level objective (SLO) sets a target for it over a window, and the remaining tolerance is the error budget.

Google's SRE book argues for paging on symptoms that users experience rather than on every internal cause, and SLOs make that practical. Alerts based on how quickly the error budget is being consumed are fewer and more meaningful than alerts on every CPU spike, and the investigation flow above starts from them.

Choosing where the data lives

Many teams run separate tools for each signal, and that works as long as identifiers are shared and engineers can jump between tools without losing context. Others prefer a single backend that stores all three signals together so the links are built in. Either way, instrumenting with a vendor-neutral standard such as OpenTelemetry keeps the decision reversible.

Getting started

If your current setup is mostly logs and a few infrastructure metrics, a practical sequence is:

  1. Add RED metrics for your most important user-facing services and define one SLO each.
  2. Switch application logs to a structured format with consistent field names.
  3. Add distributed tracing to the services on one critical user journey and confirm that a single request produces a single connected trace.
  4. Put trace IDs into logs and turn on exemplars where your metrics backend supports them.
  5. Run your next incident review using the alert, trace, log sequence, and note where the links broke.

Frequently asked questions

Do I need all three signals?

For distributed systems, yes in most cases. Metrics detect and quantify problems cheaply, traces locate them across services, and logs explain the specific failure. Each one is weak at the questions the others answer well.

Are traces just detailed logs?

No. A trace models the causal structure of a request, with parent-child spans and timing across services. Logs are independent records. Adding trace IDs to logs links the two, but neither replaces the other.

Why use histograms instead of average latency?

Averages hide the slow tail that users notice, and per-instance percentiles cannot be averaged correctly. Histograms can be aggregated across instances and still produce meaningful percentiles.

What is cardinality and why does it matter?

Cardinality is the number of unique label combinations on a metric. Each one becomes a separate time series, so labels such as user IDs or raw URLs can create unbounded series, slowing queries and increasing cost.

References

  1. OpenTelemetry: Signals
  2. Google SRE Book: Monitoring Distributed Systems
  3. Prometheus: Data model
  4. Prometheus: Histograms and summaries
  5. W3C Trace Context

Share this article

Stay Ahead of What Matters.

Practical guides on observability & cloud and more, delivered to your inbox.