Skip to main content
Serverless workers are usually short-lived, which makes them a poor direct scrape target for Prometheus. Prometheus Pushgateway solves this by letting your jobs push metrics to a stable endpoint that Prometheus scrapes on its own schedule. In this example, you deploy Pushgateway itself on fal as a small always-available service with persistent storage for metric state. Then your apps push custom metrics to it, and Prometheus scrapes from one predictable URL.

🚀 Try this Example

Steps to run:
  1. Save this as pushgateway.py:
  1. Deploy it:
After deploy, your gateway is available at:
Opening that URL in a browser (/) shows the Pushgateway web interface, which is useful for quickly checking pushed metric groups.

Push and Scrape Metrics

Set your base URL:
Push a sample metric:
Scrape all metrics:
Check health:

Prometheus Scrape Configuration

Use fal.run as the target host and include your app path in metrics_path: