From 2c8d17bea8cae0507261454d43f381af3de112e5 Mon Sep 17 00:00:00 2001 From: Paul Dix Date: Wed, 8 Dec 2021 10:29:35 -0500 Subject: [PATCH] refactor: change percent to ratio in data generator bucket writers --- iox_data_generator/benches/point_generation.rs | 4 ++-- iox_data_generator/schemas/cap-write.toml | 2 +- iox_data_generator/schemas/full_example.toml | 4 ++-- .../schemas/storage_cardinality_example.toml | 2 +- iox_data_generator/schemas/tracing-spec.toml | 2 +- iox_data_generator/src/lib.rs | 2 +- iox_data_generator/src/measurement.rs | 4 ++-- iox_data_generator/src/specification.rs | 14 +++++++------- iox_data_generator/src/tag_set.rs | 6 +++--- iox_data_generator/src/write.rs | 4 ++-- perf/battery-0/datagen.toml | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/iox_data_generator/benches/point_generation.rs b/iox_data_generator/benches/point_generation.rs index 0b38ef81d9..c84afd8377 100644 --- a/iox_data_generator/benches/point_generation.rs +++ b/iox_data_generator/benches/point_generation.rs @@ -30,7 +30,7 @@ pub fn single_agent(c: &mut Criterion) { tag_pairs: vec![], }], bucket_writers: vec![BucketWriterSpec { - percent: 1.0, + ratio: 1.0, agents: vec![AgentAssignmentSpec { name: "foo".to_string(), count: None, @@ -154,7 +154,7 @@ name = "gauge" i64_range = [1, 8147240] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "1s", count = 3}] "#).unwrap(); diff --git a/iox_data_generator/schemas/cap-write.toml b/iox_data_generator/schemas/cap-write.toml index d80fa8cc2c..4cbe75042a 100644 --- a/iox_data_generator/schemas/cap-write.toml +++ b/iox_data_generator/schemas/cap-write.toml @@ -3,7 +3,7 @@ name = "cap_write" [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "telegraf", count = 3, sampling_interval = "10s"}] [[agents]] diff --git a/iox_data_generator/schemas/full_example.toml b/iox_data_generator/schemas/full_example.toml index 6be2dcd5a4..170e814601 100644 --- a/iox_data_generator/schemas/full_example.toml +++ b/iox_data_generator/schemas/full_example.toml @@ -177,12 +177,12 @@ bool = true # amounts of write load as well as different schemas through specifying different agents. [[bucket_writers]] # 20% of the buckets specified in the --bucket_list file will have these agents writing to them -percent = 0.2 +ratio = 0.2 # for each of those buckets, have 3 of the first_agent writing every 10s, and 1 of the another_example writing every minute. agents = [{name = "first_agent", count = 3, sampling_interval = "10s"}, {name = "another_example", sampling_interval = "1m"}] [[bucket_writers]] # the remaining 80% of the buckeets specified will write using these agents -percent = 0.8 +ratio = 0.8 # we'll only have a single agent of another_example for each database agents = [{name = "another_example", sampling_interval = "1s"}] diff --git a/iox_data_generator/schemas/storage_cardinality_example.toml b/iox_data_generator/schemas/storage_cardinality_example.toml index 5210c6efac..10041f5720 100644 --- a/iox_data_generator/schemas/storage_cardinality_example.toml +++ b/iox_data_generator/schemas/storage_cardinality_example.toml @@ -59,7 +59,7 @@ for_each = [ ] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "sender", sampling_interval = "10s"}] [[agents]] diff --git a/iox_data_generator/schemas/tracing-spec.toml b/iox_data_generator/schemas/tracing-spec.toml index 7b31dc59a7..37b9a9c506 100644 --- a/iox_data_generator/schemas/tracing-spec.toml +++ b/iox_data_generator/schemas/tracing-spec.toml @@ -31,5 +31,5 @@ name = "timing" f64_range = [0.0, 500.0] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "tracing_agent", sampling_interval = "1s"}] diff --git a/iox_data_generator/src/lib.rs b/iox_data_generator/src/lib.rs index 26cfb8582c..a813de36b6 100644 --- a/iox_data_generator/src/lib.rs +++ b/iox_data_generator/src/lib.rs @@ -237,7 +237,7 @@ name = "val" i64_range = [1, 1] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "10s"}] "#; let data_spec = DataSpec::from_str(toml).unwrap(); diff --git a/iox_data_generator/src/measurement.rs b/iox_data_generator/src/measurement.rs index bd1cf951b3..111c895106 100644 --- a/iox_data_generator/src/measurement.rs +++ b/iox_data_generator/src/measurement.rs @@ -548,7 +548,7 @@ mod test { i64_range = [3, 3] [[bucket_writers]] - percent = 1.0 + ratio = 1.0 agents = [{name = "foo", sampling_interval = "10s"}]"#, ) .unwrap(); @@ -611,7 +611,7 @@ mod test { i64_range = [3, 3] [[bucket_writers]] - percent = 1.0 + ratio = 1.0 agents = [{name = "foo", sampling_interval = "10s"}]"#, ) .unwrap(); diff --git a/iox_data_generator/src/specification.rs b/iox_data_generator/src/specification.rs index 46bda096c8..97ee2242ec 100644 --- a/iox_data_generator/src/specification.rs +++ b/iox_data_generator/src/specification.rs @@ -115,7 +115,7 @@ impl DataSpec { .collect::>>()?; let agents = Arc::new(agents); - let mut end = (buckets.len() as f64 * w.percent).ceil() as usize + start; + let mut end = (buckets.len() as f64 * w.ratio).ceil() as usize + start; if end > buckets.len() { end = buckets.len(); } @@ -235,9 +235,9 @@ pub struct TagSetsSpec { #[derive(Deserialize, Debug)] #[serde(deny_unknown_fields)] pub struct BucketWriterSpec { - /// The percentage of buckets from the provided list that should use these agents. The - /// percent should add up to 1.0 (100%). - pub percent: f64, + /// The ratio of buckets from the provided list that should use these agents. The + /// ratios of the collection of bucket writer specs should add up to 1.0. + pub ratio: f64, /// The agents that should be used to write to these databases. pub agents: Vec, } @@ -635,7 +635,7 @@ name = "host" template = "server" [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "10s"}] "#; let spec = DataSpec::from_str(toml).unwrap(); @@ -680,11 +680,11 @@ name = "val" i64_range = [0, 10] [[bucket_writers]] -percent = 0.6 +ratio = 0.6 agents = [{name = "foo", sampling_interval = "10s"}] [[bucket_writers]] -percent = 0.4 +ratio = 0.4 agents = [{name = "bar", sampling_interval = "1m", count = 3}] "#; let spec = DataSpec::from_str(toml).unwrap(); diff --git a/iox_data_generator/src/tag_set.rs b/iox_data_generator/src/tag_set.rs index b7f3a3cd40..c8db7ab3eb 100644 --- a/iox_data_generator/src/tag_set.rs +++ b/iox_data_generator/src/tag_set.rs @@ -494,7 +494,7 @@ name = "f1" i64_range = [0, 23] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "10s"}]"#; let spec = DataSpec::from_str(toml).unwrap(); @@ -542,7 +542,7 @@ name = "f1" i64_range = [0, 23] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "10s"}]"#; let spec = DataSpec::from_str(toml).unwrap(); @@ -611,7 +611,7 @@ name = "f1" i64_range = [0, 23] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "10s"}]"#; let spec = DataSpec::from_str(toml).unwrap(); diff --git a/iox_data_generator/src/write.rs b/iox_data_generator/src/write.rs index c111666937..8852baad33 100644 --- a/iox_data_generator/src/write.rs +++ b/iox_data_generator/src/write.rs @@ -343,7 +343,7 @@ name = "val" i64_range = [3,3] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "1s"}] "#; @@ -396,7 +396,7 @@ name = "val" i64_range = [2, 2] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", sampling_interval = "1s"}] "#; diff --git a/perf/battery-0/datagen.toml b/perf/battery-0/datagen.toml index 8513cecdd5..7026fcfada 100644 --- a/perf/battery-0/datagen.toml +++ b/perf/battery-0/datagen.toml @@ -14,5 +14,5 @@ name = "usage_user" f64_range = [0.0, 100.0] [[bucket_writers]] -percent = 1.0 +ratio = 1.0 agents = [{name = "foo", count = 3, sampling_interval = "10s"}]