Each scrape_config defines a job.
A job represents a group of similar targets that share the same configuration.
For example, all instances of a web service or all database nodes can belong to one job.
static_configs lists targets manually.
You explicitly define the endpoints Prometheus should scrape, such as:
localhost:9090
app-server:8080
This is simple and useful for small setups or local development.
Service discovery finds targets automatically.
In dynamic environments, Prometheus can automatically discover targets using integrations like:
Kubernetes
Consul
DNS
EC2 and other cloud providers
This is essential in containerized systems where instances frequently start and stop.
metrics_path and scheme have sensible defaults.
metrics_path defaults to /metrics
scheme defaults to http
These can be customized if your application exposes metrics on a different path or uses HTTPS.