Skip to content

Commit

Permalink
chore: Remove Atoms (vectordotdev#4485)
Browse files Browse the repository at this point in the history
* Instrument eventlog

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Migrate get

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Migrate get_mut

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* insert and try_insert migration

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Migrate remove

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* wip

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Remove atom

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fmt

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fixup

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fixups

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fixups

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Internal event fixups

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* remove a comment

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fixup some consts

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fixups

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fixup trailing

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* chore: Fixup Cargo deny

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* Fixups

Signed-off-by: Ana Hobden <operator@hoverbear.org>

* fmt

Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Brian Menges <brian.menges@anaplan.com>
  • Loading branch information
Hoverbear authored and Brian Menges committed Dec 9, 2020
1 parent 583180d commit 5ba45c9
Show file tree
Hide file tree
Showing 102 changed files with 1,115 additions and 1,628 deletions.
72 changes: 0 additions & 72 deletions 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 @@ -114,7 +114,6 @@ hyper = "0.13"
hyper-openssl = "0.8"
openssl = "0.10.26"
openssl-probe = "0.1.2"
string_cache = "0.7.3"
flate2 = "1.0.6"
async-compression = { version = "0.3.5", features = ["tokio-02", "gzip"] }
structopt = "0.3.19"
Expand Down
49 changes: 10 additions & 39 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rand::{
prelude::*,
};
use std::convert::TryFrom;
use string_cache::DefaultAtom as Atom;

use vector::transforms::{
add_fields::AddFields,
coercer::CoercerConfig,
Expand Down Expand Up @@ -694,28 +694,10 @@ fn benchmark_remap(c: &mut Criterion) {

move || {
let result = tform.transform(event.clone()).unwrap();
assert_eq!(result.as_log().get("foo").unwrap().to_string_lossy(), "bar");
assert_eq!(result.as_log().get("bar").unwrap().to_string_lossy(), "baz");
assert_eq!(
result
.as_log()
.get(&Atom::from("foo"))
.unwrap()
.to_string_lossy(),
"bar"
);
assert_eq!(
result
.as_log()
.get(&Atom::from("bar"))
.unwrap()
.to_string_lossy(),
"baz"
);
assert_eq!(
result
.as_log()
.get(&Atom::from("copy"))
.unwrap()
.to_string_lossy(),
result.as_log().get("copy").unwrap().to_string_lossy(),
"buz"
);
}
Expand Down Expand Up @@ -756,19 +738,11 @@ fn benchmark_remap(c: &mut Criterion) {
move || {
let result = tform.transform(event.clone()).unwrap();
assert_eq!(
result
.as_log()
.get(&Atom::from("foo"))
.unwrap()
.to_string_lossy(),
result.as_log().get("foo").unwrap().to_string_lossy(),
r#"{"key": "value"}"#
);
assert_eq!(
result
.as_log()
.get(&Atom::from("bar"))
.unwrap()
.to_string_lossy(),
result.as_log().get("bar").unwrap().to_string_lossy(),
r#"{"key":"value"}"#
);
}
Expand All @@ -785,7 +759,7 @@ fn benchmark_remap(c: &mut Criterion) {

c.bench_function("remap: parse JSON with json_parser", |b| {
let tform = JsonParser::from(JsonParserConfig {
field: Some(Atom::from("foo")),
field: Some("foo".to_string()),
target_field: Some("bar".to_owned()),
drop_field: false,
drop_invalid: false,
Expand Down Expand Up @@ -813,15 +787,12 @@ fn benchmark_remap(c: &mut Criterion) {
move || {
let result = tform.transform(event.clone()).unwrap();
assert_eq!(
result.as_log().get(&Atom::from("number")).unwrap(),
result.as_log().get("number").unwrap(),
&Value::Integer(1234)
);
assert_eq!(result.as_log().get("bool").unwrap(), &Value::Boolean(true));
assert_eq!(
result.as_log().get(&Atom::from("bool")).unwrap(),
&Value::Boolean(true)
);
assert_eq!(
result.as_log().get(&Atom::from("timestamp")).unwrap(),
result.as_log().get("timestamp").unwrap(),
&Value::Timestamp(timestamp),
);
}
Expand Down
9 changes: 3 additions & 6 deletions benches/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ fn add_fields(c: &mut Criterion) {
let key = "the key";
let value = "this is the value";

let key_atom_native = key.into();
let value_bytes_native = Bytes::from(value).into();
let key_atom_v1 = key.into();
let value_bytes_v1 = Bytes::from(value).into();
let key_atom_v2 = key.into();
let value_bytes_v2 = Bytes::from(value).into();

c.bench(
Expand All @@ -37,7 +34,7 @@ fn add_fields(c: &mut Criterion) {
for _ in 0..num_events {
let event = Event::new_empty_log();
let event = transform.transform(event).unwrap();
assert_eq!(event.as_log()[&key_atom_native], value_bytes_native);
assert_eq!(event.as_log()[key], value_bytes_native);
}
},
)
Expand All @@ -52,7 +49,7 @@ fn add_fields(c: &mut Criterion) {
for _ in 0..num_events {
let event = Event::new_empty_log();
let event = transform.transform(event).unwrap();
assert_eq!(event.as_log()[&key_atom_v1], value_bytes_v1);
assert_eq!(event.as_log()[key], value_bytes_v1);
}
},
)
Expand All @@ -77,7 +74,7 @@ fn add_fields(c: &mut Criterion) {
for _ in 0..num_events {
let event = Event::new_empty_log();
let event = transform.transform(event).unwrap();
assert_eq!(event.as_log()[&key_atom_v2], value_bytes_v2);
assert_eq!(event.as_log()[key], value_bytes_v2);
}
},
)
Expand Down
2 changes: 1 addition & 1 deletion distribution/kubernetes/vector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace

- name: LOG
value: info
resources:
Expand Down
Loading

0 comments on commit 5ba45c9

Please sign in to comment.