Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update to latest VRL sha #21259

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ members = [

[workspace.dependencies]
chrono = { version = "0.4.38", default-features = false, features = ["clock", "serde"] }
chrono-tz = { version = "0.10.0", default-features = false, features = ["serde"] }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The serde feature is required for vector-common only.

clap = { version = "4.5.17", default-features = false, features = ["derive", "error-context", "env", "help", "std", "string", "usage", "wrap_help"] }
futures = { version = "0.3.30", default-features = false, features = ["compat", "io-compat", "std"], package = "futures" }
glob = { version = "0.3.1", default-features = false }
Expand All @@ -148,7 +149,7 @@ toml = { version = "0.8.19", default-features = false, features = ["display", "p
tonic = { version = "0.11", default-features = false, features = ["transport", "codegen", "prost", "tls", "tls-roots", "gzip"] }
tonic-build = { version = "0.11", default-features = false, features = ["transport", "prost"] }
uuid = { version = "1.10.0", features = ["v4", "v7", "serde"] }
vrl = { version = "0.18.0", features = ["arbitrary", "cli", "test", "test_framework"] }
vrl = { git = "https://github.com/vectordotdev/vrl", rev="cfcef6626e9131fbce5f45e7d05a6d82bc9f7116", features = ["arbitrary", "cli", "test", "test_framework"] }

[dependencies]
pin-project.workspace = true
Expand Down Expand Up @@ -276,7 +277,7 @@ bollard = { version = "0.16.1", default-features = false, features = ["ssl", "ch
bytes = { version = "1.7.1", default-features = false, features = ["serde"] }
bytesize = { version = "1.3.0", default-features = false }
chrono.workspace = true
chrono-tz = { version = "0.9.0", default-features = false }
chrono-tz.workspace = true
cidr-utils = { version = "0.6.1", default-features = false }
colored = { version = "2.1.0", default-features = false }
csv = { version = "1.3", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ tokenize = [
[dependencies]
async-stream = "0.3.5"
bytes = { version = "1.7.1", default-features = false, optional = true }
chrono-tz = { version = "0.9.0", default-features = false, features = ["serde"] }
chrono.workspace = true
chrono-tz.workspace = true
crossbeam-utils = { version = "0.8.20", default-features = false }
derivative = { version = "2.2.0", default-features = false }
futures.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ path = "tests/integration/lib.rs"

[dependencies]
chrono.workspace = true
chrono-tz = { version = "0.9.0", default-features = false }
chrono-tz.workspace = true
encoding_rs = { version = "0.8", default-features = false, features = ["alloc", "serde"] }
indexmap.workspace = true
inventory = { version = "0.3" }
Expand Down
3 changes: 2 additions & 1 deletion lib/vector-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async-trait = { version = "0.1", default-features = false }
bitmask-enum = { version = "2.2.4", default-features = false }
bytes = { version = "1.7.1", default-features = false, features = ["serde"] }
chrono.workspace = true
chrono-tz.workspace = true
crossbeam-utils = { version = "0.8.20", default-features = false }
db-key = { version = "0.0.5", default-features = false, optional = true }
derivative = { version = "2.2.0", default-features = false }
Expand Down Expand Up @@ -79,7 +80,7 @@ prost-build = "0.12"

[dev-dependencies]
base64 = "0.22.1"
chrono-tz = { version = "0.9.0", default-features = false }
chrono-tz.workspace = true
criterion = { version = "0.5.1", features = ["html_reports"] }
env-test-util = "1.0.1"
quickcheck = "1"
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-vrl/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ edition = "2021"
publish = false

[dependencies]
chrono-tz.workspace = true
enrichment = { path = "../../enrichment" }
vrl.workspace = true
vector-vrl-functions = { path = "../../vector-vrl/functions" }

ansi_term = "0.12"
chrono.workspace = true
chrono-tz = "0.9"
clap.workspace = true
glob.workspace = true
prettydiff = "0.7"
Expand Down
47 changes: 30 additions & 17 deletions src/conditions/datadog_search.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{borrow::Cow, str::FromStr};
use vrl::path::PathParseError;

use bytes::Bytes;
use vector_lib::configurable::configurable_component;
Expand Down Expand Up @@ -59,7 +60,7 @@ impl ConditionalConfig for DatadogSearchConfig {
&self,
_enrichment_tables: &vector_lib::enrichment::TableRegistry,
) -> crate::Result<Condition> {
let matcher = as_log(build_matcher(&self.source, &EventFilter));
let matcher = as_log(build_matcher(&self.source, &EventFilter).map_err(|e| e.to_string())?);

Ok(Condition::DatadogSearch(DatadogSearchRunner { matcher }))
}
Expand All @@ -80,8 +81,8 @@ struct EventFilter;
impl Resolver for EventFilter {}

impl Filter<LogEvent> for EventFilter {
fn exists(&self, field: Field) -> Box<dyn Matcher<LogEvent>> {
match field {
fn exists(&self, field: Field) -> Result<Box<dyn Matcher<LogEvent>>, PathParseError> {
Ok(match field {
Field::Tag(tag) => {
let starts_with = format!("{}:", tag);

Expand All @@ -101,11 +102,15 @@ impl Filter<LogEvent> for EventFilter {
.is_some()
})
}
}
})
}

fn equals(&self, field: Field, to_match: &str) -> Box<dyn Matcher<LogEvent>> {
match field {
fn equals(
&self,
field: Field,
to_match: &str,
) -> Result<Box<dyn Matcher<LogEvent>>, PathParseError> {
Ok(match field {
// Default fields are compared by word boundary.
Field::Default(field) => {
let re = word_regex(to_match);
Expand Down Expand Up @@ -138,11 +143,15 @@ impl Filter<LogEvent> for EventFilter {

string_or_numeric_match(field, move |value| value == to_match)
}
}
})
}

fn prefix(&self, field: Field, prefix: &str) -> Box<dyn Matcher<LogEvent>> {
match field {
fn prefix(
&self,
field: Field,
prefix: &str,
) -> Result<Box<dyn Matcher<LogEvent>>, PathParseError> {
Ok(match field {
// Default fields are matched by word boundary.
Field::Default(field) => {
let re = word_regex(&format!("{}*", prefix));
Expand All @@ -161,11 +170,15 @@ impl Filter<LogEvent> for EventFilter {

string_match(field, move |value| value.starts_with(&prefix))
}
}
})
}

fn wildcard(&self, field: Field, wildcard: &str) -> Box<dyn Matcher<LogEvent>> {
match field {
fn wildcard(
&self,
field: Field,
wildcard: &str,
) -> Result<Box<dyn Matcher<LogEvent>>, PathParseError> {
Ok(match field {
Field::Default(field) => {
let re = word_regex(wildcard);

Expand All @@ -181,18 +194,18 @@ impl Filter<LogEvent> for EventFilter {

string_match(field, move |value| re.is_match(&value))
}
}
})
}

fn compare(
&self,
field: Field,
comparator: Comparison,
comparison_value: ComparisonValue,
) -> Box<dyn Matcher<LogEvent>> {
) -> Result<Box<dyn Matcher<LogEvent>>, PathParseError> {
let rhs = Cow::from(comparison_value.to_string());

match field {
Ok(match field {
// Attributes are compared numerically if the value is numeric, or as strings otherwise.
Field::Attribute(f) => {
Run::boxed(move |log: &LogEvent| {
Expand Down Expand Up @@ -286,7 +299,7 @@ impl Filter<LogEvent> for EventFilter {
Comparison::Gte => lhs >= rhs,
})
}
}
})
}
}

Expand Down Expand Up @@ -1175,7 +1188,7 @@ mod test {

for (source, pass, fail) in checks {
let node: QueryNode = source.parse().unwrap();
let matcher = build_matcher(&node, &filter);
let matcher = build_matcher(&node, &filter).unwrap();

assert!(matcher.run(&processor(pass)));
assert!(!matcher.run(&processor(fail)));
Expand Down
Loading