From f015e84345be0d617f9446ea180a16788e96a179 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Mon, 22 Nov 2021 14:20:13 -0800 Subject: [PATCH 1/3] Convert lading configuration from toml to yaml, remove rayon This commit makes a breaking change to lading and opens up the 0.6 release series. The major change here is the conversion to the use of yaml in lading's configuration file, driven by the toml crates inability to deal with deserializing enums that have values in them. This means our 'static' format variant is not actually usable in toml-land, as that variant embeds a path in it. I have also taken the opportunity to do a little house cleaning, removing the rayon dependency from file_gen and adjusting the goofy case issues that we've had in configuration for a minute. Now every option will be snake_case and users don't have to deal with the odd Post etc anymore. Signed-off-by: Brian L. Troutwine --- Cargo.lock | 94 ++++++++----------- README.md | 7 -- lading_blackholes/Cargo.toml | 4 +- lading_blackholes/src/bin/http_blackhole.rs | 6 +- .../src/bin/splunk_hec_blackhole.rs | 2 +- lading_blackholes/src/bin/sqs_blackhole.rs | 2 +- lading_blackholes/src/bin/udp_blackhole.rs | 2 +- lading_common/Cargo.toml | 2 +- lading_generators/Cargo.toml | 5 +- lading_generators/README.md | 92 +++++++++--------- lading_generators/example.toml | 26 ----- lading_generators/example.yaml | 28 ++++++ lading_generators/src/bin/file_gen.rs | 7 +- lading_generators/src/bin/http_gen.rs | 2 +- lading_generators/src/bin/kafka_gen.rs | 2 +- lading_generators/src/bin/splunk_hec_gen.rs | 2 +- lading_generators/src/bin/tcp_gen.rs | 2 +- lading_generators/src/http_gen/config.rs | 3 +- lading_generators/src/kafka_gen/config.rs | 3 +- lading_generators/src/tcp_gen/config.rs | 1 + 20 files changed, 135 insertions(+), 157 deletions(-) delete mode 100644 lading_generators/example.toml create mode 100644 lading_generators/example.yaml diff --git a/Cargo.lock b/Cargo.lock index 98b7fe9b2..98978f62f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,8 +151,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" dependencies = [ "cfg-if 0.1.10", - "crossbeam-channel 0.4.4", - "crossbeam-deque 0.7.4", + "crossbeam-channel", + "crossbeam-deque", "crossbeam-epoch 0.8.2", "crossbeam-queue", "crossbeam-utils 0.7.2", @@ -168,16 +168,6 @@ dependencies = [ "maybe-uninit", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.5", -] - [[package]] name = "crossbeam-deque" version = "0.7.4" @@ -189,17 +179,6 @@ dependencies = [ "maybe-uninit", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch 0.9.5", - "crossbeam-utils 0.8.5", -] - [[package]] name = "crossbeam-epoch" version = "0.8.2" @@ -293,10 +272,10 @@ dependencies = [ ] [[package]] -name = "either" -version = "1.6.1" +name = "dtoa" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" [[package]] name = "endian-type" @@ -635,7 +614,7 @@ dependencies = [ [[package]] name = "lading_blackholes" -version = "0.5.3" +version = "0.6.0" dependencies = [ "argh", "hyper", @@ -646,14 +625,14 @@ dependencies = [ "serde", "serde_json", "serde_qs", + "serde_yaml", "tokio", - "toml", "tower", ] [[package]] name = "lading_common" -version = "0.5.3" +version = "0.6.0" dependencies = [ "arbitrary", "bytecount", @@ -669,7 +648,7 @@ dependencies = [ [[package]] name = "lading_generators" -version = "0.5.3" +version = "0.6.0" dependencies = [ "argh", "byte-unit", @@ -683,12 +662,11 @@ dependencies = [ "metrics-exporter-prometheus", "pretty_env_logger", "rand", - "rayon", "rdkafka", "serde", "serde_json", + "serde_yaml", "tokio", - "toml", ] [[package]] @@ -703,6 +681,12 @@ version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce" +[[package]] +name = "linked-hash-map" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" + [[package]] name = "lock_api" version = "0.4.5" @@ -1162,31 +1146,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "rayon" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" -dependencies = [ - "autocfg", - "crossbeam-deque 0.8.1", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" -dependencies = [ - "crossbeam-channel 0.5.1", - "crossbeam-deque 0.8.1", - "crossbeam-utils 0.8.5", - "lazy_static", - "num_cpus", -] - [[package]] name = "rdkafka" version = "0.27.0" @@ -1336,6 +1295,18 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_yaml" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af" +dependencies = [ + "dtoa", + "indexmap", + "serde", + "yaml-rust", +] + [[package]] name = "sketches-ddsketch" version = "0.1.2" @@ -1665,3 +1636,12 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] diff --git a/README.md b/README.md index 747021bb7..efc2d7f6a 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,3 @@ This project is a suite of tools used for data generation and load testing, primarily of the [vector](https://github.com/timberio/vector/) project today but maybe useful for you too. - -Please see the READMEs of the sub-projects for more details: - -* [`lading_common`](lading_common/README.md) -* [`file_gen`](file_gen/README.md) -* [`http_gen`](http_gen/README.md) -* [`udp_blackhole`](udp_blackhole/README.md) diff --git a/lading_blackholes/Cargo.toml b/lading_blackholes/Cargo.toml index 6875455da..200c7ebcd 100644 --- a/lading_blackholes/Cargo.toml +++ b/lading_blackholes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lading_blackholes" -version = "0.5.3" +version = "0.6.0" authors = ["Brian L. Troutwine "] edition = "2018" license = "MIT" @@ -13,7 +13,7 @@ description = "Blackhole programs with some instrumentation" tower = { version = "0.4", default-features = false, features = ["timeout", "limit", "load-shed"] } metrics = { version = "0.17", default-features = false, features = ["std"] } metrics-exporter-prometheus = { version = "0.6", default-features = false, features = ["tokio-exporter"] } -toml = "0.5" +serde_yaml = "0.8" serde_qs = "0.8.5" rand = "0.8.4" diff --git a/lading_blackholes/src/bin/http_blackhole.rs b/lading_blackholes/src/bin/http_blackhole.rs index 491dc98a7..6e5ca39ae 100644 --- a/lading_blackholes/src/bin/http_blackhole.rs +++ b/lading_blackholes/src/bin/http_blackhole.rs @@ -77,7 +77,7 @@ struct HttpServer { } #[derive(Serialize)] -#[serde(rename_all = "PascalCase")] +#[serde(rename_all = "snake_case")] struct KinesisPutRecordBatchResponseEntry { error_code: Option, error_message: Option, @@ -85,7 +85,7 @@ struct KinesisPutRecordBatchResponseEntry { } #[derive(Serialize)] -#[serde(rename_all = "PascalCase")] +#[serde(rename_all = "snake_case")] struct KinesisPutRecordBatchResponse { encrypted: Option, failed_put_count: u32, @@ -177,7 +177,7 @@ fn get_config() -> Config { .unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(); - toml::from_str(&contents).unwrap() + serde_yaml::from_str(&contents).unwrap() } fn main() { diff --git a/lading_blackholes/src/bin/splunk_hec_blackhole.rs b/lading_blackholes/src/bin/splunk_hec_blackhole.rs index 76ab71873..01455e0e4 100644 --- a/lading_blackholes/src/bin/splunk_hec_blackhole.rs +++ b/lading_blackholes/src/bin/splunk_hec_blackhole.rs @@ -53,7 +53,7 @@ struct Config { fn get_config() -> Config { let opts = argh::from_env::(); let contents = read_to_string(&opts.config_path).unwrap(); - toml::from_str::(&contents).unwrap() + serde_yaml::from_str::(&contents).unwrap() } struct SplunkHecServer { diff --git a/lading_blackholes/src/bin/sqs_blackhole.rs b/lading_blackholes/src/bin/sqs_blackhole.rs index 3db9aff79..dd9aa3019 100644 --- a/lading_blackholes/src/bin/sqs_blackhole.rs +++ b/lading_blackholes/src/bin/sqs_blackhole.rs @@ -51,7 +51,7 @@ fn get_config() -> Config { .unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(); - toml::from_str(&contents).unwrap() + serde_yaml::from_str(&contents).unwrap() } struct HttpServer { diff --git a/lading_blackholes/src/bin/udp_blackhole.rs b/lading_blackholes/src/bin/udp_blackhole.rs index 86b29e660..73f56a36b 100644 --- a/lading_blackholes/src/bin/udp_blackhole.rs +++ b/lading_blackholes/src/bin/udp_blackhole.rs @@ -65,7 +65,7 @@ fn get_config() -> Config { .unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(); - toml::from_str(&contents).unwrap() + serde_yaml::from_str(&contents).unwrap() } fn main() { diff --git a/lading_common/Cargo.toml b/lading_common/Cargo.toml index d15d5b736..669068809 100644 --- a/lading_common/Cargo.toml +++ b/lading_common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lading_common" -version = "0.5.3" +version = "0.6.0" authors = ["Brian L. Troutwine "] edition = "2018" license = "MIT" diff --git a/lading_generators/Cargo.toml b/lading_generators/Cargo.toml index edf77eefb..18ef3116e 100644 --- a/lading_generators/Cargo.toml +++ b/lading_generators/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lading_generators" readme = "README.md" -version = "0.5.3" +version = "0.6.0" authors = ["Brian L. Troutwine "] edition = "2018" license = "MIT" @@ -12,8 +12,7 @@ description = "Generating programs with stable throughput." [dependencies] lading_common = { path = "../lading_common" } -rayon = "1.5" -toml = "0.5" +serde_yaml = "0.8" [dependencies.argh] version = "0.1" diff --git a/lading_generators/README.md b/lading_generators/README.md index d25b5734b..b93390bb7 100644 --- a/lading_generators/README.md +++ b/lading_generators/README.md @@ -27,28 +27,29 @@ This program is primarily configured through its config file. Here is an example: ``` -worker_threads = 3 - -[targets.bar] -path_template = "/tmp/data/file_gen/%NNN%-bar.log" -duplicates = 1 -variant = "Ascii" -maximum_bytes_per_file = "4 Gb" -bytes_per_second = "50 Mb" -maximum_prebuild_cache_size_bytes = "3 Gb" - -[targets.foo] -path_template = "/tmp/data/file_gen/%NNN%-foo.log" -duplicates = 2 -variant = "Json" -maximum_bytes_per_file = "4 Gb" -bytes_per_second = "1 Gb" -maximum_prebuild_cache_size_bytes = "2 Gb" +worker_threads: 3 + +targets: + bar: + path_template: "/tmp/data/file_gen/%NNN%-bar.log" + duplicates: 1 + variant: "Ascii" + maximum_bytes_per_file: "4 Gb" + bytes_per_second: "50 Mb" + maximum_prebuild_cache_size_bytes: "3 Gb" + + foo: + path_template: "/tmp/data/file_gen/%NNN%-foo.log" + duplicates: 2 + variant: "Json" + maximum_bytes_per_file: "4 Gb" + bytes_per_second: "1 Gb" + maximum_prebuild_cache_size_bytes: "2 Gb" ``` This configuration will create two total targets 'foo' and 'bar'. Each target will produce a different line variant at a distinct tempo. Please see -[`example.toml`](./example.toml) for more details about the various options. +[`example.yaml`](./example.yaml) for more details about the various options. ### Telemetry @@ -86,19 +87,20 @@ This program is primarily configured through its config file. Here is an example: ``` -worker_threads = 10 -prometheus_addr = "0.0.0.0:9001" - -[targets.simple] -target_uri = "http://localhost:8282/v1/input" -bytes_per_second = "500 Mb" -parallel_connections = 100 -method.type = "Post" -method.variant = "DatadogLog" -method.maximum_prebuild_cache_size_bytes = "500 Mb" - -[targets.simple.headers] -dd-api-key = "deadbeef" +worker_threads: 10 +prometheus_addr: "0.0.0.0:9001" + +targets: + simple: + headers: + dd-api-key: "deadbeef" + target_uri: "http://localhost:8282/v1/input" + bytes_per_second: "500 Mb" + parallel_connections: 100 + method: + post: + variant = "DatadogLog" + maximum_prebuild_cache_size_bytes = "500 Mb" ``` This creates a single target 'simple' that emits datadog log agent payloads to @@ -131,20 +133,20 @@ This program is primarily configured through its config file. Here is an example: ``` -worker_threads = 10 -prometheus_addr = "0.0.0.0:9001" - -[targets.simple] -target_uri = "http://localhost:8088/" -token = "abcd1234" -format = "json" -bytes_per_second = "500 Mb" -parallel_connections = 100 -maximum_prebuild_cache_size_bytes = "500 Mb" - -[targets.simple.acknowledgements] -ack_query_interval_seconds = 10 -ack_timeout_seconds = 300 +worker_threads: 10 +prometheus_addr: "0.0.0.0:9001" + +targets: + simple: + target_uri = "http://localhost:8088/" + token = "abcd1234" + format = "json" + bytes_per_second = "500 Mb" + parallel_connections = 100 + maximum_prebuild_cache_size_bytes = "500 Mb" + acknowledgements: + ack_query_interval_seconds = 10 + ack_timeout_seconds = 300 ``` This creates a single target 'simple' that emits Splunk HEC payloads in JSON diff --git a/lading_generators/example.toml b/lading_generators/example.toml deleted file mode 100644 index ca13cf758..000000000 --- a/lading_generators/example.toml +++ /dev/null @@ -1,26 +0,0 @@ -# Set the number of background worker threads that this run will use. -worker_threads = 3 - -# Create a target 'foo'. This name will be used in telemetry and must be unique. -[targets.foo] -# Set the path template for this target. %NNN% will be replaced with an index up -# to `duplicates - 1`. -path_template = "/tmp/playground/%NNN%-foo.json" -# Set the total duplicates of this target. This run will make -# /tmp/playground/1-foo.json, 2-foo.json and 3-foo.json. -duplicates = 3 -# Set the variant of the lines produced. Available options are 'Json', 'Ascii' -# and 'Constant'. -variant = "Json" -# Set the maximum size of this target's files. When this **soft** limit is -# breached the file handler is closed and a new file in the **same** location is -# opened. The original file is deleted, simulating a 'rotation' without -# increasing the total number of files on disk. -maximum_bytes_per_file = "1Gb" -# Set the bytes available per second to be written. The target will not be able -# to produce bytes any faster than this, though it may chose to produce bytes -# less quickly. -bytes_per_second = "10Mb" -# Set the maximum size of lines that this target will produce. The target may -# produce lines of smaller size. -maximum_prebuild_cache_size_bytes = "3 Gb" diff --git a/lading_generators/example.yaml b/lading_generators/example.yaml new file mode 100644 index 000000000..add5fa4f2 --- /dev/null +++ b/lading_generators/example.yaml @@ -0,0 +1,28 @@ +# Set the number of background worker threads that this run will use. +worker_threads: 3 + +targets: + # Create a target 'foo'. This name will be used in telemetry and must be + # unique. + foo: + # Set the path template for this target. %NNN% will be replaced with an + # index up to `duplicates - 1`. + path_template: "/tmp/playground/%NNN%-foo.json" + # Set the total duplicates of this target. This run will make + # /tmp/playground/1-foo.json, 2-foo.json and 3-foo.json. + duplicates: 3 + # Set the variant of the lines produced. Available options are 'Json', 'Ascii' + # and 'Constant'. + variant: "Json" + # Set the maximum size of this target's files. When this **soft** limit is + # breached the file handler is closed and a new file in the **same** + # location is opened. The original file is deleted, simulating a 'rotation' + # without increasing the total number of files on disk. + maximum_bytes_per_file: "1Gb" + # Set the bytes available per second to be written. The target will not be + # able to produce bytes any faster than this, though it may chose to produce + # bytes less quickly. + bytes_per_second: "10Mb" + # Set the maximum size of lines that this target will produce. The target + # may produce lines of smaller size. + maximum_prebuild_cache_size_bytes: "3 Gb" diff --git a/lading_generators/src/bin/file_gen.rs b/lading_generators/src/bin/file_gen.rs index f6f13e430..e80434933 100644 --- a/lading_generators/src/bin/file_gen.rs +++ b/lading_generators/src/bin/file_gen.rs @@ -3,7 +3,6 @@ use futures::stream::{FuturesUnordered, StreamExt}; use lading_generators::file_gen::config::{Config, LogTargetTemplate}; use lading_generators::file_gen::Log; use metrics_exporter_prometheus::PrometheusBuilder; -use rayon::prelude::*; use std::collections::HashMap; use std::io::Read; use std::net::SocketAddr; @@ -32,9 +31,9 @@ async fn run(addr: SocketAddr, targets: HashMap) { let mut workers = FuturesUnordered::new(); - targets.into_par_iter().for_each(|(name, template)| { + targets.into_iter().for_each(|(name, template)| { (0..template.duplicates) - .into_par_iter() + .into_iter() .map(|duplicate| { let tgt_name = format!("{}[{}]", name.clone(), duplicate); let tgt = template.strike(duplicate); @@ -58,7 +57,7 @@ fn get_config() -> Config { .unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(); - toml::from_str(&contents).unwrap() + serde_yaml::from_str(&contents).unwrap() } fn main() { diff --git a/lading_generators/src/bin/http_gen.rs b/lading_generators/src/bin/http_gen.rs index d1acd17a9..356fbb9b9 100644 --- a/lading_generators/src/bin/http_gen.rs +++ b/lading_generators/src/bin/http_gen.rs @@ -48,7 +48,7 @@ fn get_config() -> Config { .unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(); - toml::from_str(&contents).unwrap() + serde_yaml::from_str(&contents).unwrap() } fn main() { diff --git a/lading_generators/src/bin/kafka_gen.rs b/lading_generators/src/bin/kafka_gen.rs index a143c9ad5..ace5a4b12 100644 --- a/lading_generators/src/bin/kafka_gen.rs +++ b/lading_generators/src/bin/kafka_gen.rs @@ -48,7 +48,7 @@ fn get_config() -> Config { .unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(); - toml::from_str(&contents).unwrap() + serde_yaml::from_str(&contents).unwrap() } fn main() { diff --git a/lading_generators/src/bin/splunk_hec_gen.rs b/lading_generators/src/bin/splunk_hec_gen.rs index 8cd71efa5..6aa9d4f61 100644 --- a/lading_generators/src/bin/splunk_hec_gen.rs +++ b/lading_generators/src/bin/splunk_hec_gen.rs @@ -23,7 +23,7 @@ struct Opts { fn get_config() -> Config { let opts = argh::from_env::(); let contents = read_to_string(&opts.config_path).unwrap(); - toml::from_str::(&contents).unwrap() + serde_yaml::from_str::(&contents).unwrap() } async fn run(addr: SocketAddr, targets: HashMap) { diff --git a/lading_generators/src/bin/tcp_gen.rs b/lading_generators/src/bin/tcp_gen.rs index 2984099e2..34dac8b31 100644 --- a/lading_generators/src/bin/tcp_gen.rs +++ b/lading_generators/src/bin/tcp_gen.rs @@ -48,7 +48,7 @@ fn get_config() -> Config { .unwrap(); let mut contents = String::new(); file.read_to_string(&mut contents).unwrap(); - toml::from_str(&contents).unwrap() + serde_yaml::from_str(&contents).unwrap() } fn main() { diff --git a/lading_generators/src/http_gen/config.rs b/lading_generators/src/http_gen/config.rs index 134340ec6..233da1af2 100644 --- a/lading_generators/src/http_gen/config.rs +++ b/lading_generators/src/http_gen/config.rs @@ -18,7 +18,7 @@ pub struct Config { /// The HTTP method to be used in requests #[derive(Debug, Deserialize)] -#[serde(tag = "type")] +#[serde(rename_all = "snake_case")] pub enum Method { /// Make HTTP Post requests Post { @@ -31,6 +31,7 @@ pub enum Method { /// Variant of the [`TargetTemplate`] #[derive(Debug, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum Variant { /// Generates Splunk HEC messages SplunkHec, diff --git a/lading_generators/src/kafka_gen/config.rs b/lading_generators/src/kafka_gen/config.rs index 17a23926e..5dae44a2f 100644 --- a/lading_generators/src/kafka_gen/config.rs +++ b/lading_generators/src/kafka_gen/config.rs @@ -17,7 +17,7 @@ pub struct Config { /// The throughput configuration #[derive(Clone, Copy, Debug, Deserialize)] -#[serde(tag = "type")] +#[serde(rename_all = "snake_case")] pub enum Throughput { /// The producer should run as fast as possible. Unlimited, @@ -35,6 +35,7 @@ pub enum Throughput { /// Variant of the [`TargetTemplate`] #[derive(Clone, Copy, Debug, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum Variant { /// Generates Datadog Logs JSON messages DatadogLog, diff --git a/lading_generators/src/tcp_gen/config.rs b/lading_generators/src/tcp_gen/config.rs index f77336849..6577bfff7 100644 --- a/lading_generators/src/tcp_gen/config.rs +++ b/lading_generators/src/tcp_gen/config.rs @@ -17,6 +17,7 @@ pub struct Config { /// Variant of the [`Target`] #[derive(Debug, Deserialize)] +#[serde(rename_all = "snake_case")] pub enum Variant { /// Generates Fluent messages Fluent, From ddaed8a0cc9c2020709037550efea945e3d391c4 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Mon, 22 Nov 2021 14:36:14 -0800 Subject: [PATCH 2/3] clippy ding Signed-off-by: Brian L. Troutwine --- lading_blackholes/src/bin/sqs_blackhole.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lading_blackholes/src/bin/sqs_blackhole.rs b/lading_blackholes/src/bin/sqs_blackhole.rs index dd9aa3019..cab945fa5 100644 --- a/lading_blackholes/src/bin/sqs_blackhole.rs +++ b/lading_blackholes/src/bin/sqs_blackhole.rs @@ -73,9 +73,8 @@ impl HttpServer { .install() .unwrap(); - let service = make_service_fn(|_: &AddrStream| async move { - Ok::<_, hyper::Error>(service_fn(move |request| srv(request))) - }); + let service = + make_service_fn(|_: &AddrStream| async move { Ok::<_, hyper::Error>(service_fn(srv)) }); let svc = ServiceBuilder::new() .load_shed() .concurrency_limit(concurrency_limit) From 0da91906d56acc899b829cea971d79f13e712e21 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Mon, 22 Nov 2021 15:02:49 -0800 Subject: [PATCH 3/3] missed default config names Signed-off-by: Brian L. Troutwine --- lading_blackholes/src/bin/http_blackhole.rs | 2 +- lading_blackholes/src/bin/splunk_hec_blackhole.rs | 2 +- lading_blackholes/src/bin/sqs_blackhole.rs | 2 +- lading_blackholes/src/bin/udp_blackhole.rs | 2 +- lading_generators/src/bin/file_gen.rs | 2 +- lading_generators/src/bin/http_gen.rs | 2 +- lading_generators/src/bin/kafka_gen.rs | 2 +- lading_generators/src/bin/splunk_hec_gen.rs | 2 +- lading_generators/src/bin/tcp_gen.rs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lading_blackholes/src/bin/http_blackhole.rs b/lading_blackholes/src/bin/http_blackhole.rs index 6e5ca39ae..ba4a58cfe 100644 --- a/lading_blackholes/src/bin/http_blackhole.rs +++ b/lading_blackholes/src/bin/http_blackhole.rs @@ -22,7 +22,7 @@ fn default_concurrent_requests_max() -> usize { } fn default_config_path() -> String { - "/etc/lading/http_blackhole.toml".to_string() + "/etc/lading/http_blackhole.yaml".to_string() } #[derive(Debug, Copy, Clone, Deserialize)] diff --git a/lading_blackholes/src/bin/splunk_hec_blackhole.rs b/lading_blackholes/src/bin/splunk_hec_blackhole.rs index 01455e0e4..60fc84945 100644 --- a/lading_blackholes/src/bin/splunk_hec_blackhole.rs +++ b/lading_blackholes/src/bin/splunk_hec_blackhole.rs @@ -25,7 +25,7 @@ fn default_concurrent_requests_max() -> usize { } fn default_config_path() -> String { - "/etc/lading/splunk_hec_blackhole.toml".to_string() + "/etc/lading/splunk_hec_blackhole.yaml".to_string() } #[derive(FromArgs)] diff --git a/lading_blackholes/src/bin/sqs_blackhole.rs b/lading_blackholes/src/bin/sqs_blackhole.rs index cab945fa5..2501845c5 100644 --- a/lading_blackholes/src/bin/sqs_blackhole.rs +++ b/lading_blackholes/src/bin/sqs_blackhole.rs @@ -14,7 +14,7 @@ use tokio::time::Duration; use tower::ServiceBuilder; fn default_config_path() -> String { - "/etc/lading/sqs_blackhole.toml".to_string() + "/etc/lading/sqs_blackhole.yaml".to_string() } fn default_concurrent_requests_max() -> usize { diff --git a/lading_blackholes/src/bin/udp_blackhole.rs b/lading_blackholes/src/bin/udp_blackhole.rs index 73f56a36b..b52b667d5 100644 --- a/lading_blackholes/src/bin/udp_blackhole.rs +++ b/lading_blackholes/src/bin/udp_blackhole.rs @@ -9,7 +9,7 @@ use tokio::net::UdpSocket; use tokio::runtime::Builder; fn default_config_path() -> String { - "/etc/lading/udp_blackhole.toml".to_string() + "/etc/lading/udp_blackhole.yaml".to_string() } #[derive(FromArgs)] diff --git a/lading_generators/src/bin/file_gen.rs b/lading_generators/src/bin/file_gen.rs index e80434933..c783fe749 100644 --- a/lading_generators/src/bin/file_gen.rs +++ b/lading_generators/src/bin/file_gen.rs @@ -10,7 +10,7 @@ use std::{fs, mem}; use tokio::runtime::Builder; fn default_config_path() -> String { - "/etc/lading/file_gen.toml".to_string() + "/etc/lading/file_gen.yaml".to_string() } #[derive(FromArgs)] diff --git a/lading_generators/src/bin/http_gen.rs b/lading_generators/src/bin/http_gen.rs index 356fbb9b9..843ce6c67 100644 --- a/lading_generators/src/bin/http_gen.rs +++ b/lading_generators/src/bin/http_gen.rs @@ -9,7 +9,7 @@ use std::net::SocketAddr; use tokio::runtime::Builder; fn default_config_path() -> String { - "/etc/lading/http_gen.toml".to_string() + "/etc/lading/http_gen.yaml".to_string() } #[derive(FromArgs)] diff --git a/lading_generators/src/bin/kafka_gen.rs b/lading_generators/src/bin/kafka_gen.rs index ace5a4b12..ccaade5e4 100644 --- a/lading_generators/src/bin/kafka_gen.rs +++ b/lading_generators/src/bin/kafka_gen.rs @@ -9,7 +9,7 @@ use std::net::SocketAddr; use tokio::runtime::Builder; fn default_config_path() -> String { - "/etc/lading/kafka_gen.toml".to_string() + "/etc/lading/kafka_gen.yaml".to_string() } #[derive(FromArgs)] diff --git a/lading_generators/src/bin/splunk_hec_gen.rs b/lading_generators/src/bin/splunk_hec_gen.rs index 6aa9d4f61..10808d1b3 100644 --- a/lading_generators/src/bin/splunk_hec_gen.rs +++ b/lading_generators/src/bin/splunk_hec_gen.rs @@ -10,7 +10,7 @@ use metrics_exporter_prometheus::PrometheusBuilder; use tokio::runtime::Builder; fn default_config_path() -> String { - "/etc/lading/splunk_hec_gen.toml".to_string() + "/etc/lading/splunk_hec_gen.yaml".to_string() } #[derive(FromArgs, Debug)] diff --git a/lading_generators/src/bin/tcp_gen.rs b/lading_generators/src/bin/tcp_gen.rs index 34dac8b31..422393757 100644 --- a/lading_generators/src/bin/tcp_gen.rs +++ b/lading_generators/src/bin/tcp_gen.rs @@ -9,7 +9,7 @@ use std::net::SocketAddr; use tokio::runtime::Builder; fn default_config_path() -> String { - "/etc/lading/tcp_gen.toml".to_string() + "/etc/lading/tcp_gen.yaml".to_string() } #[derive(FromArgs)]