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(dev): Set up vector-lib wrapper crate with vector-common #18927

Merged
merged 3 commits into from
Oct 25, 2023
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
9 changes: 8 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ members = [
"lib/vector-config-common",
"lib/vector-config-macros",
"lib/vector-core",
"lib/vector-lib",
"lib/vector-lookup",
"lib/vector-stream",
"lib/vector-vrl/cli",
Expand Down Expand Up @@ -140,11 +141,11 @@ opentelemetry-proto = { path = "lib/opentelemetry-proto", optional = true }
tracing-limit = { path = "lib/tracing-limit" }
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-config = { path = "lib/vector-config" }
vector-config-common = { path = "lib/vector-config-common" }
vector-config-macros = { path = "lib/vector-config-macros" }
vector-core = { path = "lib/vector-core", default-features = false, features = ["vrl"] }
vector-lib = { path = "lib/vector-lib", default-features = false }
vector-stream = { path = "lib/vector-stream" }
vector-vrl-functions = { path = "lib/vector-vrl/functions" }
loki-logproto = { path = "lib/loki-logproto", optional = true }
Expand Down
3 changes: 2 additions & 1 deletion lib/vector-core/src/config/output_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use std::fmt;

use vector_common::config::ComponentKey;

use crate::{config::configurable_component, schema};
use super::configurable_component;
use crate::schema;

/// Component output identifier.
#[configurable_component]
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-core/src/event/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use futures::{stream, Stream};
use quickcheck::{Arbitrary, Gen};
use vector_buffers::EventCount;
use vector_common::{
byte_size_of::ByteSizeOf,
config::ComponentKey,
finalization::{AddBatchNotifier, BatchNotifier, EventFinalizers, Finalizable},
json_size::JsonSize,
Expand All @@ -18,7 +19,6 @@ use super::{
EstimatedJsonEncodedSizeOf, Event, EventDataEq, EventFinalizer, EventMutRef, EventRef,
LogEvent, Metric, TraceEvent,
};
use crate::ByteSizeOf;

/// The type alias for an array of `LogEvent` elements.
pub type LogArray = Vec<LogEvent>;
Expand Down
13 changes: 7 additions & 6 deletions lib/vector-core/src/event/log_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,29 @@ use std::{
use crossbeam_utils::atomic::AtomicCell;
use lookup::lookup_v2::TargetPath;
use lookup::PathPrefix;
use lookup::{metadata_path, path};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize, Serializer};
use vector_common::{
byte_size_of::ByteSizeOf,
internal_event::{OptionalTag, TaggedEventsSent},
json_size::{JsonSize, NonZeroJsonSize},
request_metadata::GetEventCountTags,
EventDataEq,
};
use vrl::path::{parse_target_path, OwnedTargetPath, PathParseError};
use vrl::{event_path, owned_value_path};

use super::{
estimated_json_encoded_size_of::EstimatedJsonEncodedSizeOf,
finalization::{BatchNotifier, EventFinalizer},
metadata::EventMetadata,
util, EventFinalizers, Finalizable, Value,
util,
util::log::{all_fields, all_metadata_fields},
EventFinalizers, Finalizable, MaybeAsLogMut, Value,
};
use crate::config::LogNamespace;
use crate::config::{log_schema, telemetry};
use crate::event::util::log::{all_fields, all_metadata_fields};
use crate::{event::MaybeAsLogMut, ByteSizeOf};
use lookup::{metadata_path, path};
use once_cell::sync::Lazy;
use vrl::{event_path, owned_value_path};

static VECTOR_SOURCE_TYPE_PATH: Lazy<Option<OwnedTargetPath>> = Lazy::new(|| {
Some(OwnedTargetPath::metadata(owned_value_path!(
Expand Down
4 changes: 2 additions & 2 deletions lib/vector-core/src/event/lua/event.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use mlua::prelude::*;

use crate::event::lua::metric::LuaMetric;
use crate::event::{Event, LogEvent, Metric};
use super::super::{Event, LogEvent, Metric};
use super::metric::LuaMetric;

pub struct LuaEvent {
pub event: Event,
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-core/src/event/lua/log.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use mlua::prelude::*;

use crate::event::{EventMetadata, LogEvent, Value};
use super::super::{EventMetadata, LogEvent, Value};

impl<'a> IntoLua<'a> for LogEvent {
#![allow(clippy::wrong_self_convention)] // this trait is defined by mlua
Expand Down
14 changes: 6 additions & 8 deletions lib/vector-core/src/event/lua/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ use std::collections::BTreeMap;

use mlua::prelude::*;

use super::util::{table_to_timestamp, timestamp_to_table};
use crate::event::metric::TagValue;
use crate::{
event::{
metric::{self, MetricSketch, MetricTags, TagValueSet},
Metric, MetricKind, MetricValue, StatisticKind,
},
metrics::AgentDDSketch,
use super::super::{
metric::TagValue,
metric::{self, MetricSketch, MetricTags, TagValueSet},
Metric, MetricKind, MetricValue, StatisticKind,
};
use super::util::{table_to_timestamp, timestamp_to_table};
use crate::metrics::AgentDDSketch;

pub struct LuaMetric {
pub metric: Metric,
Expand Down
5 changes: 2 additions & 3 deletions lib/vector-core/src/event/merge_state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::event::LogEvent;
use super::LogEvent;

/// Encapsulates the inductive events merging algorithm.
///
Expand Down Expand Up @@ -38,8 +38,7 @@ impl LogEventMergeState {

#[cfg(test)]
mod test {
use super::LogEventMergeState;
use crate::event::LogEvent;
use super::*;

fn log_event_with_message(message: &str) -> LogEvent {
LogEvent::from(message)
Expand Down
4 changes: 2 additions & 2 deletions lib/vector-core/src/event/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::{borrow::Cow, collections::BTreeMap, fmt, sync::Arc};

use serde::{Deserialize, Serialize};
use vector_common::{config::ComponentKey, EventDataEq};
use vector_common::{byte_size_of::ByteSizeOf, config::ComponentKey, EventDataEq};
use vrl::{
compiler::SecretTarget,
value::{Kind, Value},
Expand All @@ -12,7 +12,7 @@ use vrl::{
use super::{BatchNotifier, EventFinalizer, EventFinalizers, EventStatus};
use crate::{
config::{LogNamespace, OutputId},
schema, ByteSizeOf,
schema,
};

const DATADOG_API_KEY: &str = "datadog_api_key";
Expand Down
12 changes: 5 additions & 7 deletions lib/vector-core/src/event/metric/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@ use std::{

use chrono::{DateTime, Utc};
use vector_common::{
byte_size_of::ByteSizeOf,
internal_event::{OptionalTag, TaggedEventsSent},
json_size::JsonSize,
request_metadata::GetEventCountTags,
EventDataEq,
};
use vector_config::configurable_component;

use crate::{
config::telemetry,
event::{
estimated_json_encoded_size_of::EstimatedJsonEncodedSizeOf, BatchNotifier, EventFinalizer,
EventFinalizers, EventMetadata, Finalizable,
},
ByteSizeOf,
use super::{
estimated_json_encoded_size_of::EstimatedJsonEncodedSizeOf, BatchNotifier, EventFinalizer,
EventFinalizers, EventMetadata, Finalizable,
};
use crate::config::telemetry;

#[cfg(any(test, feature = "test"))]
mod arbitrary;
Expand Down
3 changes: 1 addition & 2 deletions lib/vector-core/src/event/metric/series.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use core::fmt;

use crate::event::metric::TagValue;
use vector_common::byte_size_of::ByteSizeOf;
use vector_config::configurable_component;

use super::{write_list, write_word, MetricTags};
use super::{write_list, write_word, MetricTags, TagValue};

/// Metrics series.
#[configurable_component]
Expand Down
5 changes: 3 additions & 2 deletions lib/vector-core/src/event/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{collections::BTreeMap, convert::TryInto, fmt::Debug, sync::Arc};

use crate::config::LogNamespace;
use crate::{config::OutputId, ByteSizeOf};
pub use array::{into_event_stream, EventArray, EventContainer, LogArray, MetricArray, TraceArray};
pub use estimated_json_encoded_size_of::EstimatedJsonEncodedSizeOf;
pub use finalization::{
Expand All @@ -23,6 +21,9 @@ pub use vrl::value::Value;
#[cfg(feature = "vrl")]
pub use vrl_target::{TargetEvents, VrlTarget};

use crate::config::LogNamespace;
use crate::{config::OutputId, ByteSizeOf};

pub mod array;
pub mod discriminant;
mod estimated_json_encoded_size_of;
Expand Down
Loading