Scenario overview
- Prometheus 1 — scrapes nodes in Datacenter 1.
- Prometheus 2 — scrapes nodes in Datacenter 2.
- Global Prometheus — federates aggregated metrics from Prometheus 1 and Prometheus 2 using the
/federateendpoint.

Problem: multiple UIs and potential overload
If you need to inspect metrics from many datacenters, opening each Prometheus UI is inconvenient. A global Prometheus can scrape the local Prometheus servers’ federation endpoint (/federate) to provide a single view.
Initial global Prometheus scrape job for federation (example)
/federate and request timeseries that match job="node".
Querying the global Prometheus for a node metric (example UI):

Why federating instance-level metrics is dangerous
- High cardinality: sending every node/instance metric to a central Prometheus multiplies label combinations and can overwhelm the server.
- Duplicate metric collisions: if multiple sources expose the same metric name and identical label sets (e.g.,
job="node"), the global Prometheus may receive samples with the same metric+labels and identical timestamps but different values. Prometheus treats this as conflicting samples and drops them, logging errors.
If the same metric name and label set are produced by multiple sources, Prometheus can reject samples with identical timestamps but differing values. This commonly occurs when federating raw instance-level metrics.
Best practice: Do not federate high-cardinality, instance-level metrics to a single global Prometheus. Instead, federate aggregated, lower-cardinality metrics computed locally (recording rules) and include a distinguishing label (for example
datacenter="dc1").Solution: aggregate locally with recording rules and add a datacenter label
- On each local Prometheus, define recording rules that aggregate instance-level series (sums, rates, etc.).
- Add a
datacenterlabel to those recorded metrics to identify their origin. - Configure the global Prometheus to federate only those recorded (aggregated) metric names.
datacenter: "dc2".
Include the rules file in each local Prometheus configuration:
- Local Prometheus instances compute aggregated metrics and attach a
datacenterlabel. - The global Prometheus federates only aggregated metrics (low cardinality).
- The
datacenterlabel distinguishes origins and prevents ingestion conflicts.
Quick reference: federation do’s and don’ts
Summary: recommended workflow
- Keep local scraping per datacenter for instance-level metrics.
- Create recording rules locally that aggregate instance-level metrics and add a
datacenterlabel. - Federate only the aggregated recorded metrics to the global Prometheus.
- Query the global Prometheus for datacenter-level metrics to get a single pane of glass without overwhelming it.
Links and references
- Prometheus federation docs: https://prometheus.io/docs/prometheus/latest/federation/
- Prometheus recording rules: https://prometheus.io/docs/practices/rules/
- Prometheus best practices (scalability & federation): https://prometheus.io/docs/introduction/overview/