Cloud & Virtualization
Observability Explained: Metrics, Logs and Traces for Your Servers
By NileVPS Team · Published · 4 min read
اقرأ المقال بالعربيMonitoring tells you that something is wrong. Observability helps you understand why. The difference matters once your application grows beyond a single process: a slow checkout page might be caused by the database, a third-party API, a full disk or a bad deploy, and a green "server is up" check will not tell you which. Observability is the practice of collecting enough data from your systems that you can answer new questions about their behaviour without shipping new code first. This guide explains the three main signals, how they fit together, and how to start with a modest stack on a VPS.
Monitoring vs observability
Monitoring is built around questions you already know to ask: is the CPU above 90%, is the site returning HTTP 200, is the disk nearly full. You define checks and thresholds, and you get alerts.
Observability adds the ability to investigate questions you did not anticipate: why are requests from one customer slow while others are fine, or why did latency double after Tuesday's release. It relies on rich, well-labelled telemetry that you can slice and correlate. In practice you need both: monitoring for alerts, observability for diagnosis.
The three pillars
Metrics
Metrics are numeric measurements sampled over time: request rate, error count, latency percentiles, memory usage, queue length. They are cheap to store and fast to query, which makes them ideal for dashboards and alerting. Two well-known frameworks help you choose what to measure:
- RED for services: Rate, Errors, Duration.
- USE for resources: Utilization, Saturation, Errors.
Logs
Logs are timestamped records of discrete events, such as a failed login, an exception with a stack trace or an Nginx access line. They carry detail that metrics cannot, but they are more expensive to store and search. Structured logs (JSON with consistent fields like level, request_id and user_id) are far easier to filter than free text.
Traces
A trace follows one request as it moves through multiple services, recording each step as a span with its own timing. Traces answer "where did the time go?" across service boundaries. We cover them in depth in distributed tracing.
Connecting the signals
The real power comes from correlation. A good workflow looks like this:
- An alert fires because the 95th percentile latency metric crossed a threshold.
- A dashboard shows the spike started at 14:05 and affects one endpoint.
- You open traces for that endpoint and see a database span taking most of the time.
- The trace ID leads you to the matching log lines, which show a lock timeout.
To make this possible, propagate a request or trace ID through every service and include it in every log line.
A practical open-source stack
You do not need a large budget to get started. A common self-hosted setup:
| Signal | Collector | Storage | Viewer |
|---|---|---|---|
| Metrics | Prometheus, node_exporter | Prometheus TSDB | Grafana |
| Logs | Promtail or Grafana Alloy | Loki | Grafana |
| Traces | OpenTelemetry Collector | Tempo or Jaeger | Grafana or Jaeger UI |
OpenTelemetry deserves special mention: it is a vendor-neutral standard and set of SDKs for producing metrics, logs and traces. Instrumenting with it means you can change backends later without rewriting application code.
Getting host metrics in minutes
On Ubuntu or Debian you can start with node_exporter from the distribution packages:
sudo apt update
sudo apt install prometheus-node-exporter
curl -s http://localhost:9100/metrics | headThen add the host as a scrape target in /etc/prometheus/prometheus.yml:
scrape_configs:
- job_name: node
static_configs:
- targets: ['localhost:9100']Restart Prometheus with sudo systemctl restart prometheus, connect Grafana to it as a data source, and import a community dashboard for node_exporter. Keep ports 9090 and 9100 closed to the public internet with your firewall; expose Grafana only behind HTTPS and authentication.
Sizing and cost considerations
Observability data grows quickly. A few habits keep it manageable:
- Set retention deliberately. Fifteen to thirty days of metrics and a week or two of logs is enough for many small teams.
- Watch label cardinality. Never put user IDs, emails or full URLs in metric labels; each unique value creates a new time series.
- Sample traces. Keeping a percentage of normal traces plus all errored or slow ones is usually enough.
- Separate the stack. Running your observability tools on their own VPS means a struggling application server does not take its own diagnostics down with it.
If you plan a dedicated monitoring node, compare instance sizes on the pricing page; storage capacity and RAM matter more than CPU for Prometheus and Loki.
Checklist to start
- Expose metrics for every service (RED) and every host (USE).
- Switch application logs to structured JSON.
- Add a request ID and propagate it end to end.
- Define alerts on symptoms users feel, such as error rate and latency, not only on causes.
- Write a short runbook for each alert.
FAQ
Is observability only for microservices?
No. A single monolith on one VPS still benefits from good metrics and structured logs. Tracing becomes more valuable as the number of services and external calls grows, but even a monolith can use traces to see time spent in the database and outbound HTTP calls.
Do I need all three signals from day one?
Not necessarily. Most teams start with host and application metrics plus centralised logs, then add tracing when they struggle to locate latency across components. Choosing OpenTelemetry early makes adding traces later much easier.
How much server capacity does a self-hosted stack need?
It depends on the number of hosts, the scrape interval, log volume and retention. A small setup covering a handful of servers can run on a modest VPS, but monitor the monitoring node itself, especially disk usage, and increase resources as data grows.