JuniorObservability

How does Prometheus collect metrics, and what is the pull model?

What they are really testing: Whether you know Prometheus scrapes targets (pull) rather than receiving pushes, the benefits, and the pushgateway exception for batch jobs.

A real interview question

How does Prometheus collect metrics, and what is the pull model?

What most people say

drag me

Applications send their metrics to Prometheus and it stores them.

That is the push model, which Prometheus does not use by default. It pulls by scraping /metrics endpoints. Getting this backwards means you misunderstand how targets, service discovery, and failed-scrape detection work.

The follow-ups they ask next

  • What is a benefit of pull over push for monitoring?

    A failed scrape directly signals the target is down (you get up/down for free), Prometheus controls scrape timing centrally, and targets do not need to know the monitoring endpoint. Push makes target-down detection harder.

  • When do you use the Pushgateway?

    For short-lived batch/cron jobs that may not be alive at scrape time. They push metrics to the Pushgateway, which Prometheus scrapes. It is the exception, not the norm.

What the interviewer is listening for

  • Knows Prometheus pulls/scrapes /metrics
  • Knows service discovery + failed-scrape-as-signal
  • Knows Pushgateway for batch jobs

What sinks the answer

  • Thinks apps push to Prometheus
  • No notion of scraping/service discovery
  • Unaware of the Pushgateway exception

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

Prometheus [pulls: it scrapes an HTTP /metrics endpoint on each target on an interval], finding targets via [service discovery]. Pull benefits: [a failed scrape signals the target is down, central scrape control, targets need not know the server]. The exception: [short-lived batch jobs push to the Pushgateway, which Prometheus then scrapes].

Keep going with observability

All 336 cloud engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free