- Test cases were passing.
- The deployment pipeline succeeded.
- Pods are running, and everything you can see looks good.

- Your backend handled 247 requests per second over the past minute — that’s a metric.
- A pod is using 512 MB of memory right now — that’s a metric.
- The average response time of an endpoint is 85 ms — that’s a metric.
A metric is essentially a timestamped number. Collected repeatedly, it becomes a time series that shows how the value changes over time.
- Continuous collection (every 15s / 30s / 1m) turns single readings into time series.
- Time series make it easy to spot trends and anomalies: the x-axis is time and the y-axis is the metric value.
- Metrics are fast to query and are ideal for threshold-based alerting (e.g., error rate > 5%).
- Logs provide rich context and the “why”; metrics provide the quantitative “what” and “when”.
- Metrics: numeric, compact, performant for historical trend queries and alerts.
- Logs: verbose, unstructured or semi-structured, good for root-cause and detailed investigation.
- Traces: distributed request-level context to follow a single transaction across services.
Prometheus and Grafana: the basics
- Prometheus collects and stores metrics as time series. It typically scrapes metrics from application endpoints (for example,
http://app:9090/metrics) on a configurable interval, timestamps each value, and stores the history for queries and alerts. - Grafana is the visualization and alerting layer that queries Prometheus and renders dashboards and alerts humans can read.

- Instrumentation: your app exposes metric endpoints (counters, gauges, histograms).
- Collection: Prometheus scrapes those endpoints and stores time series.
- Querying: Grafana issues queries to Prometheus to build charts and dashboards.
- Alerting: define alert rules in Prometheus (or Grafana) to notify when metrics cross thresholds.

- Instrument: add counters, gauges, and histograms to important services (latency, error rate, throughput, resource usage).
- Scrape: expose a
/metricsendpoint and configure Prometheus to scrape it at sensible intervals. - Visualize: build Grafana dashboards for critical flows (checkout, auth, dependencies).
- Alert: create alerts for actionable conditions (e.g., 5xx rate spike, latency degradation, resource exhaustion).
- Correlate: use logs and traces to investigate alerts raised by metrics — metrics tell you where and when; logs and traces tell you why.
Metrics give you visibility into system behavior but are often aggregated. Use metrics to detect and alert on problems, and correlate with logs/traces to investigate root causes. Don’t rely on one signal alone.
- Instrument a sample service (Prometheus client libraries are available for most languages).
- Run Prometheus and configure a scrape target for your service.
- Add Grafana and create a dashboard that queries Prometheus.
- Introduce a controlled fault (increase latency or error rate) and observe how metrics capture the change.