Prometheus federation: hierarchical and cross-service setups

Federation lets one Prometheus server pull selected series from another, which suits aggregated global views and cross-service lookups. It stops fitting when you need full-resolution history or complete global queries.

On this page

When Prometheus federation still fits a multi-server estate

Federation fits when you run several Prometheus servers, one per datacenter or team, and need a global view of a small set of series. A global server pulls selected series from each source server's /federate endpoint, so it sees aggregated and cross-service data without storing every raw sample from every site. It is a poor fit when you need full history from all servers in one place, because the global server then becomes a second copy of the data you are trying to scale.

The Prometheus overview describes a pull model: each server scrapes targets found through service discovery or static configuration, and PromQL queries run against the data that server holds. Federation keeps that model intact. The source servers still scrape their own targets, and the global server scrapes them on a schedule, so each site remains responsible for its own collection. Before you commit, confirm the scrape interval and the match[] selectors you need, because a global server can only query what it has pulled.

The Prometheus storage documentation describes local storage as a single-node database that is not clustered or replicated. Each federated server therefore remains a single point of failure for its own data, and federation does not fix that. Plan for the failure of a source server: decide whether the global dashboards and alerts should show a gap, a stale value or an alert on the missing scrape, and test that behavior before an outage occurs.

Set expectations with the team that will own the global server. Federated series are a subset chosen by selectors, so questions that need raw per-target detail still have to go to the source server. Ask the owners of each site which series they will expose, how their labels are named, and who approves a change to the selector list. These decisions shape the rest of the design more than the configuration syntax does.

Federation options and when each fits

This table compares the main choices in a federation job: how far match[] reaches, how often the global server scrapes, whether honor_labels is set, whether recording rules pre-aggregate on the source, and whether you pull aggregates or raw series. Read each row for the fit and the trade-off, then decide which combination matches your query and alerting needs. The main takeaway is that federation carries whatever you select, so narrow selectors and pre-aggregation determine the load on both servers.

OptionWhen it fitsMain trade-off
Narrow match[] selectorGlobal dashboards need a few job-level or recording-rule series from each siteAny series missing from the selector cannot be queried or alerted on globally
Broad match[] selectorSmall estates where a central server must see most raw metricsSeries count and cardinality grow on both servers, and the global server takes the load
Federation scrape interval longer than localGlobal views only need trend-level data for capacity or executive reportingShort-lived spikes are missed, and alerts on the global server lag the source
honor_labels: trueFederated series already carry labels such as job or instance that must be keptConflicting labels from the source can overwrite the global server's own target labels
honor_labels: falseGlobal server should rename or add labels such as datacenter to federated seriesSource labels are renamed to exported_* form, which breaks queries that expect the original names
Recording rules on the sourcePer-site aggregates are queried often and raw series are costly to transferRules add evaluation work on each source and must be versioned and kept in sync
Per-datacenter aggregatesGlobal views only need summaries such as request rate or error ratio per siteDetailed investigation still needs the local server, so drill-down is a second step
Raw series pulled across servicesA specific service on one server needs a few exact series for correlationEach pulled series adds cardinality and data transfer, so selectors should stay tight

Hierarchical, cross-service and peer pull patterns

In this pattern, each datacenter runs its own Prometheus server that scrapes local targets and keeps full-resolution data for local queries and alerts. A global server then scrapes the regional servers' /federate endpoint and pulls only a selected set of series, usually recording rules that roll up per-cluster or per-site values. The global server can answer fleet-wide questions such as total request rate per region or the health of each site at a glance. It cannot answer questions that need raw, unaggregated series from a single instance, and it holds only the aggregates it was configured to pull, so any detail not selected at the regional level is gone from its view.

  • Data flow: regional servers scrape locally, evaluate recording rules, and expose selected series; the global server pulls them on its own scrape interval.
  • What the global server answers: cross-site rollups and summary dashboards built from the pulled aggregates.
  • What it cannot answer: per-pod or per-instance detail for series that were not federated, or historical data beyond the regional retention.
  • Label discipline: agree on consistent region or datacenter labels at the regional level, because the global server cannot add them after the fact.
  • Failure behavior: when a regional server is down, its aggregates stop updating and the global view can look healthy unless you alert on the scrape itself.

Before building this, confirm with your team which rollups the global alerts depend on, and check that the regional servers can absorb the extra query load from the global scrape.

How federated servers feed a global server

The diagram starts at each datacenter, where a local Prometheus scrapes its own targets and a recording rule pre-aggregates them into a smaller set of series. The global Prometheus then pulls only those selected series from each source's /federate endpoint using match[] selectors, so it never ingests the full raw dataset. Alertmanager receives alerts from the local servers and the global server separately. Check that the selectors match only the aggregated series you intended, and remember that the raw, full-resolution history stays on each source server.

Local servers keep raw history and send only selected aggregated series upward.

How honor_labels changes label conflicts when federating

When a federating job scrapes the /federate endpoint of another Prometheus, the series it receives may already carry labels such as job and instance, and the federating job's own scrape configuration may try to set the same labels. The honor_labels setting decides which side wins. With honor_labels: true, Prometheus keeps the label values exposed by the target and ignores conflicting values from the scrape configuration. With honor_labels: false, the default, Prometheus keeps the scrape configuration's values and renames the conflicting labels from the exposed series by prefixing them with exported_, so the original job becomes exported_job.

Either outcome can be confusing if you do not plan for it. With honor_labels: false, a federated series can look like it came from the federating server's own target, and its original identity moves into exported_ labels that alert rules and dashboards may not expect. With honor_labels: true, the federated series keep their original job and instance, which is usually what a global view needs, but if two source servers expose the same label set, the series can collide or overwrite one another. Using honor_labels: true on a job that scrapes from a single source with no other labels is usually the safest starting point, while jobs that also scrape exporters directly should keep the default unless you have checked the outcome.

Before enabling honor_labels across all jobs, run a test with one federation job against a copy of a source server. Check the target page for dropped or renamed labels, query the same series from the source and from the global server and compare counts, and confirm that alert rules and recording rules still match the expected job and instance values. Also check for duplicate series after two sources are federated into one server. Ask your platform team to confirm which federation jobs already set these labels in your configuration, because a change in one job can alter the label set that existing dashboards and alerts depend on.

Set up a federated global server step by step

This sequence turns a set of per-site Prometheus servers into a global server that holds a curated set of aggregated series, with each step ending in a check you can run before moving on. It covers scope, recording rules, the federate scrape job, label handling, endpoint security and a final query test.

  1. Decide which series the global server needs

    Start with the questions the global server must answer, such as fleet-wide capacity, cross-site availability or a per-region error rate, and list the metric names and label sets each question requires. Keep this list short, because every series you federate adds load on both the source and global servers. Agree the list with the owners of the global dashboards and alerts, and record it in version control. Done means you have a written list of series names, the labels to keep and the source site for each, and every entry maps to a named dashboard panel or alert rule.

  2. Define recording rules on each source server

    On each source Prometheus, add recording rules that compute the aggregates from your list, such as sums by job, region or cluster, and give them names that follow the level:metric:operation convention. Pre-aggregating at the source keeps the federated series count low and moves expensive queries away from the global server. Load the rules with the rule_files setting and check the output with promtool check rules before reloading. Done means each recording rule appears under the Rules page of the source server with a healthy status and produces samples when you run its expression directly.

  3. Configure the federate scrape job

    On the global server, add a scrape job that targets the source server's /federate path and passes one or more match[] parameters that select only the series from your list, using the metric names or recording rule names as selectors. Set a scrape interval that suits how quickly the global view must update, and keep it no shorter than the source servers' evaluation interval so you do not scrape the same values repeatedly. Use a separate job per source site so that targets and failures stay identifiable. Done means each federate target shows as up on the global server's Targets page and the match[] selectors return series rather than an empty response.

  4. Set honor_labels deliberately

    Decide for each federate job whether the labels from the source server should override labels the global server adds during scraping. Setting honor_labels to true keeps the source labels, such as job and instance, intact, which is usually what federation needs because the series already describe where they came from. Leave it at false only when the global server must replace conflicting labels, and document the reason. Check the collision risk by comparing label names on both sides before you enable it. Done means you can state, for each job, the value of honor_labels and the labels that would be lost or overwritten if it were flipped.

  5. Enable TLS and authentication on the federation endpoint

    The /federate endpoint returns series to any client that can reach it, so protect it with TLS and authentication before you connect the global server. Prometheus supports TLS and client certificate authentication, with TLS 1.2 as the minimum, and HTTP basic authentication with bcrypt-hashed passwords, which should only be used over TLS because cleartext basic authentication exposes credentials. Configure the scrape job's tls_config and authorization or basic_auth settings, and keep credentials in files with restricted permissions instead of inline values. Confirm the network path allows only the global server to reach each source. Done means an unauthenticated request to /federate is refused and the authenticated scrape succeeds over TLS.

  6. Verify with a query on the global server

    Run a query on the global server that uses the labels you expect, such as a sum by region for a recording rule, and compare it with the same query run on the source server. Confirm that each source site appears as its own set of series, that no label is missing or duplicated, and that the timestamps advance at the expected interval. Check the global server's up metric for each federate job and watch the scrape duration for growth as the series count rises. Done means the global query matches the source values for the sampled period and every expected site label is present.

Protecting the federate endpoint and the servers behind it

A federation setup exposes one Prometheus endpoint to another server, and that endpoint returns series from every target it scrapes. The cards below cover the documented security model points that matter most when a child server's /federate path is reachable from a global or cross-service server.

Use TLS and client certificates

Prometheus supports TLS with a minimum of TLS 1.2 and client certificate authentication, so the global server can prove its identity to each child server and the reverse. Put the /federate endpoint behind TLS and require client certificates on every child server, then check that the scraping server presents the expected certificate. Note that a certificate you issue only covers the servers you list, so keep the trusted authority and the list of allowed clients in your change records.

Security model

Basic authentication only over TLS

HTTP basic authentication stores passwords as bcrypt hashes in the web configuration file, but the credentials travel with each request. Without TLS, anyone on the network path can read them in cleartext, so basic authentication should never be enabled on a plain HTTP federation link. Confirm that the scraping configuration and the server agree on the TLS setting before you roll out a credential change.

Front the UI and API with a proxy

Prometheus has no built-in single sign-on and no built-in CSRF protection on mutating endpoints. Most teams therefore place an authenticating reverse proxy in front of the web UI and API, and use it to enforce SSO, access rules and request filtering. Check that the proxy is the only path to the server, because a direct port left open bypasses the controls you added.

Keep admin APIs disabled

Admin HTTP APIs are disabled by default. The --web.enable-admin-api flag enables destructive operations such as deleting series, and --web.enable-lifecycle enables reload and shutdown endpoints. Leave both off on federated servers unless a specific runbook needs them, and restrict who can reach the lifecycle endpoints even when they are enabled, since a stray request can stop a server that other servers depend on.

Limit exporter target abuse

Exporters such as SNMP and Blackbox take their targets from URL parameters. The security model warns that anyone with HTTP access to these exporters can make them send requests to arbitrary endpoints. Restrict exporter access to the Prometheus servers that scrape them, and review which targets each scrape job may request, so a federated network does not become a relay into internal systems.

Security model

Questions buyers ask before federating Prometheus

Is federation the right tool, or should we use remote write instead?

Federation fits when a global server only needs a small, pre-selected set of series, such as recording rules that summarize each datacenter, and when the local servers stay the source of truth for alerting. Remote write fits when you need every sample centrally, long retention or a global query view over full-resolution data. Federation pulls from the local server on a scrape schedule, so the global server only sees what the local server exposes at that moment. Remote write sends the full sample stream, which is more data to move and store but gives a complete copy. Ask which questions the global view must answer before choosing. The Prometheus overview describes the pull model that federation builds on.

What drives the effort of a federation design?

The main drivers are how many local servers feed the global one, how many series each exposes, and how carefully the match[] selectors are chosen. Each selector must name the series the global server needs without pulling high-cardinality metrics that inflate its memory. Label conventions matter as well: if each site uses different label names for the same service, the design needs relabeling or a shared naming standard first. Cross-service pulls add decisions about honor_labels, because a label set by the target can collide with labels added by the scrape configuration. Effort rises with the number of sites, exceptions and dashboards that depend on the federated series. Ask for the selector list, label map and failure plan as deliverables in any quote.

What does the work need from our own team?

You need people who own the metric names, labels and alert ownership at each site, plus access to the Prometheus configuration and the hosts that run it. A platform or SRE owner should approve which series cross each boundary, since every federated series adds load on both ends. Someone must also review the global dashboards and confirm that the aggregated values answer the questions your operators ask. Access to the network path between sites, including firewall rules and TLS or authentication settings for the /federate endpoint, is usually needed early. The team's time is one-time for design and recurs when new services are added. Confirm these responsibilities before the engagement starts.

Can our team set up federation without outside help?

A team with working Prometheus experience can set up a small federation with two servers, a few selectors and documented scrape settings. The harder parts are the ones that tend to surprise teams: label collisions across sites, selectors that grow over time, unclear ownership of alerts and recovery after a site link fails. If you have several sites, a shared naming standard and a tested failure runbook usually take more planning than the configuration itself. An outside partner can review the design, write the configuration as code and run a retest after changes. Whether you build it alone depends on your staff's time and how many sites and services are involved.

How long does a federation rollout take for an estate of our size?

Duration depends on how many sites, services and series are in scope, how consistent their labels already are and how many approvals the design needs. A pilot with one site and a short list of selectors is far quicker than a rollout across many datacenters with separate teams and change windows. Ask for a timeline that separates discovery, selector design, staging tests, production cutover and handover. No duration can be stated here without knowing your estate, so the written scope is the place to fix it. Ask the team to name the assumptions behind any date.

How does federation affect our alerting?

Alert rules should run on the local Prometheus servers that hold the complete data, not only on the federated copy at the global server. Federated series can be delayed by the scrape interval of the global server and can be missing if the link between sites fails, so an alert based only on them may fire late or not at all. Recording rules that aggregate at each site can be federated for global dashboards and for alerts that tolerate that delay. Alertmanager should receive alerts from every Prometheus instance that evaluates rules, and Alertmanager documents how to configure that. Duplicate alerts from multiple sites need grouping labels that identify their origin.

What are the limits of federation that we should plan for?

Federation copies only the series that a scrape returns, so it cannot give you full-resolution history centrally, and a broken link leaves gaps in the global view. Each federated series adds load on the local server during the scrape and on the global server's memory, and large match[] selectors can slow both. Label changes at a site can break global queries without an error. The Prometheus storage documentation explains that local storage is not clustered or replicated, which makes the local servers the place to keep retention. Plan a tested recovery procedure and monitor the federation scrape itself.

What a federation engagement covers and what it needs from you

A federation engagement starts with a written scope that DeployOpen agrees with you before any configuration changes. The scope names each source server, the exact series each one exposes to the global server, the recording rules that pre-aggregate them, the authentication and TLS settings on every /federate endpoint, and the validation queries that prove the global view matches the source data. Because the scope is fixed and signed off in advance, the deliverables and the points where your team must act are clear before anyone touches a production scrape configuration.

The most important client input is the set of match[] selectors, because they decide what the global server receives. Your team should decide which metrics are needed for cross-site dashboards and alerts, and which owner of each source server agrees to expose them. Plan for a named owner per source server who can approve scrape changes, rotate credentials and answer questions about label meanings. You also need to provide network paths from the global server to each source on the federation port, and the certificates or basic authentication credentials those paths will use. Confirm with your network team whether firewalls, proxies or load balancers sit in between, since these often block or reset long federation scrapes.

Ask DeployOpen to show, in the written scope, how each source's endpoint will be protected and how access will be logged, and confirm which Prometheus flags and admin APIs will stay disabled on every server. Also confirm who receives the findings from the validation queries and who decides when a series set is widened. Pricing and timeline follow from this scope, so ask for a quote that lists each source server, each recording rule set and each validation step as a separate line item.

How DeployOpen scopes, delivers and supports Prometheus federation

DeployOpen approaches Prometheus federation as a scoped design decision first, then builds only the hierarchy and selectors the written scope requires. Each engagement covers the per-site servers, the global server, the selectors that move series between them, and the documentation your operations team needs to run the result inside infrastructure you control.

How we scope

  • Inventory every site, service and series the global server must see before choosing federation or remote write
  • Agree in writing which aggregated series, match[] selectors and alert rules cross each federation link
  • Define the labels, honor_labels behavior and naming conventions that keep series unambiguous across sites
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts

How we build

  • Configure per-site Prometheus servers with recording rules that produce the aggregated series the global server needs
  • Write scrape configurations for /federate with narrowly scoped match[] selectors to limit series volume
  • Test label collisions, staleness and missing-series behavior under a planned site outage before go-live
  • Secure federation endpoints with TLS, authentication and network rules scoped to the approved sources

How we hand over

  • Document each federation link, its selectors, scrape interval and the dashboards and alerts that depend on it
  • Provide a written limits register stating where federation stops fitting and when remote write or Thanos should replace it
  • Deliver runbooks for adding a site, changing a selector and diagnosing a stalled federation scrape
  • Walk your operations team through the build and confirm they can run the configuration as code

How we support

  • Offer ongoing support, upgrades and continuous testing as retainers after handover
  • Review selector growth and series counts when new services or sites join the hierarchy
  • Plan Prometheus version upgrades against the release cycle and the long-term support line you choose
  • Confirm support terms, response expectations and included upgrades in the written retainer scope

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.