Interview Observability

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.

Preparing for an interview?

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

← All Observability questions