Skip to content

Commit 5134f29

Browse files
committed
Always include at least one value in a DogStastD metric
This commit fixes a bug in the last release. We allowed for the creation of DogStatsD metrics that have no values associated with them with probability 1/33. We now require at least one value and do not adjust the maximum of 32. REF SMP-527 Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
1 parent 8db8624 commit 5134f29

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Disallow the creation of DogStatsD metrics with no values
810

911
## [0.15.1]
1012
### Added

src/payload/dogstatsd/metric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Generator<Metric> for MetricGenerator {
2727
let name = self.names.choose(&mut rng).unwrap().clone();
2828
let tags = choose_or_not(&mut rng, &self.tags);
2929
let sample_rate = rng.gen();
30-
let total_values = rng.gen_range(0..32);
30+
let total_values = rng.gen_range(1..32);
3131
let value: Vec<common::NumValue> =
3232
Standard.sample_iter(&mut rng).take(total_values).collect();
3333

0 commit comments

Comments
 (0)