Skip to content

Commit 8a1a52c

Browse files
ignore empty samples in sampling thread
1 parent 85c6487 commit 8a1a52c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

profiling/src/profiling/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ impl TimeCollector {
346346
profiles: &mut HashMap<ProfileIndex, InternalProfile>,
347347
started_at: &WallTime,
348348
) {
349+
if message.key.sample_types.len() == 0 {
350+
// profiling disabled, this should not happen!
351+
warn!("You spot a bug in the profiler, please be so kind and report this do Datadog.");
352+
return;
353+
}
354+
349355
let profile: &mut InternalProfile = if let Some(value) = profiles.get_mut(&message.key) {
350356
value
351357
} else {
@@ -572,12 +578,6 @@ impl Profiler {
572578
}
573579

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

0 commit comments

Comments
 (0)