A checkout page feels slow to customers, but every service dashboard is mostly green. One request takes 200 milliseconds. Another takes 20 seconds. Nobody knows whether the delay comes from the application, the database, the payment provider, or a queue.
"The system is unhealthy" is not especially useful information. It describes a feeling, not a set of observations. A better question is: where did time go for requests that failed or crossed an expected latency limit?
That question leads to observability. It is the ability to understand a running system by asking questions of the evidence it produces. Logs, metrics, and traces are important sources of evidence, but collecting dashboards does not automatically create understanding.
The useful distinction is not "logs versus metrics versus traces." It is knowing what each signal records, what it hides, and which question it helps answer.
What Observability Means
Modern systems produce telemetry: logs, measurements, trace data, and events from infrastructure or third-party services. Telemetry is the material the system emits. Observability is the ability to use that material to reason about behavior that was not completely visible from the outside.
The distinction matters. An application can emit plenty of telemetry and still be difficult to investigate. Log names might vary, timestamps might disagree, request identifiers might disappear at a service boundary, and metrics might report only averages. The system is loud, but not necessarily informative.
Good observability needs more than data. It needs a consistent vocabulary, context that survives transitions between components, deliberate sampling, and clear limits around sensitive data. "Are payments healthy?" might mean whether requests fail, how long they take, or whether confirmations arrive. Those questions need different evidence.
Logs Record Individual Events
A log is a timestamped record about something that happened or was observed. It might describe an application decision, a dependency error, an incoming request, or a state change in a background job.
Logs preserve detail. If a payment provider call times out, a counter can show that timeouts are increasing. A log can show which operation timed out and what happened around it.
A structured log might contain fields like these:
service=checkout
operation=payment.authorize
outcome=timeout
correlation_id=ck_01J9X
attempt=2
duration_ms=5000
This is a conceptual example, not a universal schema. The fields describe a specific event in a form that searches and processing systems can handle. A correlation identifier links related records. The outcome and duration provide enough context to compare events.
Useful context is usually narrow: the service, a stable operation name, the result or error category, a correlation identifier, and elapsed duration when it matters. The exact detail depends on the service. A failed database call may need the operation and error category, but not a database credential or a customer's address.
Writing one log for every minor branch creates volume. Free-form messages are difficult to search consistently, and structured fields become expensive if they contain effectively unlimited values. Retaining every log forever adds more storage and attention cost.
A missing log is not proof that an event never happened. It may have been filtered, dropped, expired, or written by a process that disappeared.
Metrics Describe Change at Scale
A metric is a numerical measurement collected over time. It is good for volume, utilization, duration, and change. It lets a team notice a trend without inspecting every event.
The basic metric types cover most ordinary needs:
- A counter tracks an accumulated count, such as completed requests or dependency timeouts.
- A gauge tracks a value at a point in time, such as queue depth or available memory.
- A histogram or summary captures a distribution, such as how request durations are spread.
These categories are conceptual. A counter may reset when a process restarts, and collection systems may expose histogram data differently.
A metric might record checkout request count, failures, and the distribution of durations. An average can hide a problem. If 99 requests finish in 100 milliseconds and one takes 20 seconds, the average hides the difference. A percentile such as p95 or p99 helps show the slow tail.
Metric labels should describe manageable groups. region, operation, and outcome can be useful. User ID, full URL, or generated request ID can create nearly unlimited metric series. This is high cardinality. It can make storage and queries much more expensive than the same metric with a narrow set of dimensions.
It also matters what a metric means. latency needs a unit and an operation. It should be clear whether it includes queue or network time. A technically present metric can still lead to the wrong conclusion if it is mislabeled or compared with unlike data.
Traces Follow Work Across Boundaries
A trace represents the work associated with a request or operation as it crosses components. Within a trace, an span represents one operation. An HTTP call, database query, queue send, or cache lookup can be a span.
Traces help answer where a request spent time or which component failed. A trace for a checkout might look like this:
checkout request
validate cart
authorize payment
call payment provider
update order
query database
The exact shape depends on instrumentation. If the payment provider span takes 5 seconds while the database span is brief, the database has little reason to receive the blame.
Components in a distributed trace need to propagate trace context. This identifies a trace and, in some implementations, the parent span. It is commonly passed across HTTP or messaging boundaries. Without consistent propagation, a request becomes several disconnected traces instead of one visible path.
Recording every trace for a high-volume service can be expensive. Head-based sampling decides whether to keep a trace near the start of the operation. Tail-based sampling waits until it knows more, such as whether the operation failed or became unusually slow.
Aggressive sampling can hide rare failures or leave too few examples for comparison. Retaining every trace is not always affordable. The right policy depends on traffic, cost, and the failures that matter.
A trace can show a failed or slow span, but it does not explain application policy or customer intent.
Logs, Metrics, and Traces at a Glance
| Signal | Best question | Typical detail | Main tradeoff |
|---|---|---|---|
| Log | What happened during this event or decision? | One timestamped record with fields or text | Volume and inconsistent detail can create noise |
| Metric | How much, how often, or how has behavior changed? | Aggregated numbers over time | Efficient for trends, but individual requests disappear |
| Trace | Where did this request spend time or fail? | Connected spans across components | Sampling and propagation can limit coverage |
The table is a starting point. The categories overlap. A structured log can include trace context. A metric can represent work attached to a trace. Tools may combine these representations, but the underlying questions remain useful.
How the Three Signals Fit Together
The three signals often support each other, but not in a fixed sequence.
Metrics are good at noticing change. A dashboard can show that p95 checkout latency rose from 300 milliseconds to 4 seconds. It can also show whether request volume, error count, or queue depth moved at the same time. That narrows the search.
A trace can take the next step. A representative checkout trace might show 4 seconds spent in a payment provider call. That identifies the boundary responsible instead of forcing the team to inspect every component.
Logs add detail around that span. The payment component might record an error category, retry count, downstream response code, and correlation identifier. It does not need to log full payment details.
Later, metrics show whether the change mattered. Did the timeout rate fall? Did p95 recover? Did a queue clear? If those values do not move, the first explanation was not enough.
flowchart TD
Q[Checkout latency rises] --> M[Metric shows p95 and error trend]
M --> T[Find a representative trace]
T --> S[Trace identifies slow payment or database span]
S --> L[Logs add operation, outcome, and correlation context]
L --> C[Change or recovery is measured again]
M -. Investigation can also begin here .-> L
An alert might point directly to a log. A deployment might be visible first in a metric and traced later. The useful part is that each signal adds a different piece of evidence.
Correlation Is Context, Not Proof
A correlation identifier, often called a trace identifier, gives records shared context. It helps show that a log and a span came from the same request or operation. It does not prove that the events caused one another.
A high error count and a recent deployment can happen together. That is evidence worth investigating, but it does not prove the deployment caused the errors. A trace might show that requests used the new code before failing, while the team still needs to determine the mechanism.
Correlation depends on propagation. A trace can be complete at the HTTP boundary and incomplete between a queue and worker, or lose context in a third-party service that has no trace support. Timestamps need care too. Machines can disagree slightly, and logs, metrics, and traces may use different collection windows. Timestamp order is not perfect proof.
Identifiers should be stable enough to find and narrow enough to avoid confusion. Service names, operation names, and outcomes belong in signal data. Authorization headers, secrets, full payment details, and unnecessary personal data do not.
Instrument Before Collecting Everything
The fastest way to create noise is to collect as much telemetry as possible. The fastest way to miss an answer is to collect no explicit evidence about the operations that matter.
Start with user-visible operations and dependencies that can delay or fail them. An HTTP request metric might record volume and duration. A checkout span might include payment and order update boundaries. A failed queue operation might log the operation, outcome, and retry state.
User-visible operations and dependency calls deserve more attention than an exhaustive collection of local function calls. Not every function needs a span. Not every branch needs a log. Instrumentation that answers a real question is better than instrumentation that gives a team another dashboard.
Metric names and units need intention. payment_latency might mean one provider call or an entire workflow. queue_depth means one thing in one queue and is not automatically comparable to another.
Technical and business metrics answer different questions. Technical metrics describe rate, latency, errors, queue depth, or resource use. Business metrics describe completed orders, accepted payments, abandoned checkouts, or jobs finished. A service can be technically available while completing fewer useful operations.
Default runtime metrics are a useful starting point. CPU, memory, garbage collection, and process activity describe the host. They do not explain why an application returned an error or why a workflow reached an unexpected state.
Dashboards and Alerts Need a Point
Metrics are often used for dashboards and alerts because they aggregate well over time. An alert can compare a value with a threshold or baseline and notify an owner when a condition persists.
Logs and traces help investigate an alert, but they are not always good alert sources alone. A rare log may be easy to miss. A trace may be sampled out. A flood of nearly identical log lines can hide which users or operations are affected.
A useful alert should be tied to a meaningful condition. It should tell someone what changed, who owns the response, and where to begin checking. An alert for p95 checkout latency above a documented product limit is more actionable than an alert for every process producing a warning log.
No threshold is universally correct. Seasonal traffic, batch workloads, and deployed features can change a normal range. Alerts need enough context to avoid reporting the same noisy symptom repeatedly.
A dashboard should support a question. A checkout dashboard might show request volume, latency, payment failures, database availability, and recent deployments. It should help an engineer decide where to look next.
The Cost of "Collect Everything"
Every observability choice has a cost. Verbose logs consume storage and processing time. High-cardinality metrics can multiply stored time series. Retained traces use memory and analysis capacity. Alerts can consume attention.
Retention and sampling deserve the same attention as collection. It may be reasonable to keep short-term metrics with fine resolution, retain selected audit logs longer, and sample high-volume traces differently from rare errors. These choices depend on operational and legal needs.
More retained data is not always more knowledge. Logs and traces can also expose secrets or sensitive identifiers. A strong default is to collect an error category, useful identifiers, and non-sensitive context instead of every field.
A Practical Review Checklist
Before adding another dashboard or vendor integration, review the service itself:
- What does success look like for this operation?
- Which user-visible workload or dependency appears to be changing?
- Can we measure volume and duration without creating high cardinality?
- Do logs include the service, operation, outcome, and correlation context?
- Are secrets and sensitive request bodies excluded?
- Can trace context cross the components that need investigation?
- Are sampling and retention chosen for the evidence they preserve?
- Does an alert lead to a specific investigation path?
- Can we generate a known request or failure to verify the signals appear?
This can expose many gaps. A team might find that every service logs errors but has no request-level latency metric. Or a trace might cross HTTP calls but stop at the queue consumer. Those findings identify missing evidence.
A Small Mental Model
Logs, metrics, and traces do not provide one complete answer. They provide overlapping views with different strengths.
- Use a metric to see volume or change across many operations.
- Use a trace to follow one operation across component boundaries.
- Use a log to recover specific event and application context.
No signal is automatically correct. A metric can cover an incomplete population. A trace can be sampled. A log can omit context or contain an irrelevant event.
The goal is not perfect certainty. It is to collect enough deliberate evidence to ask better questions, test an explanation, and notice when it is wrong.
Observability comes from connecting meaningful signals to real system behavior, keeping their limits visible, and preparing the evidence before an incident forces the question.
Comments
Join the discussion on GitHub.