Skip to content

Commit

Permalink
Implements default trait for new ValueConf
Browse files Browse the repository at this point in the history
  • Loading branch information
scottopell committed Sep 20, 2023
1 parent 0aafcb3 commit ef654df
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lading_payload/src/dogstatsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ fn contexts_maximum() -> u32 {
}

fn value_config() -> ValueConf {
ValueConf {
float_probability: 0.5, // 50%
range: ValueRange::Inclusive {
min: i64::MIN,
max: i64::MAX,
},
}
ValueConf::default()
}

// https://docs.datadoghq.com/developers/guide/what-best-practices-are-recommended-for-naming-metrics-and-tags/#rules-and-best-practices-for-naming-metrics
Expand Down Expand Up @@ -136,6 +130,18 @@ pub struct ValueConf {
range: ValueRange,
}

impl Default for ValueConf {
fn default() -> Self {
Self {
float_probability: 0.5, // 50%
range: ValueRange::Inclusive {
min: i64::MIN,
max: i64::MAX,
},
}
}
}

/// Configuration for the values range of a metric.
#[derive(Debug, Deserialize, Clone, PartialEq, Copy)]
#[serde(rename_all = "snake_case")]
Expand Down

0 comments on commit ef654df

Please sign in to comment.