From f0f62e41ffa2d4d70eb3cf4e3b58eca0667f54f6 Mon Sep 17 00:00:00 2001 From: tronboto <142882846+tronboto@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:31:43 +0100 Subject: [PATCH 1/5] move VectorStopped event --- src/app.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app.rs b/src/app.rs index 6f30f85de1d20..77019af5779d7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -493,16 +493,18 @@ impl FinishedApplication { } async fn stop(topology_controller: TopologyController, mut signal_rx: SignalRx) -> ExitStatus { - emit!(VectorStopped); 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(), } } From 92210f82ebbc61a4ee749d2d5620bf893791a68c Mon Sep 17 00:00:00 2001 From: tronboto <142882846+tronboto@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:54:41 +0100 Subject: [PATCH 2/5] add changelog --- changelog.d/24532_vector_stopped_log_ordering.fix.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/24532_vector_stopped_log_ordering.fix.md diff --git a/changelog.d/24532_vector_stopped_log_ordering.fix.md b/changelog.d/24532_vector_stopped_log_ordering.fix.md new file mode 100644 index 0000000000000..fbed3539f5e7c --- /dev/null +++ b/changelog.d/24532_vector_stopped_log_ordering.fix.md @@ -0,0 +1,3 @@ +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. From 54f5a27a8be67076bb0676cf2248ce17b38e17c7 Mon Sep 17 00:00:00 2001 From: tronboto <142882846+tronboto@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:12:10 +0100 Subject: [PATCH 3/5] Add VectorStopping event --- src/app.rs | 5 ++++- src/internal_events/process.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 77019af5779d7..904d42be11968 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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, @@ -493,6 +495,7 @@ impl FinishedApplication { } async fn stop(topology_controller: TopologyController, mut signal_rx: SignalRx) -> ExitStatus { + emit!(VectorStopping); tokio::select! { _ = topology_controller.stop() => { emit!(VectorStopped); diff --git a/src/internal_events/process.rs b/src/internal_events/process.rs index cc3609737aea9..987724c2da18d 100644 --- a/src/internal_events/process.rs +++ b/src/internal_events/process.rs @@ -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; From 2e6eab89581dc4952b37347c6e0460950c3ba3fa Mon Sep 17 00:00:00 2001 From: Pavlos Rontidis Date: Wed, 8 Apr 2026 16:05:42 -0400 Subject: [PATCH 4/5] Update changelog.d/24532_vector_stopped_log_ordering.fix.md --- changelog.d/24532_vector_stopped_log_ordering.fix.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog.d/24532_vector_stopped_log_ordering.fix.md b/changelog.d/24532_vector_stopped_log_ordering.fix.md index fbed3539f5e7c..58cc018e9b06c 100644 --- a/changelog.d/24532_vector_stopped_log_ordering.fix.md +++ b/changelog.d/24532_vector_stopped_log_ordering.fix.md @@ -1,3 +1,3 @@ -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. +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. From ad50572f1097331c0194959204d01f10b9f96b69 Mon Sep 17 00:00:00 2001 From: Pavlos Rontidis Date: Wed, 8 Apr 2026 16:07:13 -0400 Subject: [PATCH 5/5] Apply suggestion from @pront --- changelog.d/24532_vector_stopped_log_ordering.fix.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.d/24532_vector_stopped_log_ordering.fix.md b/changelog.d/24532_vector_stopped_log_ordering.fix.md index 58cc018e9b06c..45f1a82eea06f 100644 --- a/changelog.d/24532_vector_stopped_log_ordering.fix.md +++ b/changelog.d/24532_vector_stopped_log_ordering.fix.md @@ -1,3 +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. + +authors: tronboto