Scraping is Prometheus’s pull-based process for periodically fetching monitoring data from exposed application endpoints instead of receiving pushed data. section 9.3
Configure scraping by specifying:
- A global interval, such as 10 seconds. section 9.3
- A job name, metrics URL path, and target list for each component. section 9.3
- Static targets for single containers or DNS service discovery for services with multiple containers. section 9.3
Listing 9.2 Configuring Prometheus to scrape application metrics
global:
scrape_interval: 10s
scrape_configs:
- job_name: "image-gallery"
metrics_path: /metrics
static_configs:
- targets: ["image-gallery"]
- job_name: "iotd-api"
metrics_path: /actuator/prometheus
static_configs:
- targets: ["iotd"]
- job_name: "access-log"
metrics_path: /metrics
dns_sd_configs:
- names:
- accesslog
type: A
port: 80
Use the configuration listing to compare static targets with DNS-based discovery and see metrics paths in context. section 9.3
Scaling a scraped service
DNS discovery can poll all three access-log containers on the same schedule. A single-container target behaves differently: when DNS returns several addresses, Prometheus uses the first address, so scaling that component produces unexpected behavior. section 9.3








