Push vs Pull Monitoring Models
You'll learn the fundamental difference between applications pushing metrics to collectors versus collectors pulling metrics from applications.
The Two Approaches
In monitoring systems, there are two primary ways to collect metrics from your applications:
Push Model: Your application actively sends metrics to a central collector or aggregator. Think of it like a journalist filing stories to their editor—the application takes responsibility for delivering data at regular intervals.
Pull Model: A central collector periodically requests (scrapes) metrics from your application's exposed endpoint. This is like a mail carrier visiting your mailbox on a schedule—the collector decides when to gather data.
Push Model Characteristics
- Applications use agents or libraries to send metrics to collectors (like StatsD or CloudWatch)
- Applications control when and how often data is sent
- Works well for short-lived jobs that may not exist when a collector tries to scrape
- Can handle applications behind firewalls more easily
- Network failures may cause metric loss unless buffering is implemented
Pull Model Characteristics
- Collectors (like Prometheus) scrape metrics from HTTP endpoints
- Collector controls sampling frequency and timing
- Applications must expose a persistent endpoint
- Easier to detect when targets are down (failed scrape = service issue)
- Simpler application instrumentation—just expose current state
- Better for service discovery in dynamic environments
When to Choose Each
Use push when you have ephemeral workloads, batch jobs, or applications that can't expose endpoints. Use pull when you want centralized control, simpler application code, and better failure detection.
Key Takeaway: Push models give applications control over metric delivery, while pull models centralize control in the collector—choose based on your infrastructure's dynamics and failure-handling needs.