Skip to content

Commit

Permalink
ignore empty samples in sampling thread
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Dec 21, 2023
1 parent 85c6487 commit 8a1a52c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions profiling/src/profiling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ impl TimeCollector {
profiles: &mut HashMap<ProfileIndex, InternalProfile>,
started_at: &WallTime,
) {
if message.key.sample_types.len() == 0 {
// profiling disabled, this should not happen!
warn!("You spot a bug in the profiler, please be so kind and report this do Datadog.");
return;
}

let profile: &mut InternalProfile = if let Some(value) = profiles.get_mut(&message.key) {
value
} else {
Expand Down Expand Up @@ -572,12 +578,6 @@ impl Profiler {
}

pub fn send_sample(&self, message: SampleMessage) -> Result<(), TrySendError<ProfilerMessage>> {
if message.key.sample_types.len() == 0 {
// profiling disabled, this should not happen!
warn!("You spot a bug in the profiler, please be so kind and report this do Datadog.");
// this return is technically not correct :-(
return Err(TrySendError::Disconnected(ProfilerMessage::Sample(message)));
}
self.message_sender
.try_send(ProfilerMessage::Sample(message))
}
Expand Down

0 comments on commit 8a1a52c

Please sign in to comment.