Skip to content

Commit

Permalink
Merge branch 'master' into dougsmith/remove-component-error-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmith3197 authored Oct 30, 2023
2 parents 386e794 + b9447f6 commit 6256248
Show file tree
Hide file tree
Showing 37 changed files with 123 additions and 105 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ pin-project.workspace = true

# Internal libs
dnsmsg-parser = { path = "lib/dnsmsg-parser", optional = true }
enrichment = { path = "lib/enrichment" }
fakedata = { path = "lib/fakedata", optional = true }
file-source = { path = "lib/file-source", optional = true }
lookup = { package = "vector-lookup", path = "lib/vector-lookup" }
Expand Down
1 change: 1 addition & 0 deletions lib/vector-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ publish = false

[dependencies]
codecs = { path = "../codecs", default-features = false }
enrichment = { path = "../enrichment" }
vector-buffers = { path = "../vector-buffers", default-features = false }
vector-common = { path = "../vector-common" }
vector-config = { path = "../vector-config" }
Expand Down
1 change: 1 addition & 0 deletions lib/vector-lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub use codecs;
pub use enrichment;
pub use vector_buffers as buffers;
pub use vector_common::{
assert_event_data_eq, btreemap, byte_size_of, byte_size_of::ByteSizeOf, conversion,
Expand Down
5 changes: 4 additions & 1 deletion src/conditions/datadog_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ impl Conditional for DatadogSearchRunner {
}

impl ConditionalConfig for DatadogSearchConfig {
fn build(&self, _enrichment_tables: &enrichment::TableRegistry) -> crate::Result<Condition> {
fn build(
&self,
_enrichment_tables: &vector_lib::enrichment::TableRegistry,
) -> crate::Result<Condition> {
let node = parse(&self.source)?;
let matcher = as_log(build_matcher(&node, &EventFilter));

Expand Down
15 changes: 12 additions & 3 deletions src/conditions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ pub enum ConditionConfig {
}

impl ConditionConfig {
pub fn build(&self, enrichment_tables: &enrichment::TableRegistry) -> crate::Result<Condition> {
pub fn build(
&self,
enrichment_tables: &vector_lib::enrichment::TableRegistry,
) -> crate::Result<Condition> {
match self {
ConditionConfig::IsLog => Ok(Condition::IsLog),
ConditionConfig::IsMetric => Ok(Condition::IsMetric),
Expand Down Expand Up @@ -148,7 +151,10 @@ pub trait Conditional: std::fmt::Debug {
}

pub trait ConditionalConfig: std::fmt::Debug + Send + Sync + dyn_clone::DynClone {
fn build(&self, enrichment_tables: &enrichment::TableRegistry) -> crate::Result<Condition>;
fn build(
&self,
enrichment_tables: &vector_lib::enrichment::TableRegistry,
) -> crate::Result<Condition>;
}

dyn_clone::clone_trait_object!(ConditionalConfig);
Expand Down Expand Up @@ -184,7 +190,10 @@ pub enum AnyCondition {
}

impl AnyCondition {
pub fn build(&self, enrichment_tables: &enrichment::TableRegistry) -> crate::Result<Condition> {
pub fn build(
&self,
enrichment_tables: &vector_lib::enrichment::TableRegistry,
) -> crate::Result<Condition> {
match self {
AnyCondition::String(s) => {
let vrl_config = VrlConfig {
Expand Down
7 changes: 5 additions & 2 deletions src/conditions/vrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ pub struct VrlConfig {
impl_generate_config_from_default!(VrlConfig);

impl ConditionalConfig for VrlConfig {
fn build(&self, enrichment_tables: &enrichment::TableRegistry) -> crate::Result<Condition> {
fn build(
&self,
enrichment_tables: &vector_lib::enrichment::TableRegistry,
) -> crate::Result<Condition> {
// TODO(jean): re-add this to VRL
// let constraint = TypeConstraint {
// allow_any: false,
Expand All @@ -43,7 +46,7 @@ impl ConditionalConfig for VrlConfig {

let functions = vrl::stdlib::all()
.into_iter()
.chain(enrichment::vrl_functions())
.chain(vector_lib::enrichment::vrl_functions())
.chain(vector_vrl_functions::all())
.collect::<Vec<_>>();

Expand Down
2 changes: 1 addition & 1 deletion src/config/enrichment_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ pub trait EnrichmentTableConfig: NamedComponent + core::fmt::Debug + Send + Sync
async fn build(
&self,
globals: &GlobalOptions,
) -> crate::Result<Box<dyn enrichment::Table + Send + Sync>>;
) -> crate::Result<Box<dyn vector_lib::enrichment::Table + Send + Sync>>;
}
2 changes: 1 addition & 1 deletion src/config/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Graph {
Node::Transform {
in_ty: transform.inner.input().data_type(),
outputs: transform.inner.outputs(
enrichment::TableRegistry::default(),
vector_lib::enrichment::TableRegistry::default(),
&[(id.into(), schema::Definition::any())],
schema.log_namespace(),
),
Expand Down
6 changes: 3 additions & 3 deletions src/config/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub struct TransformContext {

pub globals: GlobalOptions,

pub enrichment_tables: enrichment::TableRegistry,
pub enrichment_tables: vector_lib::enrichment::TableRegistry,

/// Tracks the schema IDs assigned to schemas exposed by the transform.
///
Expand Down Expand Up @@ -193,7 +193,7 @@ pub trait TransformConfig: DynClone + NamedComponent + core::fmt::Debug + Send +
/// of events flowing through the transform.
fn outputs(
&self,
enrichment_tables: enrichment::TableRegistry,
enrichment_tables: vector_lib::enrichment::TableRegistry,
input_definitions: &[(OutputId, schema::Definition)],

// This only exists for transforms that create logs from non-logs, to know which namespace
Expand Down Expand Up @@ -250,7 +250,7 @@ pub fn get_transform_output_ids<T: TransformConfig + ?Sized>(
) -> impl Iterator<Item = OutputId> + '_ {
transform
.outputs(
enrichment::TableRegistry::default(),
vector_lib::enrichment::TableRegistry::default(),
&[(key.clone().into(), schema::Definition::any())],
global_log_namespace,
)
Expand Down
4 changes: 2 additions & 2 deletions src/enrichment_tables/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use std::{
};

use bytes::Bytes;
use enrichment::{Case, Condition, IndexHandle, Table};
use tracing::trace;
use vector_lib::configurable::configurable_component;
use vector_lib::enrichment::{Case, Condition, IndexHandle, Table};
use vector_lib::{conversion::Conversion, TimeZone};
use vrl::value::Value;

Expand Down Expand Up @@ -250,7 +250,7 @@ impl EnrichmentTableConfig for FileConfig {

impl_generate_config_from_default!(FileConfig);

/// A struct that implements [enrichment::Table] to handle loading enrichment data from a CSV file.
/// A struct that implements [vector_lib::enrichment::Table] to handle loading enrichment data from a CSV file.
#[derive(Clone)]
pub struct File {
config: FileConfig,
Expand Down
4 changes: 2 additions & 2 deletions src/enrichment_tables/geoip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use maxminddb::{
use ordered_float::NotNan;
use vrl::value::Value;

use enrichment::{Case, Condition, IndexHandle, Table};
use vector_lib::configurable::configurable_component;
use vector_lib::enrichment::{Case, Condition, IndexHandle, Table};

use crate::config::{EnrichmentTableConfig, GenerateConfig};

Expand Down Expand Up @@ -101,7 +101,7 @@ impl EnrichmentTableConfig for GeoipConfig {
}

#[derive(Clone)]
/// A struct that implements [enrichment::Table] to handle loading enrichment data from a GeoIP database.
/// A struct that implements [vector_lib::enrichment::Table] to handle loading enrichment data from a GeoIP database.
pub struct Geoip {
config: GeoipConfig,
dbreader: Arc<maxminddb::Reader<Vec<u8>>>,
Expand Down
2 changes: 1 addition & 1 deletion src/enrichment_tables/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Functionality to handle enrichment tables.
pub use enrichment::{Condition, IndexHandle, Table};
use enum_dispatch::enum_dispatch;
use vector_lib::configurable::{configurable_component, NamedComponent};
pub use vector_lib::enrichment::{Condition, IndexHandle, Table};

use crate::config::{EnrichmentTableConfig, GlobalOptions};

Expand Down
3 changes: 1 addition & 2 deletions src/internal_events/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ impl InternalEvent for TcpBytesReceived {
);
counter!(
"component_received_bytes_total", self.byte_size as u64,
"protocol" => "tcp",
"peer_addr" => self.peer_addr.to_string()
"protocol" => "tcp"
);
}
}
Loading

0 comments on commit 6256248

Please sign in to comment.