Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.d/24532_vector_stopped_log_ordering.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fixed log message ordering on shutdown where `Vector has stopped.` was logged before components had finished draining, causing confusing output interleaved with `Waiting on running components` messages.

A new `VectorStoppping` event was added in the place of the `VectorStopped` event.

Check failure on line 3 in changelog.d/24532_vector_stopped_log_ordering.fix.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`Stoppping` is not a recognized word (unrecognized-spelling)
Comment thread
pront marked this conversation as resolved.

authors: tronboto
25 changes: 15 additions & 10 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ use crate::{
config::{self, ComponentConfig, ComponentType, Config, ConfigPath},
extra_context::ExtraContext,
heartbeat,
internal_events::{VectorConfigLoadError, VectorQuit, VectorStarted, VectorStopped},
internal_events::{
VectorConfigLoadError, VectorQuit, VectorStarted, VectorStopped, VectorStopping,
},
signal::{SignalHandler, SignalPair, SignalRx, SignalTo},
topology::{
ReloadOutcome, RunningTopology, SharedTopologyController, ShutdownErrorReceiver,
Expand Down Expand Up @@ -493,16 +495,19 @@ impl FinishedApplication {
}

async fn stop(topology_controller: TopologyController, mut signal_rx: SignalRx) -> ExitStatus {
emit!(VectorStopped);
Comment thread
pront marked this conversation as resolved.
emit!(VectorStopping);
tokio::select! {
_ = topology_controller.stop() => ExitStatus::from_raw({
#[cfg(windows)]
{
exitcode::OK as u32
}
#[cfg(unix)]
exitcode::OK
}), // Graceful shutdown finished
_ = topology_controller.stop() => {
emit!(VectorStopped);
ExitStatus::from_raw({
#[cfg(windows)]
{
exitcode::OK as u32
}
#[cfg(unix)]
exitcode::OK
})
}, // Graceful shutdown finished
_ = signal_rx.recv() => Self::quit(),
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/internal_events/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ impl InternalEvent for VectorReloaded<'_> {
}
}

#[derive(Debug, NamedInternalEvent)]
pub struct VectorStopping;

impl InternalEvent for VectorStopping {
fn emit(self) {
info!(
target: "vector",
message = "Vector is stopping.",
);
}
}

#[derive(Debug, NamedInternalEvent)]
pub struct VectorStopped;

Expand Down
Loading