All jobs / DevOps / SRE / cloud / Observability
DevOps / SRE / cloud interview question · 1–3 years
How does Prometheus collect metrics, and why does a thirty-second batch job show none?
The strongest answer
Prometheus pulls: it scrapes each target’s /metrics endpoint on an interval, using service discovery; a job that exits in thirty seconds may never be scraped, so it pushes to the Pushgateway or reports through a long-lived collector
Why it works
Right — the pull model is the design choice everything else follows from, including how short-lived work is handled.
What a good answer covers
- Prometheus scrapes /metrics.
- Service discovery finds targets.
- Short jobs push to a gateway.
- Or go through a collector.
Answers that fall short
- Close, but not the strongest: It pulls metrics, so the job just needs to run a bit longer to get caught
Direction is right, but scheduling a job around scrape timing is fragile; use the mechanism built for it. - Weak: Applications push metrics to Prometheus, so the job must be missing the client configuration
That is the inverted model; Prometheus scrapes, which is why targets expose an endpoint rather than a client key. - Red flag: Log the numbers instead and grep them later; metrics are for long-running services only
Batch jobs need metrics too — duration, rows processed, success — and logs do not alert or graph cleanly.
Who gets asked this
More Observability questions
- Why instrument services with OpenTelemetry instead of the observability vendor’s own SDK?
- Logs are 40% of the observability bill. What do you cut without going blind?
- You can afford traces on some paths. Which do you instrument first?
- After a deploy, the Grafana dashboards time out and Prometheus runs out of memory. A developer added…
- What must a new service get on day one from the platform?
- The server pings. Users still cannot log in. What was missing?
- When do you use a metric instead of a log line?
- Describe the parts of an ELK or OpenSearch logging stack and what each does.