Federation

    Federation allows a Prometheus server to scrape selected time series from another Prometheus server.

    There are different use cases for federation. Commonly, it is used to either achieve scalable Prometheus monitoring setups or to pull related metrics from one service’s Prometheus into another.

    For example, a setup might consist of many per-datacenter Prometheus servers that collect data in high detail (instance-level drill-down), and a set of global Prometheus servers which collect and store only aggregated data (job-level drill-down) from those local servers. This provides an aggregate global view and detailed local views.

    Cross-service federation

    In cross-service federation, a Prometheus server of one service is configured to scrape selected data from another service’s Prometheus server to enable alerting and queries against both datasets within a single server.

    Configuring federation

    On any given Prometheus server, the endpoint allows retrieving the current value for a selected set of time series in that server. At least one match[] URL parameter must be specified to select the series to expose. Each match[] argument needs to specify an like up or . If multiple match[] parameters are provided, the union of all matched series is selected.

    To federate metrics from one server to another, configure your destination Prometheus server to scrape from the /federate endpoint of a source server, while also enabling the honor_labels scrape option (to not overwrite any labels exposed by the source server) and passing in the desired parameters. For example, the following scrape_configs federates any series with the label job="prometheus" or a metric name starting with job: from the Prometheus servers at into the scraping Prometheus: