Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust dogstatsd configuration to allow for constant values #702

Merged
merged 5 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion lading/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lading"
version = "0.18.1"
version = "0.19.0-rc1"
authors = ["Brian L. Troutwine <[email protected]>", "George Hahn <[email protected]"]
edition = "2021"
license = "MIT"
Expand Down
74 changes: 24 additions & 50 deletions lading/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,38 +139,25 @@ impl Cache {
&block_chunks,
),
payload::Config::DogStatsD(payload::dogstatsd::Config {
contexts_minimum,
contexts_maximum,
name_length_minimum,
name_length_maximum,
tag_key_length_minimum,
tag_key_length_maximum,
tag_value_length_minimum,
tag_value_length_maximum,
tags_per_msg_minimum,
tags_per_msg_maximum,
contexts,
name_length,
tag_key_length,
tag_value_length,
tags_per_msg,
// TODO -- Validate user input for multivalue_pack_probability.
multivalue_pack_probability,
multivalue_count_minimum,
multivalue_count_maximum,
multivalue_count,
kind_weights,
metric_weights,
value,
}) => {
let context_range = *contexts_minimum..*contexts_maximum;
let tags_per_msg_range = *tags_per_msg_minimum..*tags_per_msg_maximum;
let name_length_range = *name_length_minimum..*name_length_maximum;
let tag_key_length_range = *tag_key_length_minimum..*tag_key_length_maximum;
let tag_value_length_range = *tag_value_length_minimum..*tag_value_length_maximum;
let multivalue_count_range = *multivalue_count_minimum..*multivalue_count_maximum;

let serializer = payload::DogStatsD::new(
context_range,
name_length_range,
tag_key_length_range,
tag_value_length_range,
tags_per_msg_range,
multivalue_count_range,
*contexts,
*name_length,
*tag_key_length,
*tag_value_length,
*tags_per_msg,
*multivalue_count,
*multivalue_pack_probability,
*kind_weights,
*metric_weights,
Expand Down Expand Up @@ -272,38 +259,25 @@ fn stream_inner(
stream_block_inner(&mut rng, total_bytes, &pyld, block_chunks, &snd)
}
payload::Config::DogStatsD(payload::dogstatsd::Config {
contexts_minimum,
contexts_maximum,
name_length_minimum,
name_length_maximum,
tag_key_length_minimum,
tag_key_length_maximum,
tag_value_length_minimum,
tag_value_length_maximum,
tags_per_msg_minimum,
tags_per_msg_maximum,
contexts,
name_length,
tag_key_length,
tag_value_length,
tags_per_msg,
// TODO -- Validate user input for multivalue_pack_probability.
multivalue_pack_probability,
multivalue_count_minimum,
multivalue_count_maximum,
multivalue_count,
kind_weights,
metric_weights,
value,
}) => {
let context_range = *contexts_minimum..*contexts_maximum;
let tags_per_msg_range = *tags_per_msg_minimum..*tags_per_msg_maximum;
let name_length_range = *name_length_minimum..*name_length_maximum;
let tag_key_length_range = *tag_key_length_minimum..*tag_key_length_maximum;
let tag_value_length_range = *tag_value_length_minimum..*tag_value_length_maximum;
let multivalue_count_range = *multivalue_count_minimum..*multivalue_count_maximum;

let pyld = payload::DogStatsD::new(
context_range,
name_length_range,
tag_key_length_range,
tag_value_length_range,
tags_per_msg_range,
multivalue_count_range,
*contexts,
*name_length,
*tag_key_length,
*tag_value_length,
*tags_per_msg,
*multivalue_count,
*multivalue_pack_probability,
*kind_weights,
*metric_weights,
Expand Down
1 change: 1 addition & 0 deletions lading_payload/proptest-regressions/common/strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
cc af61ca38851fafeed4d96b45d1d1aca38e2ab8a1489b51ccae6e0e178640e569 # shrinks to seed = 0, max_bytes = 2, of_size_bytes = 0, alphabet = "a🈐aAaA0𐦀A𐠊A\u{e0100}"
cc e4740adac235cc14baefdb17ab4e7b825a9100e1e140031f72c0eb66783a6bdc # shrinks to seed = 49880598398515969, max_bytes = 3977, of_size_bytes = 0, alphabet = "ힰA\u{11c92}® "
cc 7d00cd4ac860c10fd2a903761b1540638fb95f92bfd352cbf952ec53760bedb4 # shrinks to seed = 170628173656970550, max_bytes = 7313, of_size_bytes = 0, alphabet = " 𒒀"
cc c3bbc5eb64e117c599cfe76df189ae8ec8238c47e76a942970505e5da6dcee1b # shrinks to seed = 0, max_bytes = 43894, of_size_bytes = 43894
7 changes: 7 additions & 0 deletions lading_payload/proptest-regressions/dogstatsd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc 97158e48115dce6b53c08d3f3744ebd92cb711273b19aee225daa774f71f6e23 # shrinks to seed = 0, max_bytes = 0
5 changes: 3 additions & 2 deletions lading_payload/src/common/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ mod test {
}
}

// Ensure that of_size only returns None if the request is larger than the interior size.
// Ensure that of_size only returns None if the request is greater than or
// equal to the interior size.
proptest! {
#[test]
fn return_none_condition(seed: u64, max_bytes: u16, of_size_bytes: u16) {
Expand All @@ -138,7 +139,7 @@ mod test {

let pool = Pool::with_size_and_alphabet(&mut rng, max_bytes, ALPHANUM);
if pool.of_size(&mut rng, of_size_bytes).is_none() {
assert!(of_size_bytes > max_bytes);
assert!(of_size_bytes >= max_bytes);
}
}
}
Expand Down
Loading
Loading