Pulling instead of pushing
In the pull model the metrics server periodically scrapes an HTTP endpoint exposed by each target. The target just publishes its current metrics, and the server decides when to read them.
How a scrape works
- Service discovery gives the server a list of targets.
- On each scrape interval the server fetches the metrics endpoint.
- It parses the text exposition format into series and stores them.
- A synthetic up metric records whether the scrape succeeded.
Why pull is attractive
- The server controls the rate, avoiding floods from misbehaving clients.
- Target health is visible directly through scrape success.
- Targets need no knowledge of the storage backend.
Limits
- Targets must be reachable by the server, which is awkward for short lived jobs or hosts behind firewalls.
- Very brief batch jobs may finish before any scrape, which motivates a push gateway.
Key idea
The pull model has the server scrape target endpoints on its own schedule, giving rate control and built in health visibility at the cost of reachability.