Introduction to Observability
local graph
Chapter 1 — Introduction to Observability
Section titled “Chapter 1 — Introduction to Observability”Software systems today are no longer confined to a single process or a single machine. A single user action like clicking “Buy Now” can cascade through dozens of services, threads, APIs, and databases. Each layer introduces latency, dependencies, and failure points.
When something goes wrong, the question seems simple: What happened? But in distributed systems, that answer is fragmented. One microservice may succeed while another fails silently or retries in the background. Logs from different services don’t align. Each service recorded only its own small truth, unaware of the bigger picture.
This is where observability becomes essential.
In this chapter, we’ll walk through a real-world e-commerce system to understand why traditional monitoring falls short and how traces, logs, and metrics reveal what distributed systems are doing. You will see why OpenTelemetry has become the foundation for cross-language observability and begin to understand what an observable Rust system looks like.
In this chapter, we will cover the following key topics:
- Why Observability Matters in Distributed Systems
- The Three Pillars of Observability in Action
- What Is OpenTelemetry?
- Building an Observability Mindset
How This Book Works
Section titled “How This Book Works”Throughout this book, we keep the examples Rust-friendly, highlighting how async execution, ownership, and concurrency shape how you add observability to your systems. We use a Rust-based e-commerce system with services for cart management, payments, inventory, and user accounts as our running example. Each chapter revisits this system to demonstrate new observability concepts in progressively deeper contexts. We will learn more about e-commerce systems in Chapter 3.
Why Observability Matters in Distributed Systems
Section titled “Why Observability Matters in Distributed Systems”It’s 10 p.m. on a Friday. The deployment pipeline shows all green checks. Dashboards are calm. Your shopping-cart system composed of the cart‑service, inventory‑service, payment‑service, and user‑service has been stable for weeks.
Then, a support ticket appears:
"Customers are being charged, but their orders are not getting confirmed."At first glance, everything looks fine. CPU utilization is low, memory steady, and 200 OK responses dominate the logs. You run another test, the charge succeeds again, but the orders table remains empty. Somewhere between payment and cart, reality diverged.
The team gathers on a call. Logs from one service don’t match timestamps from another. You grep through gigabytes of text, SSH into multiple pods, and realize there is no single thread of truth. Each microservice recorded its own small truth, unaware of the bigger picture.
When faced with an unknown failure, teams instinctively progress through three familiar approaches, each revealing something, but never the complete picture. This gets trickier when async tasks interleave and clock skew makes timestamps diverge across services, both common realities in Rust backends, too. Log alignment gets messy when clocks drift and async work overlaps.
What Each Tool Reveals (and Misses)
Section titled “What Each Tool Reveals (and Misses)”When troubleshooting fails, teams typically reach for three familiar tools. Each reveals something important, but none tell the complete story:
| Tool | Reveals | Cannot explain |
|---|---|---|
| Debugging | Code path and execution flow (in a single process) | Why distributed services behave differently, async failures, network timeouts |
| Metrics | Trends, anomalies, and the rate of issues | Which internal operation caused the spike? Why do requests slow down? Causality? Causality |
| Monitoring (threshold checks/health probes) | System health against known thresholds | How requests flow between services, why an error occurred, and unexpected behavior |
Table 1.1 – What each troubleshooting tool reveals and what it cannot explain
In our shopping cart failure, monitoring detected an elevated error rate. Debugging couldn’t reproduce the issue locally. Metrics showed latency spiked during checkout, but not why.
What was needed wasn’t a better tool, it was a different kind of visibility: one that correlates events across services and explains not just that something happened, but why.
That’s observability.
From Guesswork to Understanding
Section titled “From Guesswork to Understanding”Monitoring collects predefined signals. Observability turns those signals into understanding. It moves you from reacting to symptoms toward interpreting system behavior.
Think of monitoring as installing alarms and observability as installing windows. Alarms tell you something is wrong. Windows let you see what is happening inside. Those windows do not appear automatically; you must design and place them while building the system.
In the shopping cart failure, monitoring might show that the checkout error rate surged. Without deeper insight, you fall back on instinct and guesswork to explain why. Observability replaces that uncertainty with evidence. It lets you trace a single request from the API gateway through multiple services and pinpoint where latency or logic diverged.
This deeper visibility does not appear automatically. It must be designed into the system. Each component must emit consistent, correlated signals such as traces, logs, and metrics that describe not only its internal state but also its relationship to other components.
When a system can narrate its own behavior under any condition, even one you never predicted, it becomes observable.
The Three Pillars of Observability in Action
Section titled “The Three Pillars of Observability in Action”Every engineering team eventually reaches this point. Dashboards look fine, logs look busy, and yet the truth lies somewhere in between. When debugging and monitoring leave you relying on instinct and guesswork, observability provides the deterministic clarity that instinct cannot.
Observability delivers this clarity through three foundational signals: traces, logs, and metrics. The industry often refers to these as the “three pillars of observability.” OpenTelemetry uses the broader term “signals,” which we will expand on as we go. For now, these three signals are your core toolkit. Each replaces assumptions with verifiable data and reveals how the system actually behaves in real time. For Rust systems, spans often align with async boundaries and tasks, which makes them especially valuable for understanding concurrent work.
Each signal offers a different perspective on the same event:
- Traces tell the story of a request as it flows through services.
- Logs explain what happened within those services.
- Metrics show how often and how severely it happens.
Together, they give you a correlated, end-to-end understanding that moves you from detection to explanation, and eventually, prevention.

figure 1.1
Figure 1.1 – The observability feedback loop from metrics to traces to logs to action
Traces: Following the Request’s Journey
Section titled “Traces: Following the Request’s Journey”Imagine looking over the shoulder of a single user clicking Checkout.
The request begins at the API gateway and moves through the cart‑service, inventory‑service, and payment‑service. In an ideal world, the entire journey completes in under 200 milliseconds. In distributed reality, that journey may branch across threads, network hops, and asynchronous handlers that never line up.
A trace captures this journey end to end. It is composed of spans, each representing a single operation such as calling a database, making an HTTP request, or executing a function. Each span records:
- A name identifying the operation (e.g.,
process_payment) - Start and end timestamps (duration is derived from these)
- Status (
Unset,Ok, orError) - Attributes, key-value metadata such as
http.method,http.route, andenduser.id - A parent span reference linking it to the calling operation
- A SpanContext containing the trace ID and span ID
Spans also support Events (timestamped annotations) and Links (cross-trace references), which we will cover in Chapter 4.
In Rust async code, wrap spans around futures so context survives across .await boundaries.
This structured view makes it possible to follow a request through the system and identify where delays or failures occur.
In our failing checkout example, the trace immediately reveals the story. The payment step takes far too long, causing the gateway to return an error and skip the stock update entirely. To clarify the sequence, here is a visual representation of the failing request.

Sequence diagram illustrating interaction flow among User, API Gateway, Cart Service, Payment Service, and Inventory Service during checkout process.
Figure 1.2 – A distributed trace of a failed checkout request
The trace pinpoints the issue, a slow operation in the payment service, and shows exactly how it affected the request. It also makes the skipping work obvious. There is no span for update_stock because the call never happened.
Behind the scenes, each span carries a shared trace ID that is propagated through HTTP headers (the W3C traceparent header). This ensures that whether the call travels between Rust microservices, a Go backend, or a Java API, every service reports its part of the journey in a unified way.
While traces reveal the path a request takes, logs explain what happened inside each step along that path.
Logs: The Narrative of What Happened
Section titled “Logs: The Narrative of What Happened”If traces are the system’s map, logs are its journal.
Logs describe discrete events such as “Order ID created,” “Token expired,” “Payment gateway timeout.” They hold the fine-grained context you need to answer why something failed. Use structured logs (often JSON) and include trace_id and span_id so you can jump from a span to its related logs. Treat structured JSON as the default and keep plain text for local tinkering.
Traditionally, teams logged text lines with inconsistent formats, making correlation nearly impossible. But with modern structured logging and context propagation, logs now participate in the same distributed story as traces.
When exported to a backend such as Loki or Elasticsearch, a log carries a trace_id and a span_id. That means a developer inspecting a slow checkout span in a tracing dashboard (such as Jaeger or Grafana Tempo) can click directly into the corresponding logs.
In our incident, the logs reveal the missing story:
[INFO] trace_id=0af7651916cd43dd8448eb211c80319c span_id=b9c7a3c4e2f81a56PaymentService: Error: TokenExpired("Gateway token expired after 10 min TTL")The service wasn’t broken; the token expired silently due to a misconfigured TTL. Metrics showed the frequency, traces showed the delay, and logs revealed the cause.
That chain - metrics -> traces -> logs - is how observability turns raw data into human insight.
Metrics: The Pulse of the System
Section titled “Metrics: The Pulse of the System”While traces and logs explain individual events, metrics provide the big picture over time. They tell you whether your system is healthy, trending toward overload, or quietly degrading. Counters are best for event totals, histograms for latency (avoid averages), and gauges for in-flight work, such as queue depth.
Metrics are numerical measurements collected continuously, including CPU usage, request counts, error rates, queue lengths, response times. Unlike logs, which are high volume and detailed, metrics are aggregated and ideal for real-time alerts.
Let’s return to the checkout example. Metrics might show:
- Error rate for /checkout spiking to 12%
- 95th percentile latency rising to 1.9 seconds
- Payment service timeouts are increasing sharply
These indicators are your early-warning system. They don’t tell you why, but they tell you where to look. Once the alert fires, traces and logs help you reconstruct the narrative.
A healthy observability setup lets you move seamlessly:
- Metric alert -> detect abnormal trend
- Trace view -> isolate slow or failing service
- Logs -> confirm root cause
This triad is what makes distributed debugging predictable.
Bringing It Together
Section titled “Bringing It Together”Observability shines when these three signals converge into a unified view. In our shopping-cart story:
- Metrics triggered an alert for high checkout latency.
- Traces pinpointed slow spans in payment-service.
- Logs revealed an expired token error.
The issue wasn’t in networking or database latency; it was a configuration oversight. Without observability, it could have taken hours or even days to root cause. With observability, it’s minutes.
This pattern is universal across Rust, Go,.NET, and other languages. The instrumentation syntax varies, but the philosophy stays the same. Observability empowers engineers to treat production as a living laboratory, not a mystery.
What Is OpenTelemetry?
Section titled “What Is OpenTelemetry?”By now, you have seen how traces, logs, and metrics together form the foundation of observability. But in most organizations, those signals don’t come from a single system. They come from a patchwork of tools: Prometheus for metrics, Loki for logs, and Jaeger or Zipkin for traces. While these tools are powerful, they often operate in silos. Each requires its own specific SDK, uses different data protocols, and lacks a native way to correlate a metric spike in one tool with a trace in another.
For distributed systems written in multiple languages, e.g., a microservice written in Rust talking to one written in Java, this fragmentation is painful. Without a standard, you might end up with incompatible propagation headers (e.g., B3 vs. W3C) or inconsistent attribute naming conventions (e.g., user_id vs. user.id?). Even if every service has “observability” the entire system remains a black box because the data isn’t unified.
OpenTelemetry solved this by merging two earlier projects, OpenTracing (focused on tracing APIs) and OpenCensus (focused on metrics and stats), under the Cloud Native Computing Foundation (CNCF). The result is a single, vendor-neutral standard that defines how telemetry should be captured, correlated, and exported. Today, OpenTelemetry is one of the most active CNCF projects, second only to Kubernetes, providing the “lingua franca” for modern observability.
OpenTelemetry is not a tool you install; it is a vendor-neutral framework of specifications, APIs, SDKs, and tooling. To achieve a unified view of your system, it separates the telemetry lifecycle into three distinct layers:
APIs and SDKs: This is the Generation Layer. Developers use the API to instrument code, create spans, record metrics, and emitting logs. The SDK then implements that API, handling the heavy lifting of sampling and batching. This separation is key: library authors can instrument their code without knowing which backend you use, while application owners retain full control over the data flow.
Context Propagation: This is the Stitching Layer. The real power of OpenTelemetry lies in its ability to follow a request across service boundaries. By following the W3C Trace Context specification, OpenTelemetry injects standardized headers into every request:
traceparent: 00-0af76519e8d06b3ffdd9f67a2a5803df-00f067aa0ba902b7-01These headers act as a “passport”, ensuring that a trace started in a Rust service continues seamlessly through Java or any other language, creating a single, unbroken narrative of the request.
Collector and Exporters: This is the Transmission Layer. Once the telemetry is generated and correlated, it needs to reach its destination. Instead of forcing your application to talk directly to a specific database, which would couple your code to a vendor, the OpenTelemetry Collector acts as a centralized data pipeline. It receives telemetry from all your services, processes it (filtering or scrubbing sensitive data), and exports it to your chosen backends, such as Jaeger, Prometheus, or Azure Monitor.

figure 1.3
Figure 1.3 – The OpenTelemetry pipeline routing telemetry from a Rust application through the Collector to multiple backends
Connecting these layers is OTLP (OpenTelemetry Protocol). This is the “wire format” and the default recommended protocol for transmitting telemetry between SDKs, the Collector, and modern backends. By using OTLP, your application remains completely agnostic of where its data eventually lands.
For Rust developers, OpenTelemetry isn’t a new paradigm but a powerful extension of the existing tracing ecosystem. Since industry standard frameworks like Axum and Tonic integrate with the tracing ecosystem for diagnostics, you can transform local logs into rich, distributed traces simply by adding the tracing‑opentelemetry bridge to your existing #[tracing::instrument] attributes. Under the hood, the opentelemetry and opentelemetry_sdk crates handle the heavy lifting, managing context propagation and batching data to protect performance, and granting you a “plug-and-play” architecture where you can swap backends like Jaeger or Tempo without touching a line of business logic. We will set up this full pipeline in Chapter 4.
Your Rust microservice, your Python API, and your Kubernetes ingress can all share the same trace ID, building a coherent narrative across your entire system.
Building an Observability Mindset
Section titled “Building an Observability Mindset”When observability enters a team’s vocabulary, it is often framed as a tooling decision, which SDK to adopt, which dashboard to use, or which backend to choose. But the real shift happens when observability stops being a tooling project and becomes a thinking habit, a way of asking better questions about system behavior.
Observability-Driven Development (ODD) means designing instrumentation alongside your logic. When you build a new feature, you ask: What would I need to see if this fails in production? What spans, metrics, and logs would help me debug it? This forward-thinking approach ensures that every new feature leaves behind a traceable, measurable footprint. In Rust, that might mean adding spans around async boundaries or long-running tasks, emitting domain-specific metrics for each business operation, and preferring structured logs over println-style output.
Equally important is the shared mental model that observability fosters. When engineers share dashboards, trace views, and alerts across teams, they build collective intuition about how the system behaves. This shared context shortens incident response, improves code reviews, and creates a common language between developers and operators. Observability becomes not just a data layer, but a foundation for collaboration.
Chapter Summary
Section titled “Chapter Summary”This chapter introduced a vital shift from reacting to symptoms to understanding root causes. Through the lens of a failing Rust e-commerce system, we explored the three pillars, Traces, Logs, and Metrics, and saw how OpenTelemetry unifies them into a vendor-neutral standard using W3C Trace Context.
For the Rust developer, this is a natural evolution rather than a pivot. By building on the tracing ecosystem you already use, you can transform local diagnostics into global insights with minimal friction. This technical foundation supports the observability mindset, a cultural shift toward building systems that can explain themselves through data rather than guesswork.
In the next chapter, we shift our focus inward to the engine itself. We will explore the Rust memory model through an observability lens, discovering how ownership, borrowing, and lifetimes do more than just prevent bugs; they provide the deterministic data, such as precise allocation tracking and thread-safe context propagation, needed to build truly transparent systems.