Skip to content

Commit 164f1e9

Browse files
authored
chore(dev): Add wrapper for lookup in vector-lib (#18995)
1 parent 1eb418b commit 164f1e9

File tree

103 files changed

+188
-273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+188
-273
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ members = [
9797
"lib/k8s-e2e-tests",
9898
"lib/k8s-test-framework",
9999
"lib/loki-logproto",
100-
"lib/vector-lookup",
101100
"lib/portpicker",
102101
"lib/prometheus-parser",
103102
"lib/opentelemetry-proto",
@@ -131,7 +130,6 @@ pin-project.workspace = true
131130
# Internal libs
132131
dnsmsg-parser = { path = "lib/dnsmsg-parser", optional = true }
133132
fakedata = { path = "lib/fakedata", optional = true }
134-
lookup = { package = "vector-lookup", path = "lib/vector-lookup" }
135133
portpicker = { path = "lib/portpicker" }
136134
tracing-limit = { path = "lib/tracing-limit" }
137135
vector-lib = { path = "lib/vector-lib", default-features = false, features = ["vrl"] }
@@ -357,7 +355,6 @@ libc = "0.2.149"
357355
similar-asserts = "1.5.0"
358356
proptest = "1.3"
359357
quickcheck = "1.0.3"
360-
lookup = { package = "vector-lookup", path = "lib/vector-lookup", features = ["test"] }
361358
reqwest = { version = "0.11", features = ["json"] }
362359
rstest = {version = "0.18.2"}
363360
tempfile = "3.8.1"

lib/vector-lib/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ vector-buffers = { path = "../vector-buffers", default-features = false }
1616
vector-common = { path = "../vector-common" }
1717
vector-config = { path = "../vector-config" }
1818
vector-core = { path = "../vector-core", default-features = false }
19+
vector-lookup = { path = "../vector-lookup", features = ["test"] }
1920
vector-stream = { path = "../vector-stream" }
2021

2122
[features]

lib/vector-lib/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub use vector_core::{
2020
buckets, default_data_dir, event, fanout, metric_tags, metrics, partition, quantiles, samples,
2121
schema, serde, sink, source, tcp, tls, transform, update_counter, EstimatedJsonEncodedSizeOf,
2222
};
23+
pub use vector_lookup as lookup;
2324
pub use vector_stream as stream;
2425

2526
pub mod config {

src/codecs/encoding/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ where
154154

155155
#[cfg(test)]
156156
mod test {
157-
use lookup::lookup_v2::{parse_value_path, ConfigValuePath};
157+
use vector_lib::lookup::lookup_v2::{parse_value_path, ConfigValuePath};
158158

159159
use super::*;
160160
use crate::codecs::encoding::TimestampFormat;

src/codecs/encoding/transformer.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ use chrono::{DateTime, Utc};
44
use core::fmt::Debug;
55
use std::collections::BTreeMap;
66

7-
use lookup::lookup_v2::ConfigValuePath;
8-
use lookup::{event_path, PathPrefix};
97
use ordered_float::NotNan;
108
use serde::{Deserialize, Deserializer};
119
use vector_lib::configurable::configurable_component;
1210
use vector_lib::event::{LogEvent, MaybeAsLogMut};
11+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
12+
use vector_lib::lookup::{event_path, PathPrefix};
1313
use vector_lib::schema::meaning;
1414
use vrl::path::OwnedValuePath;
1515
use vrl::value::Value;
@@ -266,9 +266,9 @@ pub enum TimestampFormat {
266266
#[cfg(test)]
267267
mod tests {
268268
use indoc::indoc;
269-
use lookup::path::parse_target_path;
270269
use vector_lib::btreemap;
271270
use vector_lib::config::{log_schema, LogNamespace};
271+
use vector_lib::lookup::path::parse_target_path;
272272
use vrl::value::Kind;
273273

274274
use crate::config::schema;
@@ -375,10 +375,7 @@ mod tests {
375375
let mut base = Event::Log(LogEvent::from("Demo"));
376376
let timestamp = base
377377
.as_mut_log()
378-
.get((
379-
lookup::PathPrefix::Event,
380-
log_schema().timestamp_key().unwrap(),
381-
))
378+
.get((PathPrefix::Event, log_schema().timestamp_key().unwrap()))
382379
.unwrap()
383380
.clone();
384381
let timestamp = timestamp.as_timestamp().unwrap();
@@ -407,11 +404,8 @@ mod tests {
407404

408405
for actual in [
409406
// original key
410-
log.get((
411-
lookup::PathPrefix::Event,
412-
log_schema().timestamp_key().unwrap(),
413-
))
414-
.unwrap(),
407+
log.get((PathPrefix::Event, log_schema().timestamp_key().unwrap()))
408+
.unwrap(),
415409
// second key
416410
log.get("another").unwrap(),
417411
] {

src/sinks/aws_cloudwatch_logs/integration_tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use chrono::Duration;
66
use futures::{stream, StreamExt};
77
use similar_asserts::assert_eq;
88
use vector_lib::codecs::TextSerializerConfig;
9+
use vector_lib::lookup;
910

1011
use super::*;
1112
use crate::aws::create_client;

src/sinks/aws_kinesis/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use lookup::lookup_v2::ConfigValuePath;
21
use std::marker::PhantomData;
2+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
33

44
use vector_lib::stream::BatcherSettings;
55

src/sinks/aws_kinesis/sink.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{borrow::Cow, fmt::Debug, marker::PhantomData};
22

3-
use lookup::lookup_v2::ConfigValuePath;
43
use rand::random;
4+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
55
use vrl::path::PathPrefix;
66

77
use crate::{

src/sinks/aws_kinesis/streams/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use aws_sdk_kinesis::{
33
types::SdkError,
44
};
55
use futures::FutureExt;
6-
use lookup::lookup_v2::ConfigValuePath;
76
use snafu::Snafu;
87
use vector_lib::configurable::{component::GenerateConfig, configurable_component};
8+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
99

1010
use crate::sinks::util::retries::RetryAction;
1111
use crate::{

src/sinks/azure_monitor_logs/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use lookup::{lookup_v2::OptionalValuePath, OwnedValuePath};
21
use openssl::{base64, pkey};
2+
use vector_lib::lookup::{lookup_v2::OptionalValuePath, OwnedValuePath};
33

44
use vector_lib::configurable::configurable_component;
55
use vector_lib::sensitive_string::SensitiveString;

src/sinks/azure_monitor_logs/service.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ use http::{
44
HeaderName, HeaderValue, Request, StatusCode, Uri,
55
};
66
use hyper::Body;
7-
use lookup::lookup_v2::OwnedValuePath;
87
use once_cell::sync::Lazy;
98
use openssl::{base64, hash, pkey, sign};
109
use regex::Regex;
1110
use std::task::{Context, Poll};
1211
use tracing::Instrument;
12+
use vector_lib::lookup::lookup_v2::OwnedValuePath;
1313

1414
use crate::{http::HttpClient, sinks::prelude::*};
1515

src/sinks/azure_monitor_logs/sink.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::{fmt::Debug, io};
22

33
use bytes::Bytes;
4-
use lookup::{OwnedValuePath, PathPrefix};
54
use vector_lib::codecs::{encoding::Framer, CharacterDelimitedEncoder, JsonSerializerConfig};
5+
use vector_lib::lookup::{OwnedValuePath, PathPrefix};
66

77
use crate::sinks::prelude::*;
88

src/sinks/clickhouse/integration_tests.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use serde::Deserialize;
1616
use serde_json::Value;
1717
use tokio::time::{timeout, Duration};
1818
use vector_lib::event::{BatchNotifier, BatchStatus, BatchStatusReceiver, Event, LogEvent};
19+
use vector_lib::lookup::PathPrefix;
1920
use warp::Filter;
2021

2122
use super::*;
@@ -171,10 +172,7 @@ async fn insert_events_unix_timestamps() {
171172

172173
let exp_event = input_event.as_mut_log();
173174
exp_event.insert(
174-
(
175-
lookup::PathPrefix::Event,
176-
log_schema().timestamp_key().unwrap(),
177-
),
175+
(PathPrefix::Event, log_schema().timestamp_key().unwrap()),
178176
format!(
179177
"{}",
180178
exp_event
@@ -232,10 +230,7 @@ timestamp_format = "unix""#,
232230

233231
let exp_event = input_event.as_mut_log();
234232
exp_event.insert(
235-
(
236-
lookup::PathPrefix::Event,
237-
log_schema().timestamp_key().unwrap(),
238-
),
233+
(PathPrefix::Event, log_schema().timestamp_key().unwrap()),
239234
format!(
240235
"{}",
241236
exp_event

src/sinks/datadog/events/request_builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::{io, sync::Arc};
22

33
use bytes::Bytes;
4-
use lookup::lookup_v2::ConfigValuePath;
54
use vector_lib::codecs::JsonSerializerConfig;
5+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
66
use vector_lib::request_metadata::{MetaDescriptive, RequestMetadata};
77
use vector_lib::ByteSizeOf;
88

src/sinks/datadog/events/sink.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt;
22

3-
use lookup::event_path;
3+
use vector_lib::lookup::event_path;
44

55
use crate::{
66
internal_events::{ParserMissingFieldError, DROP_EVENT},

src/sinks/datadog/logs/sink.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::{fmt::Debug, io, sync::Arc};
22

33
use bytes::Bytes;
4-
use lookup::event_path;
54
use snafu::Snafu;
65
use vector_lib::codecs::{encoding::Framer, CharacterDelimitedEncoder, JsonSerializerConfig};
6+
use vector_lib::lookup::event_path;
77

88
use super::{config::MAX_PAYLOAD_BYTES, service::LogApiRequest};
99
use crate::sinks::{

src/sinks/elasticsearch/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ use crate::{
3131
tls::TlsConfig,
3232
transforms::metric_to_log::MetricToLogConfig,
3333
};
34-
use lookup::event_path;
35-
use lookup::lookup_v2::ConfigValuePath;
34+
use vector_lib::lookup::event_path;
35+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
3636
use vector_lib::schema::Requirement;
3737
use vrl::value::Kind;
3838

src/sinks/elasticsearch/sink.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt;
22

3-
use lookup::lookup_v2::ConfigValuePath;
3+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
44
use vrl::path::PathPrefix;
55

66
use crate::{

src/sinks/elasticsearch/tests.rs

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::{collections::BTreeMap, convert::TryFrom};
22

3+
use vector_lib::lookup::PathPrefix;
4+
35
use crate::{
46
codecs::Transformer,
57
event::{LogEvent, Metric, MetricKind, MetricValue, Value},
@@ -37,10 +39,7 @@ async fn sets_create_action_when_configured() {
3739

3840
let mut log = LogEvent::from("hello there");
3941
log.insert(
40-
(
41-
lookup::PathPrefix::Event,
42-
log_schema().timestamp_key().unwrap(),
43-
),
42+
(PathPrefix::Event, log_schema().timestamp_key().unwrap()),
4443
Utc.with_ymd_and_hms(2020, 12, 1, 1, 2, 3)
4544
.single()
4645
.expect("invalid timestamp"),
@@ -106,10 +105,7 @@ async fn encode_datastream_mode() {
106105

107106
let mut log = LogEvent::from("hello there");
108107
log.insert(
109-
(
110-
lookup::PathPrefix::Event,
111-
log_schema().timestamp_key().unwrap(),
112-
),
108+
(PathPrefix::Event, log_schema().timestamp_key().unwrap()),
113109
Utc.with_ymd_and_hms(2020, 12, 1, 1, 2, 3)
114110
.single()
115111
.expect("invalid timestamp"),
@@ -173,10 +169,7 @@ async fn encode_datastream_mode_no_routing() {
173169
),
174170
);
175171
log.insert(
176-
(
177-
lookup::PathPrefix::Event,
178-
log_schema().timestamp_key().unwrap(),
179-
),
172+
(PathPrefix::Event, log_schema().timestamp_key().unwrap()),
180173
Utc.with_ymd_and_hms(2020, 12, 1, 1, 2, 3)
181174
.single()
182175
.expect("invalid timestamp"),
@@ -324,10 +317,7 @@ async fn encode_datastream_mode_no_sync() {
324317
),
325318
);
326319
log.insert(
327-
(
328-
lookup::PathPrefix::Event,
329-
log_schema().timestamp_key().unwrap(),
330-
),
320+
(PathPrefix::Event, log_schema().timestamp_key().unwrap()),
331321
Utc.with_ymd_and_hms(2020, 12, 1, 1, 2, 3)
332322
.single()
333323
.expect("invalid timestamp"),

src/sinks/gcp/stackdriver/logs/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use crate::{
1515
};
1616
use http::{Request, Uri};
1717
use hyper::Body;
18-
use lookup::lookup_v2::ConfigValuePath;
1918
use snafu::Snafu;
2019
use std::collections::HashMap;
20+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
2121
use vrl::value::Kind;
2222

2323
use super::{

src/sinks/gcp/stackdriver/logs/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::{collections::HashMap, io};
44

55
use bytes::BytesMut;
6-
use lookup::lookup_v2::ConfigValuePath;
76
use serde_json::{json, to_vec, Map};
7+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
88
use vrl::path::PathPrefix;
99

1010
use crate::{

src/sinks/gcp/stackdriver/logs/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use chrono::{TimeZone, Utc};
55
use futures::{future::ready, stream};
66
use http::Uri;
77
use indoc::indoc;
8-
use lookup::lookup_v2::ConfigValuePath;
98
use serde::Deserialize;
109
use std::collections::HashMap;
10+
use vector_lib::lookup::lookup_v2::ConfigValuePath;
1111

1212
use crate::{
1313
config::{GenerateConfig, SinkConfig, SinkContext},

src/sinks/humio/logs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use lookup::lookup_v2::{ConfigValuePath, OptionalValuePath};
21
use vector_lib::codecs::JsonSerializerConfig;
32
use vector_lib::configurable::configurable_component;
3+
use vector_lib::lookup::lookup_v2::{ConfigValuePath, OptionalValuePath};
44
use vector_lib::sensitive_string::SensitiveString;
55

66
use super::config_host_key;

src/sinks/humio/metrics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use async_trait::async_trait;
22
use futures::StreamExt;
33
use futures_util::stream::BoxStream;
44
use indoc::indoc;
5-
use lookup::lookup_v2::{ConfigValuePath, OptionalValuePath};
65
use vector_lib::codecs::JsonSerializerConfig;
76
use vector_lib::configurable::configurable_component;
7+
use vector_lib::lookup;
8+
use vector_lib::lookup::lookup_v2::{ConfigValuePath, OptionalValuePath};
89
use vector_lib::sensitive_string::SensitiveString;
910
use vector_lib::sink::StreamSink;
1011

src/sinks/humio/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use lookup::lookup_v2::OptionalValuePath;
1+
use vector_lib::lookup::lookup_v2::OptionalValuePath;
22

33
pub mod logs;
44
pub mod metrics;

0 commit comments

Comments
 (0)