Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 11 additions & 0 deletions Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ members = [
"lib/vrl/stdlib",
"lib/vrl/tests",
"lib/vrl/proptests",
"lib/vrl/vrl",
"lib/vector-vrl-functions",
"lib/datadog/grok",
"lib/datadog/search-syntax",
Expand All @@ -110,7 +111,7 @@ value = { path = "lib/value" }
vector-api-client = { path = "lib/vector-api-client", optional = true }
vector_buffers = { path = "lib/vector-buffers", default-features = false }
vector_common = { path = "lib/vector-common" }
vector_core = { path = "lib/vector-core", default-features = false, features = ["vrl"] }
vector_core = { path = "lib/vector-core", default-features = false, features = ["vrl_"] }
vrl-cli = { path = "lib/vrl/cli", optional = true }
vector-vrl-functions = { path = "lib/vector-vrl-functions" }

Expand Down Expand Up @@ -205,7 +206,7 @@ sha2 = { version = "0.10.2", optional = true }
hex = { version = "0.4.3", optional = true }

# VRL Lang
vrl = { path = "lib/vrl/core" }
vrl = { path = "lib/vrl/vrl" }
vrl-stdlib = { path = "lib/vrl/stdlib" }

# Lookup
Expand Down Expand Up @@ -336,7 +337,7 @@ tempfile = "3.3.0"
tokio = { version = "1.17.0", features = ["test-util"] }
tokio-test = "0.4.2"
tower-test = "0.4.0"
vector_core = { path = "lib/vector-core", default-features = false, features = ["vrl", "test"] }
vector_core = { path = "lib/vector-core", default-features = false, features = ["vrl_", "test"] }
walkdir = "2.3.2"
wiremock = "0.5.10"
quickcheck = "1.0.3"
Expand Down
3 changes: 1 addition & 2 deletions lib/enrichment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ arc-swap = { version = "1.4.0", default-features = false }
dyn-clone = { version = "1.0.4", default-features = false }
chrono = { version = "0.4.19", default-features = false }
vector_common = { path = "../vector-common", default-features = false, features = [ "btreemap", "conversion" ] }
vrl-core = { package = "vrl", path = "../vrl/core" }

vrl = { package = "vrl", path = "../vrl/vrl" }
4 changes: 2 additions & 2 deletions lib/enrichment/src/find_enrichment_table_records.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;

use vrl_core::prelude::*;
use vrl::prelude::*;

use crate::{
vrl_util::{self, add_index, evaluate_condition},
Expand Down Expand Up @@ -196,7 +196,7 @@ mod tests {

let tz = TimeZone::default();
let mut object: Value = BTreeMap::new().into();
let mut runtime_state = vrl_core::state::Runtime::default();
let mut runtime_state = vrl::state::Runtime::default();
let mut ctx = Context::new(&mut object, &mut runtime_state, &tz);

registry.finish_load();
Expand Down
4 changes: 2 additions & 2 deletions lib/enrichment/src/get_enrichment_table_record.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;

use vrl_core::prelude::*;
use vrl::prelude::*;

use crate::{
vrl_util::{self, add_index, evaluate_condition},
Expand Down Expand Up @@ -188,7 +188,7 @@ mod tests {

let tz = TimeZone::default();
let mut object: Value = BTreeMap::new().into();
let mut runtime_state = vrl_core::state::Runtime::default();
let mut runtime_state = vrl::state::Runtime::default();
let mut ctx = Context::new(&mut object, &mut runtime_state, &tz);

registry.finish_load();
Expand Down
8 changes: 4 additions & 4 deletions lib/enrichment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::collections::BTreeMap;

use dyn_clone::DynClone;
pub use tables::{TableRegistry, TableSearch};
use vrl_core::Value;
use vrl::Value;

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct IndexHandle(pub usize);
Expand Down Expand Up @@ -46,7 +46,7 @@ pub trait Table: DynClone {
condition: &'a [Condition<'a>],
select: Option<&[String]>,
index: Option<IndexHandle>,
) -> Result<BTreeMap<String, vrl_core::Value>, String>;
) -> Result<BTreeMap<String, vrl::Value>, String>;

/// Search the enrichment table data with the given condition.
/// All conditions must match (AND).
Expand All @@ -57,7 +57,7 @@ pub trait Table: DynClone {
condition: &'a [Condition<'a>],
select: Option<&[String]>,
index: Option<IndexHandle>,
) -> Result<Vec<BTreeMap<String, vrl_core::Value>>, String>;
) -> Result<Vec<BTreeMap<String, vrl::Value>>, String>;

/// Hints to the enrichment table what data is going to be searched to allow it to index the
/// data in advance.
Expand All @@ -75,7 +75,7 @@ pub trait Table: DynClone {

dyn_clone::clone_trait_object!(Table);

pub fn vrl_functions() -> Vec<Box<dyn vrl_core::Function>> {
pub fn vrl_functions() -> Vec<Box<dyn vrl::Function>> {
vec![
Box::new(get_enrichment_table_record::GetEnrichmentTableRecord) as _,
Box::new(find_enrichment_table_records::FindEnrichmentTableRecords) as _,
Expand Down
6 changes: 3 additions & 3 deletions lib/enrichment/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl TableSearch {
condition: &'a [Condition<'a>],
select: Option<&[String]>,
index: Option<IndexHandle>,
) -> Result<BTreeMap<String, vrl_core::Value>, String> {
) -> Result<BTreeMap<String, vrl::Value>, String> {
let tables = self.0.load();
if let Some(ref tables) = **tables {
match tables.get(table) {
Expand All @@ -226,7 +226,7 @@ impl TableSearch {
condition: &'a [Condition<'a>],
select: Option<&[String]>,
index: Option<IndexHandle>,
) -> Result<Vec<BTreeMap<String, vrl_core::Value>>, String> {
) -> Result<Vec<BTreeMap<String, vrl::Value>>, String> {
let tables = self.0.load();
if let Some(ref tables) = **tables {
match tables.get(table) {
Expand Down Expand Up @@ -272,7 +272,7 @@ fn fmt_enrichment_table(
#[cfg(test)]
mod tests {
use vector_common::btreemap;
use vrl_core::Value;
use vrl::Value;

use super::*;
use crate::test_util::DummyEnrichmentTable;
Expand Down
2 changes: 1 addition & 1 deletion lib/enrichment/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
};

use vector_common::btreemap;
use vrl_core::Value;
use vrl::Value;

use crate::{Case, Condition, IndexHandle, Table, TableRegistry};

Expand Down
2 changes: 1 addition & 1 deletion lib/enrichment/src/vrl_util.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Utilities shared between both VRL functions.
use std::collections::BTreeMap;

use vrl_core::{
use vrl::{
diagnostic::{Label, Span},
prelude::*,
};
Expand Down
6 changes: 4 additions & 2 deletions lib/vector-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ twox-hash = { version = "1.6.2", default-features = false }
value = { path = "../value", default-features = false, features = ["lua", "toml", "json", "api"] }
vector_buffers = { path = "../vector-buffers", default-features = false }
vector_common = { path = "../vector-common" }
vrl-core = { package = "vrl", path = "../vrl/core", optional = true }
vrl = { package = "vrl", path = "../vrl/vrl", optional = true }

[build-dependencies]
prost-build = "0.9"
Expand All @@ -81,7 +81,9 @@ value = { path = "../value", default-features = false, features = ["lua", "toml"
api = ["async-graphql", "value/api"]
default = []
lua = ["mlua", "tokio-stream"]
vrl = ["vrl-core", "enrichment"]
# Rename to "vrl" once we use a release with stable `-Z namespaced-features`:
# https://doc.rust-lang.org/cargo/reference/unstable.html#namespaced-features
vrl_ = ["vrl", "enrichment"]
test = ["vector_common/test"]

[[bench]]
Expand Down
12 changes: 6 additions & 6 deletions lib/vector-core/src/event/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use getset::{Getters, MutGetters};
use serde::{Deserialize, Serialize};
use vector_common::EventDataEq;
#[cfg(feature = "vrl")]
use vrl_core::prelude::VrlValueConvert;
use vrl::prelude::VrlValueConvert;

use crate::{
event::{BatchNotifier, EventFinalizer, EventFinalizers, EventMetadata, Finalizable},
Expand Down Expand Up @@ -128,10 +128,10 @@ pub enum MetricKind {
}

#[cfg(feature = "vrl")]
impl TryFrom<vrl_core::Value> for MetricKind {
impl TryFrom<vrl::Value> for MetricKind {
type Error = String;

fn try_from(value: vrl_core::Value) -> Result<Self, Self::Error> {
fn try_from(value: vrl::Value) -> Result<Self, Self::Error> {
let value = value.try_bytes().map_err(|e| e.to_string())?;
match std::str::from_utf8(&value).map_err(|e| e.to_string())? {
"incremental" => Ok(Self::Incremental),
Expand All @@ -145,7 +145,7 @@ impl TryFrom<vrl_core::Value> for MetricKind {
}

#[cfg(feature = "vrl")]
impl From<MetricKind> for vrl_core::Value {
impl From<MetricKind> for vrl::Value {
fn from(kind: MetricKind) -> Self {
match kind {
MetricKind::Incremental => "incremental".into(),
Expand Down Expand Up @@ -470,7 +470,7 @@ pub fn zip_quantiles(
/// Currently vrl can only read the type of the value and doesn't consider
/// any actual metric values.
#[cfg(feature = "vrl")]
impl From<MetricValue> for vrl_core::Value {
impl From<MetricValue> for vrl::Value {
fn from(value: MetricValue) -> Self {
value.as_name().into()
}
Expand Down Expand Up @@ -525,7 +525,7 @@ impl ByteSizeOf for MetricSketch {
/// Currently vrl can only read the type of the value and doesn't consider
/// any actual metric values.
#[cfg(feature = "vrl")]
impl From<MetricSketch> for vrl_core::Value {
impl From<MetricSketch> for vrl::Value {
fn from(value: MetricSketch) -> Self {
value.as_name().into()
}
Expand Down
Loading