refactor: change percent to ratio in data generator bucket writers

pull/24376/head
Paul Dix 2021-12-08 10:29:35 -05:00
parent 31aa41e240
commit 2c8d17bea8
11 changed files with 23 additions and 23 deletions

View File

@ -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();

View File

@ -3,7 +3,7 @@
name = "cap_write"
[[bucket_writers]]
percent = 1.0
ratio = 1.0
agents = [{name = "telegraf", count = 3, sampling_interval = "10s"}]
[[agents]]

View File

@ -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"}]

View File

@ -59,7 +59,7 @@ for_each = [
]
[[bucket_writers]]
percent = 1.0
ratio = 1.0
agents = [{name = "sender", sampling_interval = "10s"}]
[[agents]]

View File

@ -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"}]

View File

@ -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();

View File

@ -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();

View File

@ -115,7 +115,7 @@ impl DataSpec {
.collect::<Result<Vec<_>>>()?;
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<AgentAssignmentSpec>,
}
@ -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();

View File

@ -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();

View File

@ -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"}]
"#;

View File

@ -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"}]