Federating another Prometheus: honor_labels and a timeout that would not load

One scrape job, three commits in an afternoon, and the two settings that decide whether federated samples keep their own identity.

Monitoring

The job

Partner D ran its own Prometheus collectors. The agent-based collection alongside them was meant to be retired once the dashboards and alerts moved across. The replacement is a plain /federate scrape against four collector addresses (port 9090, static targets, no service discovery), added to one production cluster's scrape config:

- job_name: 'partner-d_federate'
  honor_labels: true
  metrics_path: '/federate'
  scrape_interval: 1m
  scrape_timeout: 1m
  params:
    'match[]':
      - '{__name__=~".+"}'
  static_configs:
    - targets:
        - 172.22.144.22:9090
        - 172.22.8.103:9090
        - 172.22.16.103:9090
        - 172.22.48.10:9090
  relabel_configs:
    - source_labels: [job]
      target_label: secondary_job
    - target_label: job
      replacement: partner-d_federate
    - source_labels: [instance]
      target_label: secondary_instance
    - target_label: instance
      replacement: partner-d_federate_instance

Nothing there is clever. The three lines that changed after the first commit are the whole story.

The timeout that would not load

It went in as scrape_interval: 30s with scrape_timeout: 2m — a pair Prometheus refuses, because a timeout longer than its own interval fails validation at parse time. The failure is the whole file (every job in it), not the one job that is wrong. A second commit the same afternoon pulled the timeout back to 30s; a third moved both to 1m.

A match[] of {__name__=~".+"} asks each collector for everything it holds (every series, every job) — no name filter at all. The parent then carries a full copy of four collectors' series every cycle, and 30 seconds is a thin budget for that. One minute (both interval and timeout) is the number that stayed.

What honor_labels actually decides

The default (false) means the target's labels win a collision. A scraped sample carrying its own job and instance has them renamed to exported_job and exported_instance, and the target's values are written in their place. For an ordinary exporter that is correct; the exporter has no opinion about which job it belongs to. For a federate scrape it destroys the thing being federated — every series pulled from all four collectors arrives wearing job="partner-d_federate", and the real job survives only under a prefix (exported_) that no existing dashboard query mentions.

Setting it to true reverses the precedence. The sample's own labels win, the colliding target labels are dropped, and a federated series arrives looking the way it looked on the collector that produced it. The commit subject says what it is for in four words: proper label replacement.

The half that misses

The relabel_configs were meant to park the target identity under names that cannot collide, so you could still tell which of the four collectors answered. secondary_job carries a value, though a useless one (the job name, which the next rule was about to set to the same string). secondary_instance carries nothing — instance is absent from a target during relabelling (it is filled in from __address__ afterwards), so source_labels: [instance] reads an empty string, and an empty label is dropped. Reading __address__ is the way to carry a collector address through; this job reads the wrong one.

What it cost

Three commits on 30 April 2025 in one pull request, plus a one-line target addition the previous December (one address, one line) and a separate single-target job in July (one VM, port 19100). The repository was marked deprecated in May 2026 and every production overlay removed (nine removal commits in a single day), so the job outlived neither the plan it belonged to nor the repository it lived in.