Skip to content

Commit f0ff687

Browse files
fix: Move health_check span in health_checker loop inside the loop to end it after the check (#1454)
1 parent 3dd22a4 commit f0ff687

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

agent-control/src/health/health_checker.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,17 @@ where
291291
E: HealthEventPublisher,
292292
{
293293
let callback = move |stop_consumer: EventConsumer<CancellationMessage>| {
294-
let span = info_span!(
295-
"health_check",
296-
{ ID_ATTRIBUTE_NAME } = %agent_id
297-
);
298-
let _guard = span.enter();
299294
debug!("Starting to check health with the configured checker");
300295

301296
sleep(initial_delay.into());
302297

303298
loop {
299+
let span = info_span!(
300+
"health_check",
301+
{ ID_ATTRIBUTE_NAME } = %agent_id
302+
);
303+
let _guard = span.enter();
304+
304305
debug!("Checking health");
305306
let health = health_checker.check_health().unwrap_or_else(|err| {
306307
debug!(last_error = %err, "The configured health check failed");

0 commit comments

Comments
 (0)