Skip to content

Commit

Permalink
Add session_id to crucible logs (#1009)
Browse files Browse the repository at this point in the history
Add a slog field called session_id and put the unique session_id
in that field.  This should allow better reading of logs when a
single propolis starts multiple upstairs, all sharing the same log
file.

The incorrect session_id was also printed and this was fixed.
  • Loading branch information
leftwo authored Oct 19, 2023
1 parent cad0779 commit da534e7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions upstairs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5358,7 +5358,6 @@ impl Upstairs {
});

let uuid = opt.id;
info!(log, "Crucible stats registered with UUID: {}", uuid);
let stats = UpStatOuter {
up_stat_wrap: Arc::new(std::sync::Mutex::new(UpCountStat::new(
uuid,
Expand All @@ -5371,11 +5370,15 @@ impl Upstairs {
};

let session_id = Uuid::new_v4();
let log = log.new(o!("session_id" => session_id.to_string()));
info!(log, "Crucible {} has session id: {}", uuid, session_id);
info!(log, "Upstairs opts: {}", opt);

info!(log, "Crucible stats registered with UUID: {}", uuid);
Arc::new(Upstairs {
active: Mutex::new(UpstairsState::default()),
uuid,
session_id: Uuid::new_v4(),
session_id,
generation: AtomicU64::new(gen),
guest,
downstairs: Mutex::new(Downstairs::new(log.clone(), ds_target)),
Expand Down Expand Up @@ -10282,7 +10285,6 @@ pub async fn up_main(
"Upstairs <-> Downstairs Message Version: {}", CRUCIBLE_MESSAGE_VERSION
);

info!(log, "Upstairs opts: {}", opt);
if let Some(rd) = region_def {
info!(log, "Using region definition {:?}", rd);
}
Expand Down

0 comments on commit da534e7

Please sign in to comment.