Skip to content

Commit e829350

Browse files
authored
Merge pull request #1118 from rust-lang/more-tracking
Log for happy path tracking too
2 parents 7d9f2e2 + 75b9198 commit e829350

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

compiler/base/orchestrator/src/coordinator.rs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use tokio::{
2525
};
2626
use tokio_stream::wrappers::ReceiverStream;
2727
use tokio_util::{io::SyncIoBridge, sync::CancellationToken};
28-
use tracing::{error, info_span, instrument, trace, trace_span, warn, Instrument};
28+
use tracing::{error, info, info_span, instrument, trace, trace_span, warn, Instrument};
2929

3030
use crate::{
3131
bincode_input_closed,
@@ -2540,14 +2540,7 @@ pub struct TerminateContainer(Option<(String, Command)>);
25402540

25412541
impl TerminateContainer {
25422542
pub fn new(name: String, command: Command) -> Self {
2543-
let was_inserted = TRACKED_CONTAINERS
2544-
.lock()
2545-
.unwrap_or_else(|e| e.into_inner())
2546-
.insert(name.clone().into());
2547-
2548-
if !was_inserted {
2549-
error!(%name, "This container was already tracked; duplicates are bad logic");
2550-
}
2543+
Self::start_tracking(&name);
25512544

25522545
Self(Some((name, command)))
25532546
}
@@ -2571,13 +2564,31 @@ impl TerminateContainer {
25712564
Ok(())
25722565
}
25732566

2567+
#[instrument]
2568+
fn start_tracking(name: &str) {
2569+
let was_inserted = TRACKED_CONTAINERS
2570+
.lock()
2571+
.unwrap_or_else(|e| e.into_inner())
2572+
.insert(name.into());
2573+
2574+
if was_inserted {
2575+
info!(%name, "Started tracking container");
2576+
} else {
2577+
error!(%name, "Started tracking container, but it was already tracked");
2578+
}
2579+
}
2580+
2581+
#[instrument]
25742582
fn stop_tracking(name: &str) {
25752583
let was_tracked = TRACKED_CONTAINERS
25762584
.lock()
25772585
.unwrap_or_else(|e| e.into_inner())
25782586
.remove(name);
2579-
if !was_tracked {
2580-
error!(%name, "Container was not in the tracking set");
2587+
2588+
if was_tracked {
2589+
info!(%name, "Stopped tracking container");
2590+
} else {
2591+
error!(%name, "Stopped tracking container, but it was not in the tracking set");
25812592
}
25822593
}
25832594

0 commit comments

Comments
 (0)