Metrics scraping periodically pulls measurements from an application's exposed endpoint and stores them in Prometheus's time-series database. This pull-based flow supports operational questions such as whether a service is up, whether latency exceeds a threshold, or whether request volume drops. section 3.5
A practical scraping setup connects four operational pieces:
- Use Grafana for charts and Alertmanager for routing threshold-based alerts. section 3.5
FastAPI scraping endpoint
Add Prometheus middleware and expose /metrics with a route handler. Custom counters can then be incremented in application code and retrieved by Prometheus.








