Skip to content

Commit

Permalink
chore(log_to_metric transform): Add Cargo feature for the transform (v…
Browse files Browse the repository at this point in the history
…ectordotdev#18337)

The `log_to_metric` transform was missing a corresponding Cargo feature. Therefore, when compiling
Vector with a reduced set of features, this transform was always included even if not requested.

This is the only transform that was still missing a Cargo feature.

The previous attempt incorrectly tried to feature-gate the `parser` module in `internal_events`.
Instead, this commit allows for the `parser` module imports to be left unused when not required.

The test configuration in the `api` module was also missing a dependency on `transforms-log_to_metric`.

Signed-off-by: Hugo Hromic <hhromic@gmail.com>
  • Loading branch information
hhromic committed Aug 22, 2023
1 parent b982a74 commit d044084
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ transforms-logs = [
"transforms-aws_ec2_metadata",
"transforms-dedupe",
"transforms-filter",
"transforms-log_to_metric",
"transforms-lua",
"transforms-metric_to_log",
"transforms-pipelines",
Expand All @@ -592,6 +593,7 @@ transforms-logs = [
transforms-metrics = [
"transforms-aggregate",
"transforms-filter",
"transforms-log_to_metric",
"transforms-lua",
"transforms-metric_to_log",
"transforms-pipelines",
Expand All @@ -604,6 +606,7 @@ transforms-aggregate = []
transforms-aws_ec2_metadata = ["dep:arc-swap"]
transforms-dedupe = ["dep:lru"]
transforms-filter = []
transforms-log_to_metric = []
transforms-lua = ["dep:mlua", "vector-core/lua"]
transforms-metric_to_log = []
transforms-pipelines = ["transforms-filter", "transforms-route"]
Expand Down Expand Up @@ -848,6 +851,7 @@ shutdown-tests = ["api", "sinks-blackhole", "sinks-console", "sinks-prometheus",
cli-tests = ["sinks-blackhole", "sinks-socket", "sources-demo_logs", "sources-file"]
vector-api-tests = [
"sources-demo_logs",
"transforms-log_to_metric",
"transforms-remap",
"sinks-blackhole"
]
Expand Down
1 change: 1 addition & 0 deletions src/api/tap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ async fn tap_handler(
test,
feature = "sinks-blackhole",
feature = "sources-demo_logs",
feature = "transforms-log_to_metric",
feature = "transforms-remap",
))]
mod tests {
Expand Down
3 changes: 3 additions & 0 deletions src/internal_events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ mod journald;
mod kafka;
#[cfg(feature = "sources-kubernetes_logs")]
mod kubernetes_logs;
#[cfg(feature = "transforms-log_to_metric")]
mod log_to_metric;
mod logplex;
#[cfg(feature = "sinks-loki")]
Expand Down Expand Up @@ -213,6 +214,7 @@ pub(crate) use self::journald::*;
pub(crate) use self::kafka::*;
#[cfg(feature = "sources-kubernetes_logs")]
pub(crate) use self::kubernetes_logs::*;
#[cfg(feature = "transforms-log_to_metric")]
pub(crate) use self::log_to_metric::*;
#[cfg(feature = "sources-heroku_logs")]
pub(crate) use self::logplex::*;
Expand All @@ -224,6 +226,7 @@ pub(crate) use self::lua::*;
pub(crate) use self::metric_to_log::*;
#[cfg(feature = "sources-nginx_metrics")]
pub(crate) use self::nginx_metrics::*;
#[allow(unused_imports)]
pub(crate) use self::parser::*;
#[cfg(feature = "sources-postgresql_metrics")]
pub(crate) use self::postgresql_metrics::*;
Expand Down
1 change: 1 addition & 0 deletions src/transforms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod aws_ec2_metadata;
pub mod dedupe;
#[cfg(feature = "transforms-filter")]
pub mod filter;
#[cfg(feature = "transforms-log_to_metric")]
pub mod log_to_metric;
#[cfg(feature = "transforms-lua")]
pub mod lua;
Expand Down

0 comments on commit d044084

Please sign in to comment.