liveBook · Manning

Pull model

As explained in Learn Docker in a Month of Lunches, Second Edition

A pull model is a data-collection approach in which a monitoring system periodically fetches data from monitored systems.

A pull model collects metrics by having the monitoring system periodically fetch them from monitored systems. Prometheus calls these fetches scraping and queries configured endpoints such as /metrics. 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

A Prometheus configuration sets a default 10-second interval, names scrape jobs, selects metric paths, and identifies targets through static configuration or DNS service discovery. section 9.3

Choose target discovery according to the deployment:

  • Use static targets for a single container or a small fixed deployment. section 9.3
  • Use DNS service discovery to find multiple containers for a service and scrape them at scale. section 9.3
  • Check scaling behavior: a single-container component may produce unexpected results when DNS returns several addresses, while a multi-container component can be scraped across all addresses. section 9.3

Verify scaled scraping

Scale the access-log service to three containers, generate requests, and aggregate the resulting metric with sum(access_log_total) without(hostname, instance). section 9.3

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains scraping configuration, target discovery, intervals, and scaling caveats without detailing Prometheus internals.
Examples
Uses a Prometheus YAML configuration, scaled access-log containers, generated HTTP requests, and a PromQL aggregation.
What you can do after
Operate/configure Prometheus jobs that scrape fixed or DNS-discovered containers and verify collected metrics.
How it connects
Connects Prometheus with metrics endpoints, DNS service discovery, Docker Compose, container scaling, and PromQL aggregation.

Also explained in

Compare how 4 books explain pull model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.