Skip to content

Commit

Permalink
Convert lading configuration from toml to yaml, remove rayon (#119)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
blt authored Nov 23, 2021
1 parent 08e86f0 commit 643785a
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 169 deletions.
94 changes: 37 additions & 57 deletions Cargo.lock

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

7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions lading_blackholes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lading_blackholes"
version = "0.5.3"
version = "0.6.0"
authors = ["Brian L. Troutwine <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -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"

Expand Down
8 changes: 4 additions & 4 deletions lading_blackholes/src/bin/http_blackhole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -77,15 +77,15 @@ struct HttpServer {
}

#[derive(Serialize)]
#[serde(rename_all = "PascalCase")]
#[serde(rename_all = "snake_case")]
struct KinesisPutRecordBatchResponseEntry {
error_code: Option<String>,
error_message: Option<String>,
record_id: String,
}

#[derive(Serialize)]
#[serde(rename_all = "PascalCase")]
#[serde(rename_all = "snake_case")]
struct KinesisPutRecordBatchResponse {
encrypted: Option<bool>,
failed_put_count: u32,
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions lading_blackholes/src/bin/splunk_hec_blackhole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -53,7 +53,7 @@ struct Config {
fn get_config() -> Config {
let opts = argh::from_env::<Opts>();
let contents = read_to_string(&opts.config_path).unwrap();
toml::from_str::<Config>(&contents).unwrap()
serde_yaml::from_str::<Config>(&contents).unwrap()
}

struct SplunkHecServer {
Expand Down
9 changes: 4 additions & 5 deletions lading_blackholes/src/bin/sqs_blackhole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lading_blackholes/src/bin/udp_blackhole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion lading_common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lading_common"
version = "0.5.3"
version = "0.6.0"
authors = ["Brian L. Troutwine <[email protected]>"]
edition = "2018"
license = "MIT"
Expand Down
5 changes: 2 additions & 3 deletions lading_generators/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "lading_generators"
readme = "README.md"
version = "0.5.3"
version = "0.6.0"
authors = ["Brian L. Troutwine <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -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"
Expand Down
Loading

0 comments on commit 643785a

Please sign in to comment.