Cloud & Data Centers

Monitoring, Logs, Metrics and Traces

What each kind of telemetry shows, how they work together, and how to alert without noise.

Key takeaways

  • Metrics are cheap to store and good for trends and alerts, but they summarize away individual detail.
  • Logs record specific events and are most useful when structured and searchable.
  • Traces show the path and timing of a single request across services.
  • Alert on symptoms users feel, and make every alert something a person can act on.
  • Control cost and risk by limiting high-cardinality labels, setting retention and keeping secrets out of telemetry.

Monitoring is how you learn what your systems are doing without guessing. Three kinds of data carry most of the load. Metrics are numbers tracked over time, logs are records of individual events, and traces follow one request as it passes through many parts of a system. Metrics tell you something is wrong, traces help you find where, and logs often tell you why.

You can start small with one uptime check and a few graphs. What matters is that the data answers questions you actually have when things break.

Metrics

A metric is a named measurement with a timestamp, usually with labels such as server name or response status. Common shapes are counters that only go up, like total requests, gauges that rise and fall, like memory in use, and histograms that count how many values fall into ranges, like response times.

Because they're just numbers, metrics are compact and quick to graph over weeks. That makes them ideal for dashboards, alerts and capacity planning.

Their weakness is detail. A graph can show errors rising at 2:14 without telling you which customer or which input caused them. Adding a label for every user ID seems to help, but each unique combination of labels creates a separate series. This is called high cardinality, and it can overwhelm a metrics system or your bill.

A useful starting set for a service is sometimes called the four golden signals: latency, traffic, errors and saturation, meaning how full your resources are.

Reading a graph without being fooled

How a metric is summarized changes what you see. An average response time hides a slow minority, so plot percentiles such as the median, 95th and 99th. Don't average percentiles from several servers, since the result isn't the percentile of the whole. Histograms that can be added together avoid that trap.

Time resolution matters as well. A graph with one point per hour can flatten a two-minute outage into a small bump. Older data is often downsampled to save space, which has the same effect.

Compare with a baseline. Traffic that looks alarming may be the normal Monday morning rise. Overlaying the same period from last week gives you a quick sense of what's unusual. And look at counts alongside ratios: a 50 percent error rate on two requests is a different situation from the same rate on two million.

Logs

A log is a timestamped record that something happened. Web servers write one line per request, applications write errors, and operating systems record logins and hardware trouble.

Free-form text is easy to write and hard to search. Structured logs, often one JSON object per line, make fields queryable:

{"time":"2026-03-04T15:20:11Z","level":"error","service":"checkout",
 "request_id":"b41c9","message":"payment timeout","ms":5000}

Use consistent levels, such as debug, info, warning and error. Use one time standard, preferably UTC, and keep clocks synchronized with NTP, or you won't be able to line up events from different machines. The timestamp converter helps when formats differ.

On a Linux system using systemd, this shows recent entries for one service:

journalctl -u nginx --since "1 hour ago"

If you're new to web server logs, reading server logs for beginners explains the fields.

Traces

A trace represents one request's journey. It's made of spans, each describing a piece of work with a start time, duration and a parent. Displayed as a waterfall, it shows at a glance that most of a slow request was spent waiting on one database query, or on ten small calls made one after another.

For this to work, each service has to pass an identifier along to the next. The W3C Trace Context recommendation defines a traceparent header for this, and the OpenTelemetry project provides widely used libraries for producing traces, metrics and logs in a vendor-neutral form.

One trace ID follows a request
Browser Web service Orders service Database Request page 1 A trace ID is created Call with traceparent header 2 Query orders 3 This span turns out to be slow Rows returned 4 Order list 5 Finished page 6 Browser Web service Orders service Database Request page 1 A trace ID is created Call with tracepare nt header 2 Query orders 3 This span turns out to be slow Rows returned 4 Order list 5 Finished page 6

Tracing every request can be expensive, so many systems sample. Keeping all slow or failed requests and a fraction of normal ones usually preserves what you need.

How the three fit together

Three signals, three questions
Metrics Is something wrong? Cheap trends over time Drive dashboards and alerts Traces Where is the time going? One request across services Often sampled Logs What exactly happened? Detailed event records Largest volume to store Metrics Is something wrong? Cheap trends over time Drive dashboards and alerts Traces Where is the time going? One request across services Often sampled Logs What exactly happened? Detailed event records Largest volume to store

The links between them matter most. Put the trace ID into log lines. Make dashboard graphs lead to example traces. Mark deployments on graphs, since many problems begin right after a change.

Checking from outside

Internal telemetry can look healthy while users see nothing, because DNS, a certificate or a network path failed in front of your servers. External checks, run from several locations, request real pages and verify the response. A synthetic check can even walk through a login or a search with a test account.

Real user monitoring collects timing from visitors' browsers, showing what different devices and regions experience. Tell users what you collect, keep it minimal and follow applicable privacy rules. Website uptime monitoring covers the outside view in more depth.

Alerts that people respect

An alert interrupts someone, so it should earn that. Good alerts point at user-visible symptoms, such as failing requests or slow pages, and urgent causes with little time left, such as a disk about to fill.

Poor alerts fire on things that fix themselves, or that nobody can change. After enough of those, people stop reading, and the important one gets missed.

For each alert, write a short note: what it means, how to confirm it, first steps and who to escalate to. Require a condition to persist for a few minutes before firing. Review alerts regularly and delete the ones that led to no action. Tying them to error budgets gives a principled threshold.

Also monitor the monitor. If your alerting system goes quiet, something should notice, for instance a scheduled heartbeat that raises an alarm when it stops arriving.

Debugging with the data

A practical sequence during an incident:

From alert to cause
1 Confirm impact Check user-facing error and latency graphs. 2 Find the change Look at recent deployments and settings. 3 Narrow the place Compare by service, region or version. 4 Open a trace Pick a failing request and find the slow span. 5 Read its logs Use the trace ID to get the details. Confirm impact Check user-facing error and latency graphs. 1 Find the change Look at recent deployments and settings. 2 Narrow the place Compare by service, region or version. 3 Open a trace Pick a failing request and find the slow span. 4 Read its logs Use the trace ID to get the details. 5

Form a guess, check it against the data, and change one thing at a time. If a recent release lines up with the start of the problem, rolling back is often the quickest relief, even before you understand why.

Dashboards that answer questions

Build a small number of dashboards around the questions people ask. A top level view should show whether users are being served: request volume, error ratio and latency for the main journeys. Below it, one view per service can show its dependencies and resources.

Label axes and units, and keep the same colors and time ranges across panels. A wall of fifty graphs looks thorough and slows everyone down during an incident. If nobody has looked at a panel in months, remove it.

Monitoring things you don't run

Much of a modern application depends on outside services: payment processors, email delivery, sign-in providers, DNS and hosting platforms. You can't install agents there, but you can record every call you make to them, including how long it took and how it ended.

Those measurements let you tell your fault from theirs within minutes. Give each dependency its own error and latency graph, set sensible timeouts, and subscribe to the provider's status notices. Don't rely on the notices alone, since your own data may show trouble first.

Some failures arrive on a calendar. Track expiry dates for certificates, domain registrations, access tokens and payment cards on vendor accounts, and warn weeks ahead.

Cost, retention and privacy

Telemetry grows quickly. Decide how long each type needs to live: detailed debug logs for days, summarized metrics for much longer. Some records, such as security audit logs, may have retention requirements of their own.

Never log passwords, full payment card numbers, session tokens or API keys. Be careful with URLs, which can contain tokens in query strings, and with personal data generally. Restrict who can read logs, and protect security logs from being altered by the accounts they record.

What can go wrong

Telemetry pipelines fail too. A full disk on a log collector, a blocked network path or a changed log format can silently drop data, and the gap looks like calm. Alert when expected data stops arriving.

Instrumentation can hurt performance if it writes synchronously on every request or logs inside a tight loop. Send data in batches, in the background, and let the application keep serving if the monitoring backend is down. A debug setting left on in production is a frequent cause of surprise storage bills.

Finally, keep the monitoring system separate enough from what it watches. If both live on one server or in one region, a single failure removes the service and your view of it together.

Where to start

For a small site, add an external uptime and certificate check, graph request errors, response time and disk space, collect logs in one searchable place, and set two or three alerts. After each incident, ask what would have shown it sooner, and add exactly that.

Tracing earns its setup cost once requests cross several services. With one application and one database, good logs with a request ID and query timing often cover the same ground.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Cloud & Data Centers →

Latest news on this topic