A customer reports that checkout "sometimes takes forever". The dashboards are green, CPU is fine, and every service claims it answered in time. In a monolith you would attach a profiler or read one log file. In a system of thirty services, three message brokers and a handful of managed cloud components, the slow request crossed eight processes, and none of them knows the whole story.
Observability is the ability to answer such questions from the outside, using the telemetry your systems emit, without shipping new code first. This article explains the three main signals (logs, metrics and traces), how OpenTelemetry has become the standard way to produce and transport them, and how to build an observability setup that works for a real engineering organisation: with instrumentation examples for Java and Node.js, a production Collector configuration, sampling, SLO-based alerting, cost control and a step-by-step rollout plan.
1. Monitoring vs. Observability: Why the Difference Matters
Monitoring and observability are often used as synonyms, but they describe different capabilities.
Monitoring watches for problems you already know can happen. You decide in advance that disk usage above 90 % or an error rate above 1 % is bad, build a check, and get an alert. Monitoring answers questions you thought of before the incident.
Observability is about the questions you did not think of. Why are only customers in one region with a specific payment provider slow since yesterday's deployment? Which of the twelve calls behind this API endpoint adds the 800 milliseconds? A system is observable when its telemetry is rich and connected enough that you can explore it and find the answer, instead of adding log lines and redeploying to learn more.
| Monitoring | Observability | |
|---|---|---|
| Typical question | Is the service healthy? | Why is this request slow for these users? |
| Prepared in advance | Checks, thresholds, dashboards | Rich, correlated telemetry |
| Works best for | Known failure modes | New, unexpected failure modes |
| Typical output | Alert | Explanation |
Distributed systems make the difference painful. Failures rarely look like "service down". They look like partial degradation: one dependency is slow, a retry storm amplifies load (see The Retry Trap), a cache stops hitting, a queue builds up. Every component can look healthy on its own while the system as a whole is failing its users.
You still need monitoring. Observability is not a replacement but the foundation that makes monitoring better: good alerts are built on the same telemetry you use to investigate, and every investigation should end with a new or improved alert.
2. The Three Signals: Logs, Metrics and Traces
The classic model of observability rests on three signal types. Each is good at answering a different kind of question, and each has a different cost profile.
| Signal | What it is | Answers | Cost driver |
|---|---|---|---|
| Metrics | Numeric measurements aggregated over time | How much, how often, how fast, in general? | Number of unique label combinations |
| Traces | The path of one request through all services, with timings | Where did this request spend its time, and where did it fail? | Number of spans stored |
| Logs | Timestamped records of individual events | What exactly happened here, with which details? | Volume in bytes |
Metrics are cheap to store and fast to query, because they are pre-aggregated: a counter of requests per status code costs the same whether you serve ten requests or ten million. That makes them ideal for dashboards, trends and alerts. The price is detail: a metric tells you that the 99th percentile latency doubled, not which request was slow or why.
Traces follow a single request across process boundaries. A trace is a tree of spans, and each span represents one unit of work, such as an incoming HTTP request, a database query or a message being processed, with start time, duration, status and attributes. Traces show causality and timing in a way no other signal can: you see that the checkout request took 2.4 seconds, that 2.1 of them were spent in the inventory service, and that the inventory service waited for a database connection.
Logs carry the details: the validation error message, the ID of the record that could not be found, the configuration value that was used. They are the most flexible signal and usually the most expensive, because every line is stored individually.
The real power comes from connecting them. A metric alert links to example traces of slow requests. A slow span links to the logs that were written during exactly that span. A log line carries the trace ID so you can jump to the full request. Without these links you have three separate tools and a lot of manual timestamp matching during an incident. With them, you have one investigation path.
Two further signals are becoming common. Continuous profiling shows which code paths consume CPU and memory in production, and OpenTelemetry is adding a profiling signal for it. Events such as deployments, feature flag changes and configuration updates are not a separate signal type but are essential context: a large share of incidents begin shortly after a change, so mark changes on your dashboards.
3. OpenTelemetry: The Standard for Producing Telemetry
For years, every observability vendor shipped its own agents, libraries and data formats. Switching vendors meant re-instrumenting every service. OpenTelemetry (OTel), a Cloud Native Computing Foundation project created from the merger of OpenTracing and OpenCensus, solved this by standardising how telemetry is produced and transported, independent of where it is stored and analysed.
OpenTelemetry is not a backend. It does not store data or draw dashboards. It consists of these parts:
| Component | Purpose |
|---|---|
| API | Vendor-neutral interfaces for creating spans, metrics and logs in your code |
| SDK | The implementation behind the API: sampling, batching, resource detection, exporting |
| Instrumentation libraries | Ready-made telemetry for frameworks and clients (HTTP servers, JDBC, Kafka, gRPC, Redis …) |
| Zero-code agents | Attach instrumentation without code changes, e.g. the Java agent |
| OTLP | The OpenTelemetry Protocol for sending telemetry over gRPC or HTTP |
| Collector | A standalone service that receives, processes and forwards telemetry |
| Semantic conventions | Standard names for attributes and metrics, such as http.request.method or db.system |
A typical architecture looks like this:
checkout (Java) web (Node.js) inventory (Go)
OTel agent OTel SDK OTel SDK
│ │ │
└────────────────┼── OTLP ───────┘
v
┌───────────────────────────┐
│ OpenTelemetry Collector │
│ limit, scrub, sample, │
│ batch, export │
└─────────────┬─────────────┘
┌────────────────┴───────────────┐
v v v
Traces Metrics Logs
Tempo/Jaeger Prometheus/Mimir Loki/Elastic
One UI (e.g. Grafana) links them:
metric -> trace -> logs
Three properties make OpenTelemetry the right default for an enterprise today:
- Vendor neutrality. Instrument once, then send the data to open-source backends, a commercial platform, or both at the same time. Changing the backend becomes a Collector configuration change instead of a project.
- Semantic conventions. When every service names the HTTP method
http.request.methodand the serviceservice.name, dashboards, queries and alerts work across teams and languages. This is easy to underestimate and very hard to retrofit. - Broad ecosystem. All major cloud providers and observability vendors accept OTLP, and many frameworks and libraries ship OpenTelemetry instrumentation directly.
The maturity differs slightly by signal and language. Traces and metrics are stable in all major languages. Logs are stable in the protocol and SDKs, and in practice most teams bridge their existing logging framework (Logback, Log4j, Winston, Pino) into OpenTelemetry rather than calling a new logging API.
4. Distributed Tracing in Depth
Tracing is the signal teams know least, and the one that pays off most in distributed systems. It is worth understanding its building blocks.
Traces and spans
A trace is identified by a 16-byte trace ID and represents one end-to-end operation, such as "user places an order". It consists of spans. Each span has:
- a span ID and the ID of its parent span (the root span has no parent),
- a name, such as
POST /ordersorSELECT orders, - a span kind:
SERVER(handles an incoming request),CLIENT(makes an outgoing call),PRODUCERandCONSUMER(send and receive messages), orINTERNAL, - start and end time,
- attributes, such as
http.response.status_code=503ororder.id=ord-8472, - events, timestamped points inside the span, such as an exception,
- a status: unset, ok or error.
Rendered as a waterfall, a trace immediately shows where the time went:
span time 0 ──── 2.4 s ──>
POST /checkout 2,430 ms ================
├ POST /orders 2,310 ms ===============.
│ ├ INSERT orders 18 ms =...............
│ ├ POST /reservations 2,150 ms .==============.
│ │ ├ wait for DB conn 1,720 ms .===========....
│ │ └ UPDATE stock 390 ms ............===.
│ └ publish event 12 ms ...............=
└ GET /recommendations 140 ms =...............
Without the trace, the order service looks slow. With it, the cause is obvious: the inventory service spent 1.7 seconds waiting for a free database connection.
Context propagation
For spans in different processes to end up in the same trace, the trace context must travel with every request. OpenTelemetry uses the W3C Trace Context standard by default. Every outgoing HTTP call carries a traceparent header:
traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
The value has four parts separated by dashes: the version (00), the trace ID (16 bytes in hex), the ID of the calling span, which becomes the parent (8 bytes), and flags (01 means the trace is sampled).
The receiving service reads the header, creates its own span as a child of the given parent, and passes the context on to its own outgoing calls. Instrumentation libraries do this automatically for common HTTP clients, servers and messaging clients. It breaks where context is not passed: a custom thread pool, a hand-written HTTP client, a message format without headers, or a proxy that drops unknown headers. Broken propagation is the most common reason for traces that "stop" at a service.
Baggage is a second W3C header that carries arbitrary key-value pairs along the whole request path, for example a tenant ID that every service should record. Use it sparingly: baggage is sent with every downstream call, including calls to third parties, so never put sensitive data into it.
What makes a good span
Automatic instrumentation creates spans for every incoming request and outgoing call. Add your own spans and attributes where the business logic lives:
- Add business identifiers as attributes: order ID, tenant, payment method, feature flag variant. They make traces searchable in business terms ("show me slow checkouts paid by invoice").
- Create spans for meaningful steps, not for every method. A span for "calculate shipping options" is useful. A span for every getter is noise and costs money.
- Record errors properly: set the span status to error and record the exception, so error traces can be found and sampled.
5. Instrumenting Services: Java and Node.js
The fastest path to useful telemetry is zero-code instrumentation, followed by targeted manual instrumentation where it adds business context.
Java: the OpenTelemetry agent
The OpenTelemetry Java agent instruments more than a hundred libraries and frameworks (Spring MVC and WebFlux, JDBC, Hibernate, Kafka, RabbitMQ, gRPC, Redis clients, HTTP clients, executors and many more) without code changes. Download the agent jar and start the application with it:
java -javaagent:/opt/otel/opentelemetry-javaagent.jar \
-jar checkout-service.jar
Configuration happens through environment variables, which fits container deployments well:
OTEL_SERVICE_NAME=checkout-service
OTEL_RESOURCE_ATTRIBUTES=service.version=2.14.0,deployment.environment.name=production,service.namespace=shop
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=1.0
service.name, service.version and deployment.environment.name are the most important attributes you will ever set: every query, dashboard and alert filters by them. Agree on them as a company standard before the first service goes live (section 14).
To add business context, use the API. The @WithSpan annotation (from the small opentelemetry-instrumentation-annotations dependency) turns a method into a span, and the current span can be enriched anywhere:
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.instrumentation.annotations.SpanAttribute;
import io.opentelemetry.instrumentation.annotations.WithSpan;
@Service
public class ShippingService {
@WithSpan("calculate shipping options")
public List<ShippingOption> optionsFor(@SpanAttribute("order.id") String orderId, Address address) {
Span.current().setAttribute("shipping.country", address.countryCode());
List<ShippingOption> options = carriers.quote(address);
Span.current().setAttribute("shipping.options.count", options.size());
return options;
}
}
For full control, create spans explicitly. The pattern is always the same: start, make current, end in finally:
private final Tracer tracer = GlobalOpenTelemetry.getTracer("shop.inventory");
public Reservation reserve(String orderId, List<Item> items) {
Span span = tracer.spanBuilder("reserve stock").startSpan();
try (Scope ignored = span.makeCurrent()) {
span.setAttribute("order.id", orderId);
span.setAttribute("order.items", items.size());
return repository.reserve(orderId, items);
} catch (RuntimeException e) {
span.recordException(e);
span.setStatus(StatusCode.ERROR, e.getMessage());
throw e;
} finally {
span.end();
}
}
Spring Boot also offers Micrometer Observation and Micrometer Tracing with an OpenTelemetry bridge. Both approaches work. The agent covers more libraries out of the box and keeps telemetry out of the build; Micrometer integrates more tightly with Spring's own abstractions. Pick one per organisation and document it, because mixing both in one service easily produces duplicate spans.
Node.js: the OpenTelemetry SDK
In Node.js, the SDK must be started before any other module is loaded, usually in a separate file passed with --import or --require:
// telemetry.ts – loaded first: node --import ./dist/telemetry.js dist/server.js
import { NodeSDK } from "@opentelemetry/sdk-node";
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
const sdk = new NodeSDK({
serviceName: "checkout-web",
traceExporter: new OTLPTraceExporter({ url: "http://otel-collector:4318/v1/traces" }),
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({ url: "http://otel-collector:4318/v1/metrics" }),
exportIntervalMillis: 15_000,
}),
instrumentations: [getNodeAutoInstrumentations({ "@opentelemetry/instrumentation-fs": { enabled: false } })],
});
sdk.start();
process.on("SIGTERM", () => void sdk.shutdown());
The file system instrumentation is disabled in the example because it creates a span for every file access, which is rarely useful and expensive. Reviewing which automatic instrumentations you actually need is part of cost control.
6. Metrics That Matter
Metrics are the backbone of dashboards and alerts. The difference between useful and useless metrics lies less in the tooling than in choosing the right ones and understanding their types.
Metric instruments
| Instrument | Behaviour | Example |
|---|---|---|
| Counter | Only increases | Requests served, orders placed, errors |
| UpDownCounter | Increases and decreases | Items in a queue, active connections |
| Histogram | Distribution of values in buckets | Request duration, payload size |
| Gauge | A current value, sampled | CPU temperature, cache size |
Creating custom metrics with the OpenTelemetry API is straightforward:
Meter meter = GlobalOpenTelemetry.getMeter("shop.checkout");
LongCounter ordersPlaced = meter.counterBuilder("shop.orders.placed")
.setDescription("Orders placed successfully")
.setUnit("{order}")
.build();
DoubleHistogram paymentDuration = meter.histogramBuilder("shop.payment.duration")
.setDescription("Time to authorise a payment")
.setUnit("s")
.build();
// in the business code
ordersPlaced.add(1, Attributes.of(AttributeKey.stringKey("payment.method"), "card"));
paymentDuration.record(elapsedSeconds, Attributes.of(AttributeKey.stringKey("payment.provider"), "adyen"));
RED, USE and the golden signals
You do not need hundreds of metrics per service. Two simple methods cover most needs:
- RED for request-driven services: Rate (requests per second), Errors (failed requests per second), Duration (latency distribution). Three graphs per service answer "is it working for its callers?".
- USE for resources such as CPU, memory, connection pools and queues: Utilisation (how busy), Saturation (how much work is waiting), Errors.
Google's four golden signals (latency, traffic, errors, saturation) combine both views. If every service shows RED metrics for its endpoints and USE metrics for its critical resources, in the same layout, an on-call engineer can read any team's dashboard at three in the morning.
Percentiles, not averages
Averages hide the users who suffer. If 99 requests take 50 ms and one takes 5 seconds, the average is about 100 ms and looks fine. Use percentiles: p50 for the typical experience, p95 and p99 for the tail, where timeouts, retries and queueing live. One page view often triggers dozens of backend calls, so a slow p99 per call becomes a common experience per page.
Use histograms to measure latency, not pre-computed percentiles. Histogram buckets can be aggregated across instances and time windows; percentiles cannot (the average of two p99 values is not the p99 of the combined traffic). In Prometheus, the p99 across all instances of a service is calculated from the buckets:
histogram_quantile(0.99,
sum by (le, service_name) (rate(http_server_request_duration_seconds_bucket[5m])))
Cardinality: the silent cost driver
Every unique combination of metric name and attribute values is a separate time series. A request counter with the attributes method (5 values), route (40 values) and status_code (10 values) produces up to 2,000 series per service instance, which is fine. Add user_id with a million values and you create a billion potential series, which no metrics backend will survive or bill kindly.
The rule is simple: metric attributes must have a small, bounded set of values. Routes as templates (/orders/{id}), not raw paths (/orders/8472). Status code classes when individual codes are not needed. Customer IDs, order IDs, e-mail addresses and request IDs belong in traces and logs, never in metric attributes.
7. Logs That Help Instead of Hurt
Most systems produce far too many logs that help far too little: unstructured text, inconsistent levels, no way to connect a line to the request it belongs to, and the occasional password in plain text. Better logs follow four rules.
Structure every log line
Write logs as structured JSON with consistent field names, not as free text. Structured logs can be filtered and aggregated reliably (order.id = "ord-8472" AND level = "ERROR") instead of with fragile text searches.
{
"timestamp": "2026-11-28T14:03:12.418Z",
"level": "ERROR",
"service.name": "inventory-service",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"span_id": "a3ce929d0e0e4736",
"message": "Stock reservation failed",
"order.id": "ord-8472",
"error.type": "PoolTimeoutException",
"db.pool.active": 20,
"db.pool.max": 20
}
Correlate logs with traces
The trace_id and span_id fields are what turn logs from a separate haystack into part of the investigation. The OpenTelemetry Java agent puts them into the logging context (MDC) automatically, so a Logback pattern or JSON encoder only has to include them:
<pattern>%d{ISO8601} %-5level [%X{trace_id},%X{span_id}] %logger{36} - %msg%n</pattern>
Alternatively, the agent's log bridge sends log records directly via OTLP, with trace context attached, so they arrive in the log backend already linked to their spans.
Use levels consistently
- ERROR: a request or job failed and someone may need to act.
- WARN: something unexpected happened, but the system handled it (a retry succeeded, a fallback was used).
- INFO: important business and lifecycle events (service started, order placed, configuration loaded).
- DEBUG: details for development; disabled in production by default and enabled temporarily for one service when needed.
A good test: if a production incident shows hundreds of ERROR lines per minute that nobody acts on, the level is wrong, and real errors will drown in the noise.
Never log secrets or unnecessary personal data
Logs are copied to many places, kept for months and read by many people. Never log passwords, access tokens, API keys, session cookies or full payment data, and log personal data only where there is a clear purpose and a retention rule (GDPR applies to logs too). Redact at the source and again in the Collector (section 9). Logging the Authorization header "for debugging" is one of the most common ways tokens leak; see the OAuth 2.0, OpenID Connect and JWT article for why that is so dangerous.
8. Observability in Asynchronous and Event-Driven Systems
Request-response calls are the easy case. In event-driven architectures, work continues after the original request has returned: an order event is consumed seconds later, a batch job processes thousands of messages, a saga waits for a reply that may take minutes.
Propagating context through messages
The trace context travels in message headers, just as it travels in HTTP headers. The OpenTelemetry Java agent instruments the Kafka and RabbitMQ clients and writes the traceparent into the record headers when producing, and reads it when consuming. The consumer span becomes part of the producer's trace, so you see the whole flow: HTTP request, database write, event published, event consumed, follow-up actions.
For messages without headers, or brokers that strip them, the context can be stored in the message payload as part of the event envelope. Design the event schema with a field for it from the start.
Links instead of parents
Not every consumer fits the parent-child model. A consumer that processes a batch of 500 messages in one operation cannot have 500 parents. OpenTelemetry solves this with span links: the batch span links to the producer spans of the individual messages. Tracing tools show these links, so you can still navigate from a message to the batch that processed it.
What to measure in asynchronous flows
Latency of asynchronous work is invisible in request metrics, so measure it explicitly:
- Consumer lag: how far consumers are behind the newest messages. Lag that keeps growing is one of the earliest signs of trouble.
- End-to-end latency: time from event creation to completed processing, measured from a timestamp in the event.
- Dead-letter queue size and rate: every message that lands there is a failed business operation.
- Processing outcome per message type: succeeded, retried, rejected, dead-lettered.
A queue that grows silently while all services report healthy request metrics is a classic blind spot. Alert on lag and end-to-end latency, not just on errors.
9. The OpenTelemetry Collector: Your Telemetry Pipeline
Services can export telemetry directly to a backend, but in production you almost always want a Collector in between. It decouples applications from backends and gives you one central place to control what happens to the data.
A Collector configuration consists of receivers (how data comes in), processors (what happens to it) and exporters (where it goes), connected in pipelines per signal. Here is a realistic configuration for a gateway Collector:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 20
attributes/scrub:
actions:
- key: http.request.header.authorization
action: delete
- key: user.email
action: hash
tail_sampling:
decision_wait: 10s
policies:
- name: keep-errors
type: status_code
status_code:
status_codes: [ERROR]
- name: keep-slow
type: latency
latency:
threshold_ms: 1000
- name: sample-the-rest
type: probabilistic
probabilistic:
sampling_percentage: 10
batch: {}
exporters:
otlp/tempo:
endpoint: tempo:4317
tls:
insecure: true
prometheusremotewrite:
endpoint: http://mimir:9009/api/v1/push
otlphttp/loki:
endpoint: http://loki:3100/otlp
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, tail_sampling, batch]
exporters: [otlp/tempo]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheusremotewrite]
logs:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlphttp/loki]
The processors do the important work:
memory_limiterprotects the Collector itself: under pressure it refuses data instead of crashing. Always put it first.attributes/scrubremoves or hashes sensitive attributes centrally, as a safety net behind the redaction in the services.tail_samplingdecides which traces to keep after seeing them completely (section 10).batchgroups data before export, which reduces network calls and backend load considerably.
Some components, including tail_sampling and prometheusremotewrite, are part of the contrib distribution of the Collector (otelcol-contrib) or of a vendor distribution, not of the minimal core build. Larger organisations often build their own distribution with the OpenTelemetry Collector Builder, containing exactly the components they use.
Agent and gateway
Two deployment patterns are usually combined:
Service pods
│ OTLP
v
Collector agent (per node or sidecar)
- adds host and Kubernetes metadata
- buffers locally, close to the app
│
v
Collector gateway (scaled cluster)
- tail sampling, scrubbing, routing
- holds the backend credentials
│
v
Backends (traces, metrics, logs)
The agent runs close to the applications, as a DaemonSet on every Kubernetes node or as a sidecar, and enriches data with infrastructure metadata. The gateway is a central, horizontally scaled Collector service that applies company-wide policies and holds the backend credentials, so no application ever needs them. Tail sampling requires that all spans of one trace reach the same gateway instance; the loadbalancing exporter in the agent tier routes spans by trace ID to achieve this.
10. Sampling: Keeping the Signal, Dropping the Cost
Recording every span of every request is affordable at small scale and absurdly expensive at large scale. A service handling 5,000 requests per second, with 20 spans per request, produces 100,000 spans per second, or over 8 billion per day. Sampling keeps the traces you need and drops the rest.
Head sampling
With head sampling, the decision is made when the trace starts, in the first service, and passed downstream in the sampled flag of the traceparent header. The standard configuration is a parent-based ratio sampler:
OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1
The root service keeps 10 % of traces, and every downstream service follows the decision of its parent, so traces are complete. Head sampling is cheap and simple, but blind: at the start of a request nobody knows whether it will fail or be slow, so 90 % of your error traces are dropped too.
Tail sampling
With tail sampling, the Collector buffers all spans of a trace for a short time, sees the complete trace, and then decides. The configuration in section 9 keeps every trace with an error, every trace slower than one second, and 10 % of the rest. This keeps the interesting traces at a fraction of the cost. The price is infrastructure: the gateway must hold traces in memory during the decision window, and all spans of a trace must reach the same instance.
A practical strategy
| Situation | Recommendation |
|---|---|
| Small system, low traffic | Keep everything (ratio 1.0); revisit when costs grow |
| Medium traffic | Head sampling at 10 to 25 % plus tail sampling for errors and slow requests at the gateway |
| High traffic, large estate | Tail sampling at the gateway; optionally light head sampling to protect the pipeline |
| Critical business flows (payments) | Dedicated tail sampling policy that keeps all traces of that flow |
Metrics are not affected by trace sampling when they are recorded by the SDK from all requests. That is why rates, error ratios and latency percentiles should always come from metrics, not from counting sampled traces.
11. From Telemetry to Action: SLOs and Alerting
Collecting telemetry is not the goal. The goal is to notice problems that matter to users, early and with few false alarms, and to fix them quickly. Service level objectives are the most effective tool for the first part.
SLIs, SLOs and error budgets
- A service level indicator (SLI) measures user experience as a ratio: good events divided by all events. For example: share of checkout requests that succeed in under 800 ms.
- A service level objective (SLO) sets the target: 99.9 % of checkout requests over 30 days are good.
- The error budget is what remains: 0.1 % of requests may be bad. Over 30 days, that equals about 43 minutes of complete unavailability, or a longer period of partial degradation.
error budget (time) = (1 - 0.999) × 30 days × 24 h × 60 min = 43.2 minutes
burn rate = observed error ratio / allowed error ratio
e.g. 1.44 % errors / 0.1 % allowed = burn rate 14.4
The error budget turns reliability into a shared decision instead of an argument. While budget is left, teams ship features at full speed. When it is used up, reliability work takes priority. This is far more productive than debating whether a 0.3 % error rate is "bad".
Alert on symptoms, using burn rates
Classic alerts fire on causes: high CPU, a full disk, a restarted pod. Many of them never affect users, which trains on-call engineers to ignore alerts. SLO-based alerts fire on symptoms: users are getting errors or slow responses faster than the budget allows.
The established method is multi-window burn-rate alerting:
| Severity | Condition | Meaning |
|---|---|---|
| Page (wake someone up) | Burn rate above 14.4 over the last hour and over the last 5 minutes | At this speed, 2 % of the monthly budget is gone within one hour |
| Page | Burn rate above 6 over the last 6 hours and over the last 30 minutes | 5 % of the budget gone in 6 hours |
| Ticket (next working day) | Burn rate above 1 over the last 3 days and over the last 6 hours | The budget will run out before the end of the period |
The long window ensures the problem is significant, and the short window ensures it is still happening, so the alert resolves quickly after a fix.
Every alert needs a path to the cause
An alert should link to a dashboard showing the SLI, the RED metrics of the service and its dependencies, and exemplars: sample trace IDs attached to histogram buckets, so the latency spike on the graph is one click away from a real slow trace. Add a short runbook to every paging alert: what it means, what to check first, how to mitigate.
12. Walking Through an Incident with Correlated Telemetry
The value of observability becomes clear in an incident. Here is how the checkout problem from the introduction is solved when logs, metrics and traces are connected.
14:02: the alert. The checkout SLO burn-rate alert fires: burn rate 16 over the last hour and the last five minutes. Users are affected now.
14:04: the dashboard. The checkout service's RED dashboard shows normal traffic, a slightly higher error rate, and a p99 latency that jumped from 600 ms to 4.2 seconds. The deployment marker shows no checkout release today, but there was a release of the inventory service at 13:50.
14:06: an exemplar. Clicking a high point on the latency histogram opens an exemplar trace. The waterfall shows the same picture as in section 4: 1.7 of 2.4 seconds are spent in the inventory service, in a span "wait for DB connection".
14:08: the logs of that trace. Filtering logs by the trace ID shows the inventory service's warning: connection pool exhausted, 20 of 20 connections in use, request waited 1,700 ms. Searching all inventory logs for this message shows it started at 13:52.
14:10: the metrics of the resource. The USE view of the inventory service shows pool utilisation at 100 % and a growing number of waiting threads since 13:52. The database itself is fine: CPU at 30 %, query latency normal. The bottleneck is in front of the database, not in it.
14:14: the cause. The release at 13:50 added a new stock report query to the reservation path. A trace of a reservation shows it running inside the same transaction, holding a connection for 300 ms per request instead of 15 ms. At peak traffic, 20 connections are no longer enough.
14:20: mitigation and follow-up. The team rolls back the inventory release, and the burn rate drops within minutes. Follow-ups: move the report query out of the transaction, add an alert on pool saturation, and add a span attribute for the transaction duration.
Twenty minutes from alert to mitigation, without guessing, without adding log lines, and without a war room of ten people each looking at their own service. That is the practical difference observability makes.
13. Cost, Cardinality and Data Governance
Observability can become one of the largest infrastructure bills in a company, and telemetry is also data that falls under privacy and security rules. Both need governance from the start, not after the first surprising invoice.
Where the cost comes from
| Signal | Main cost driver | Main lever |
|---|---|---|
| Metrics | Number of active time series (cardinality) | Bounded attribute values, drop unused metrics |
| Traces | Number of spans ingested and stored | Sampling, fewer low-value spans |
| Logs | Bytes ingested and retention | Levels, structured fields instead of dumps, sampling of repetitive logs |
Practical measures that consistently save money without losing insight:
- Drop what nobody uses. Many backends can show which metrics were never queried. Automatic instrumentation creates many metrics by default; disable the ones you do not need.
- Tiered retention. Keep detailed data for days (debugging), aggregated metrics for months (trends and capacity), and only what compliance requires for longer.
- Sample logs for repetitive events such as health checks and successful polls, while keeping every warning and error.
- Set budgets per team. Make telemetry volume visible per service. Teams that see their own costs make better decisions than a central team that only sees the total.
Data protection and security
Telemetry contains more personal and sensitive data than most teams expect: IP addresses, user IDs, URLs with query parameters, error messages with input values, headers. Treat telemetry pipelines like any other data pipeline:
- Define which attributes may contain personal data, and redact or hash everything else, in the SDK and again in the Collector.
- Restrict access to raw logs and traces; not everyone who needs dashboards needs to read request payloads.
- Set retention periods that match the purpose and document them.
- Encrypt telemetry in transit (TLS for OTLP) and authenticate services to the Collector, so the pipeline cannot be used to inject or exfiltrate data.
14. Rolling Out Observability in an Enterprise
Tools are rarely the hard part. The hard part is getting fifty teams to produce consistent telemetry that works together. The organisations that succeed treat observability as a platform product with clear standards, not as a tool each team picks individually.
Step 1: Define the conventions
Before broad rollout, agree on a short standard and publish it:
- Required resource attributes:
service.name(unique, stable, lowercase with dashes),service.namespace(team or domain),service.version,deployment.environment.name(production,staging,development). - OpenTelemetry semantic conventions for everything they cover; a small company prefix for business attributes (
shop.order.id,shop.tenant). - Log format: JSON with fixed field names, including
trace_idandspan_id. - What must never be recorded: tokens, passwords, payment data, health data.
Step 2: Build the golden path
Make the right thing the easy thing. Provide a base container image or build plugin that includes the agent, the configuration and the logging setup, so a new service is observable without anyone reading documentation. Provide the Collector infrastructure centrally, with standard dashboards for RED and USE metrics that work for every service following the conventions.
Step 3: Start with one critical journey
Do not try to instrument everything at once. Pick one important business flow, such as checkout or login, instrument every service on its path, define its SLO, and run the first incidents with the new tools. A success that people experienced in a real incident convinces more teams than any presentation.
Step 4: Expand and improve
Roll out to further journeys, add business attributes and custom metrics, introduce tail sampling when volume grows, and review alerts regularly: every alert that fired without requiring action should be fixed or removed.
Anti-patterns to avoid
| Anti-pattern | Why it hurts |
|---|---|
| Every team chooses its own tools and names | No end-to-end traces, no shared dashboards, many bills |
| Dashboards with 80 graphs | Nobody knows which graph matters during an incident |
| Alerts on every cause | Alert fatigue; real problems get ignored |
| Logging everything at INFO "just in case" | High cost, real events drowned in noise |
| User IDs in metric labels | Cardinality explosion, unstable metrics backend |
| Observability as a project with an end date | Telemetry decays as services change; it needs ownership |
15. Conclusion and Checklist
Observability turns a distributed system from a set of black boxes into something you can reason about. Metrics tell you that something is wrong and how much it matters. Traces show where in the chain of services the problem sits. Logs explain what exactly happened. Connected through trace IDs, exemplars and shared conventions, the three signals let a team go from alert to cause in minutes instead of hours.
OpenTelemetry has made the instrumentation side a solved problem in principle: one open standard, supported by every major language, framework and vendor, with the Collector as a flexible pipeline in between. What remains is engineering discipline: consistent names, bounded cardinality, sensible sampling, SLO-based alerts and careful handling of the data you collect.
Use this checklist for a new service or a review of an existing one:
-
service.name,service.versionanddeployment.environment.nameare set and follow the company standard. - Automatic instrumentation is enabled; unnecessary instrumentations are switched off.
- Trace context propagates through HTTP calls, messaging and custom thread pools (no broken traces).
- Important business steps have spans with business identifiers as attributes.
- Errors set the span status and record the exception.
- Every endpoint has RED metrics; critical resources (pools, queues) have USE metrics.
- Latency is measured with histograms; dashboards show p50, p95 and p99.
- Metric attributes have bounded values; no IDs in metric labels.
- Logs are structured JSON with
trace_idandspan_id; no secrets or unnecessary personal data. - Asynchronous flows have consumer lag, end-to-end latency and dead-letter metrics.
- Telemetry goes through a Collector with memory limits, scrubbing and batching.
- Sampling keeps all errors and slow requests.
- The service's critical journeys have SLOs with burn-rate alerts and runbooks.
- Retention, access and costs of the service's telemetry are known.
References
- OpenTelemetry documentation: https://opentelemetry.io/docs/
- OpenTelemetry semantic conventions: https://opentelemetry.io/docs/specs/semconv/
- OpenTelemetry Java agent: https://opentelemetry.io/docs/zero-code/java/agent/
- OpenTelemetry for Node.js: https://opentelemetry.io/docs/languages/js/
- OpenTelemetry Collector configuration: https://opentelemetry.io/docs/collector/configuration/
- W3C Trace Context: https://www.w3.org/TR/trace-context/
- Google SRE Workbook, Alerting on SLOs: https://sre.google/workbook/alerting-on-slos/
- Google SRE Book, Monitoring Distributed Systems: https://sre.google/sre-book/monitoring-distributed-systems/
- Prometheus, Histograms and summaries: https://prometheus.io/docs/practices/histograms/




