Answer each one out loud first, then tap it to check yourself against a model answer and the lesson behind it.
Monitoring watches for problems you already know about, such as disk above 90% or an error rate above 1%. Observability is being able to answer a question you didn't plan for without shipping new code, and it depends on metrics, logs and traces being linked, for example by a shared trace ID.
Read the lesson: Metrics, logs and traces →A trace, because it times every hop of one request and the slow span stands out. Metrics would tell me that checkout is slow and since when, and logs would tell me what happened to one request, but neither shows where the time went across services.
Read the lesson: Metrics, logs and traces →Latency (p95 checkout time), traffic (requests per second), errors (share of 5xx responses) and saturation (disk 92% full or a database pool at 48 of 50). I track latency of successful and failed requests separately, because fast error pages make the average look better than reality.
Read the lesson: Metrics, logs and traces →An average hides the slow tail: 99 requests at 100 ms and one at 10 seconds average about 200 ms and look fine. The p95 or p99 is the time most requests finish within, and that is where unhappy users show up. The trade-off is that percentiles from histograms are estimates bounded by the bucket edges.
Read the lesson: Metrics, logs and traces →Because Prometheus knows every target it expects, a failed scrape becomes up = 0, so a dead server is a number you can alert on rather than a silence. The weak spot is short batch jobs that can finish between two scrapes; those push their final numbers to the Pushgateway, which Prometheus scrapes.
A counter only goes up since the process started, so its raw value is a rising line that says nothing about now. rate(x[5m]) gives the average per-second increase over the window and handles counter resets on restart. I keep the window at least four times the scrape interval so the rate isn't jumpy.
Binary operators pair series whose label sets match exactly. If one side still has job and env and the other was aggregated with count by (instance), nothing pairs up. Adding on (instance) after the operator tells PromQL to match on that label only.
Take the rate of the _bucket series, sum by (le), then pass that to histogram_quantile(0.95, ...). The common mistake is aggregating away the le label, which leaves the function nothing to work with. The result is an estimate that is only as precise as the bucket boundaries.
Cardinality. Every unique label combination is a new series, so a label holding user IDs, emails or full URLs, or relabeling that keeps too much discovery metadata, can create millions of series. I check prometheus_tsdb_head_series, find the offending label and drop it with relabel_configs.
When an expensive query runs constantly, such as a CPU average used by many dashboard panels and alerts. The rule evaluates it once per evaluation interval and stores the result as a small new series, named level:metric:operations, for example instance:node_cpu_utilisation:rate5m.
With the default Server (proxy) access, the URL is resolved by the Grafana server, not the browser. Inside the Grafana container, localhost is the container itself, so the URL has to be the Prometheus name on the shared network, such as http://prometheus:9090.
When someone picks several values or All, Grafana fills the variable with a regex like (web-1|web-2). An = matcher would treat that as a literal value and match nothing, while =~ matches each server. The cost is a regex match on every query, which is fine at dashboard scale.
Copy the panel's query into Explore and run it there, because Grafana only draws what the data source returns. Usually the query itself is wrong, often a label mismatch in a division that needs on (instance), or a variable value that doesn't exist for that metric.
Provision data sources and dashboards from files in Git: a datasources YAML with a fixed uid and a dashboard provider pointing at a folder of exported JSON. Hand-made UI changes become drafts that must be exported back to Git. Grafana's own database still holds users and settings, so use PostgreSQL or MySQL if several servers share it.
Read the lesson: Grafana dashboards →The expression must stay true for that long before the alert moves from pending to firing. If the condition clears while pending, nobody is told, so a 30-second spike never pages. The trade-off is built-in delay: every minute of for is a minute later that a real outage reaches you.
About 7 seconds until the next scrape failed and up became 0, 60 seconds of for: 1m in pending, and 30 seconds of Alertmanager group_wait before the first notification. The resolved message took about 4 minutes because Alertmanager only sends group updates every group_interval.
Grouping batches related alerts, so 40 down node_exporters become one message. Inhibition mutes some alerts while another fires, such as memory tickets for an instance that is already TargetDown. A silence mutes matching alerts for a fixed time, usually planned work, and needs an author, a comment and an end time.
Read the lesson: Alerting with Alertmanager →A fixed percentage fires too late on a small disk and far too early on a 10 TB one. I alert on predict_linear(node_filesystem_avail_bytes[1h], 4 * 3600) < 0 with a for of about 15 minutes, which gives hours of warning at any size. It can be noisy on spiky usage, which is why the for matters.
Run a Watchdog alert with expr: vector(1) that always fires and route it to a dead man's switch service that pages when the Watchdog stops arriving. I also run amtool config routes test in CI, because a typo in a matcher silently sends pages to the default receiver.
Every unique label set is a separate stream, so a label like user_id or trace_id creates millions of tiny streams and the index balloons. High-cardinality values belong in the log line, filtered at query time with something like |= "user_id=8812" inside a narrow stream.
Loki indexes only labels and stores lines in compressed chunks on object storage, while Elasticsearch indexes every field and word. The cost is that searching all streams for one rare word reads a lot of data, so Loki queries must start with labels that narrow them down; Elastic or Splunk earn their cost when people need fast full-text search or a SIEM.
Read the lesson: Centralised logs with Loki →The json parser needs the whole line to be JSON, and these lines have a timestamp, level and caller before a JSON part. Loki keeps failed lines and labels them with __error__ instead of hiding them. Use the pattern parser to describe the line shape, or change the app to log pure JSON.
It is the W3C Trace Context header carrying a version, the 32-hex trace ID, the parent span ID and flags such as sampled. Each service starts its span as a child of the caller and forwards a new header with its own span ID. If a proxy or library drops it, the next service starts a new trace and the waterfall splits in two.
Read the lesson: Tracing with OpenTelemetry and Jaeger →Apps only need to know "send OTLP to the Collector", while the Collector batches, strips sensitive attributes, changes sampling and exports to one or more backends from one config. It also buffers when the backend is down. The cost is another service to run and size, especially for tail sampling.
Read the lesson: Tracing with OpenTelemetry and Jaeger →Head sampling decides at the first service, such as keep 10%, and the decision travels in the traceparent flags; it is simple and cheap but drops 90% of slow and failed requests too. Tail sampling decides in the Collector after the trace finishes, so it can keep every error and slow trace, but it needs a Collector that sees all spans and the memory to hold them.
Read the lesson: Tracing with OpenTelemetry and Jaeger →kube-state-metrics reports what Kubernetes thinks: desired replicas, pod phase, restarts, requests and limits. cAdvisor in the kubelet reports what containers actually use: CPU, memory working set and network. Most pod health questions need both, such as usage against the limit.
Read the lesson: Monitoring Kubernetes →Three usual causes, in order: the ServiceMonitor is missing the release: monitoring label the Prometheus resource selects on, the selector doesn't match the Service's labels, or port uses a number or a name the Service doesn't have. The port must be the Service port's name.
The scheduler places pods by requests, not real usage. Comparing sum(kube_pod_container_resource_requests{resource="cpu"}) with sum(kube_node_status_allocatable{resource="cpu"}) shows requests near 100% of allocatable. The fix is more nodes or smaller, honest requests.
CPU throttling: the ratio of container_cpu_cfs_throttled_periods_total to container_cpu_cfs_periods_total. Above about 25% the CPU limit is too low for the app's bursts, and the average hides the moments it hit the ceiling. Raising the limit costs capacity, so size it from real usage.
The SLI is a ratio of good events to all events, such as requests that didn't return 5xx. The SLO is the target over a window, such as 99.9% over 30 days. The SLA is a customer contract with credits if broken, usually looser than the SLO, say 99.5%, so you react before you owe anything.
Read the lesson: SLOs, error budgets and on-call →The budget is 1 minus the SLO: for 99.9% that is 43.2 minutes of full outage or 0.1% of requests per 30 days. A policy agreed with product turns it into decisions, such as release normally above 50%, extra review below 25%, and a feature freeze when it is gone.
Read the lesson: SLOs, error budgets and on-call →Burn rate says how fast the budget is being spent; 14.4 over an hour uses 2% of a 30-day budget and is worth a page. The long window proves it is sustained, and the short window, such as 5 minutes, makes the alert stop soon after the problem stops. A slow burn of 1 over 3 days becomes a ticket.
Read the lesson: SLOs, error budgets and on-call →APM from an agent, real user monitoring, synthetic checks, click-through correlation between metrics, traces and logs, anomaly detection and security products on the same agent. You pay by hosts, data ingested, users or custom metric series, so the bill grows with volume.
Read the lesson: Hosted monitoring: Datadog, New Relic and Dynatrace →Instrument with OpenTelemetry instead of a vendor SDK and send everything through a Collector, whose exporters decide the backend. Trying a vendor, dual-sending during a migration or leaving becomes a Collector change. The vendor's own agent may still be worth it for features like RUM or auto-discovery.
Read the lesson: Hosted monitoring: Datadog, New Relic and Dynatrace →