What is Prometheus and what problems does it solve in monitoring?
Learn what Prometheus is, how its pull-based metrics model and PromQL work, and the monitoring problems it solves in dynamic, distributed systems.
Expected Interview Answer
Prometheus is an open-source monitoring and alerting system that collects numeric time-series metrics from targets by scraping HTTP endpoints, stores them in its own time-series database, and lets you query and alert on them with PromQL.
It solves the problem of understanding the health and behavior of dynamic, distributed systems. Before tools like Prometheus, teams struggled to track metrics across many short-lived containers and services. Prometheus uses a pull model with service discovery to find targets automatically, a dimensional data model (metric name plus key/value labels) for flexible slicing, and PromQL to compute rates, aggregates, and alert conditions in real time.
- Reliable metric collection via a simple pull model
- Powerful dimensional data model with labels
- PromQL for flexible querying and alerting
- Built-in service discovery for dynamic infrastructure
- No reliance on distributed storage — each server is self-contained
- Large ecosystem of exporters and integrations
AI Mentor Explanation
Prometheus is like the official scorer at a cricket match who, over by over, records runs, wickets, and extras into a structured scorebook. Rather than trusting each player to shout out their own stats, the scorer actively checks the state at fixed intervals, so the running rate, partnerships, and required run rate can be computed reliably at any moment during play.
Step-by-Step Explanation
Step 1
Instrument targets
Each service exposes a /metrics HTTP endpoint in the Prometheus text format using a client library or exporter.
Step 2
Discover targets
Prometheus finds what to scrape via static config or service discovery (Kubernetes, Consul, EC2).
Step 3
Scrape on interval
The server pulls each endpoint every scrape_interval and parses the samples.
Step 4
Store as time series
Samples are appended to the local TSDB, keyed by metric name plus labels.
Step 5
Query and alert
PromQL answers questions and evaluates alerting rules, which are pushed to Alertmanager for routing.
What Interviewer Expects
- Clear definition as a metrics-based monitoring system
- Awareness of the pull model and scraping
- Understanding of the dimensional (labelled) data model
- Mention of PromQL and Alertmanager
- Which problems it solves in dynamic systems
Common Mistakes
- Calling Prometheus a logging or tracing tool
- Saying it uses a push model by default
- Confusing Prometheus with Grafana (visualization only)
- Ignoring the role of exporters and service discovery
Best Answer (HR Friendly)
“Prometheus is a popular open-source tool that keeps an eye on the health of software systems. It regularly checks each service, records numbers like error rates and response times over time, and can automatically raise an alert when something looks wrong.”
Code Example
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'api'
static_configs:
- targets: ['api:8080']Follow-up Questions
- How does Prometheus differ from Grafana?
- What is an exporter and when do you need one?
- How does Alertmanager fit into the Prometheus stack?
- What are the limitations of Prometheus for long-term storage?
- How does Prometheus handle high-cardinality labels?
MCQ Practice
1. What kind of data does Prometheus primarily collect?
Prometheus is a metrics system that stores numeric samples over time, not logs or traces.
2. How does Prometheus obtain metrics from targets by default?
Prometheus uses a pull model, scraping /metrics HTTP endpoints on a schedule.
3. Which language is used to query Prometheus data?
PromQL is the purpose-built query language for Prometheus time series.
Flash Cards
What is Prometheus? — An open-source metrics monitoring and alerting system that scrapes and stores time-series data.
What model does it use to collect data? — A pull model — it scrapes HTTP /metrics endpoints on an interval.
What is the data model? — Dimensional: a metric name plus key/value labels identify each time series.
What handles alert routing? — Alertmanager receives fired alerts and handles grouping, silencing, and delivery.