diff --git a/src/sources/prometheus/scrape.rs b/src/sources/prometheus/scrape.rs index 882577896effc..ac20215b7ef55 100644 --- a/src/sources/prometheus/scrape.rs +++ b/src/sources/prometheus/scrape.rs @@ -134,11 +134,16 @@ impl GenerateConfig for PrometheusScrapeConfig { #[typetag::serde(name = "prometheus_scrape")] impl SourceConfig for PrometheusScrapeConfig { async fn build(&self, cx: SourceContext) -> Result { + // replace the key match with match[], if present + let mut query: HashMap> = self.query.clone(); + if let Some(values) = query.remove("match") { + query.insert("match[]".to_string(), values); + } let urls = self .endpoints .iter() .map(|s| s.parse::().context(sources::UriParseSnafu)) - .map(|r| r.map(|uri| build_url(&uri, &self.query))) + .map(|r| r.map(|uri| build_url(&uri, &query))) .collect::, sources::BuildError>>()?; let tls = TlsSettings::from_options(&self.tls)?;