diff --git a/Cargo.toml b/Cargo.toml index 9436e5d0674c6..e009135a82ff0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -557,7 +557,9 @@ sources-nats = ["dep:async-nats", "dep:nkeys"] sources-nginx_metrics = ["dep:nom"] sources-opentelemetry = ["dep:hex", "dep:opentelemetry-proto", "dep:prost-types", "sources-http_server", "sources-utils-http", "sources-vector"] sources-postgresql_metrics = ["dep:postgres-openssl", "dep:tokio-postgres"] -sources-prometheus = ["dep:prometheus-parser", "sinks-prometheus", "sources-utils-http-client"] +sources-prometheus = ["sources-prometheus-scrape", "sources-prometheus-remote-write"] +sources-prometheus-scrape = ["dep:prometheus-parser", "sinks-prometheus", "sources-utils-http-client"] +sources-prometheus-remote-write = ["dep:prometheus-parser", "sinks-prometheus", "sources-utils-http-client"] sources-redis= ["dep:redis"] sources-socket = ["sources-utils-net", "tokio-util/net"] sources-splunk_hec = ["dep:roaring"] diff --git a/src/sources/mod.rs b/src/sources/mod.rs index b39843357f96b..bbc124c5291ca 100644 --- a/src/sources/mod.rs +++ b/src/sources/mod.rs @@ -66,7 +66,11 @@ pub mod nginx_metrics; pub mod opentelemetry; #[cfg(feature = "sources-postgresql_metrics")] pub mod postgresql_metrics; -#[cfg(feature = "sources-prometheus")] +#[cfg(any( + feature = "sources-prometheus", + feature = "sources-prometheus-scrape", + feature = "sources-prometheus-remote-write" +))] pub mod prometheus; #[cfg(feature = "sources-redis")] pub mod redis; diff --git a/src/sources/prometheus/mod.rs b/src/sources/prometheus/mod.rs index e9950e3392f38..5715f0b4419a1 100644 --- a/src/sources/prometheus/mod.rs +++ b/src/sources/prometheus/mod.rs @@ -1,6 +1,10 @@ pub(crate) mod parser; +#[cfg(feature = "sources-prometheus-remote-write")] mod remote_write; +#[cfg(feature = "sources-prometheus-scrape")] mod scrape; +#[cfg(feature = "sources-prometheus-remote-write")] pub use remote_write::PrometheusRemoteWriteConfig; +#[cfg(feature = "sources-prometheus-scrape")] pub use scrape::PrometheusScrapeConfig;