Skip to content

Commit

Permalink
make trace-agent payloads generate in a reasonable amount of time
Browse files Browse the repository at this point in the history
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
  • Loading branch information
blt committed Apr 12, 2023
1 parent e59c777 commit b9f0e11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.14.0-rc5]
## Changed
- Adjusted trace-agent msgpack payload generation to be much faster at the cost
of some memory during the generation process.

## [0.14.0-rc4]
## Changed
- Adjusted internal TCP generator metrics to be registered where possible.
Expand Down
5 changes: 2 additions & 3 deletions src/payload/trace_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl crate::payload::Serialize for TraceAgent {
// obeyed, as an example. We could then have a 'shrink' or 'expand'
// method on that tree to avoid this loop.
let mut members: Vec<Vec<Span>> = vec![];
let mut remaining = 1_000;
let mut remaining = 10_000;
while remaining > 0 {
let total = rng.gen_range(0..=remaining);
let spans: Vec<Span> = Standard.sample_iter(&mut rng).take(total).collect();
Expand All @@ -198,8 +198,7 @@ impl crate::payload::Serialize for TraceAgent {
break;
}

let total = rng.gen_range(0..=100);
members.push(Standard.sample_iter(&mut rng).take(total).collect());
members.push(Standard.sample_iter(&mut rng).take(5_000).collect());
}

// Search for an encoding that's just right.
Expand Down

0 comments on commit b9f0e11

Please sign in to comment.