Skip to content

enhancement: add an explicit log line for graceful component shutdown - #25974

Open
clementd-dd wants to merge 1 commit into
vectordotdev:masterfrom
clementd-dd:clementd-dd/add-an-explicit-log-line-for-graceful-component-shutdown
Open

enhancement: add an explicit log line for graceful component shutdown#25974
clementd-dd wants to merge 1 commit into
vectordotdev:masterfrom
clementd-dd:clementd-dd/add-an-explicit-log-line-for-graceful-component-shutdown

Conversation

@clementd-dd

Copy link
Copy Markdown
Contributor

Summary

Add an explicit log line when components shut down gracefully during the shutdown sequence.

The shutdown sequence logs are the same whether the components where gracefully shutdown or not. Checking for the absence of the "Failed to gracefully shut down in time. Killing components." can match both a clean shutdown, or an OOM or a sigkill. Explicitly logging a graceful shutdown lets us work around this.

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@clementd-dd
clementd-dd requested a review from a team as a code owner July 30, 2026 10:03
@github-actions github-actions Bot added the domain: topology Anything related to Vector's topology code label Jul 30, 2026
@datadog-vectordotdev

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26f75090ee

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/topology/running.rs
// Finishes once all tasks have shutdown.
let success = futures::future::join_all(wait_handles).map(|_| ());
let success = futures::future::join_all(wait_handles).map(|_| {
info!("All components shut down gracefully.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't mark crashed tasks as graceful shutdown

When shutdown is triggered by a component error or panic, the handles in wait_handles still resolve because their results are mapped to () before join_all, so this branch logs All components shut down gracefully. even though handle_errors has already reported a component abort. That makes the new log unreliable as a clean-shutdown marker in the graceful-crash path; only emit it after successful task results, or change the wording to indicate that all handles merely finished.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems legit, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the property that I care about is making sure that all buffers were drained before exiting. I’m not entirely sure what "clean-shutdown" means here exactly. Maybe the wording should explicitly mention buffer draining?

Comment thread changelog.d/log_components_graceful_shutdown.enhancement.md
Comment thread src/topology/running.rs
@clementd-dd
clementd-dd force-pushed the clementd-dd/add-an-explicit-log-line-for-graceful-component-shutdown branch from 26f7509 to 90db551 Compare July 30, 2026 11:32
The shutdown sequence logs are the same whether the components where gracefully shutdown or not. Checking for the absence of the "Failed to gracefully shut down in time. Killing components." can match both a clean shutdown, or an OOM or a sigkill. Explicitly logging a graceful shutdown lets us work around this.
@clementd-dd
clementd-dd force-pushed the clementd-dd/add-an-explicit-log-line-for-graceful-component-shutdown branch from 90db551 to d8a3d05 Compare July 30, 2026 11:44
Comment thread src/topology/running.rs

if all_done {
info!("Shutdown reporter exiting: all components shut down.");
info!("All components shut down gracefully.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the log line above says about the same - do we need another one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this allows to have a single message for graceful shutdown in both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: topology Anything related to Vector's topology code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants