How does Prometheus collect metrics — what is the pull model and scraping? [Basic]
Answer
Prometheus normally uses a pull model: it periodically scrapes HTTP endpoints exposed by targets. Each target publishes metrics in the Prometheus exposition format, and Prometheus stores the scraped samples in its TSDB.
Technical explanation
The pull model makes target health visible through the up metric and keeps scraping configuration under platform control.
Service discovery dynamically finds targets from Kubernetes, EC2, Consul, file configs, or static configs.
Push is reserved for limited cases such as short-lived batch jobs that cannot be scraped reliably.
Hands-on example
Example: an app exposes /metrics on port 8080. Prometheus discovers the pod through Kubernetes labels, scrapes every 30 seconds, and records up{job='checkout'} plus application metrics. If scraping fails, up becomes 0 and target status shows the scrape error.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Observability interview questions
- What is observability, and how is it different from traditional monitoring? [Basic]
- What are the three pillars of observability (metrics, logs, traces)? [Basic]
- What is the difference between monitoring and observability in practice? [Basic]
- What are the four golden signals of monitoring? [Basic]
- What is the difference between the USE method and the RED method? [Basic]
- When would you use the USE method versus the RED method? [Basic]
- What is an SLI, an SLO, and an SLA, and how do they relate? [Basic]
- How do you choose good SLIs for a service? [Basic]