Skip to content

Conversation

@esensar
Copy link
Contributor

@esensar esensar commented Oct 27, 2025

Summary

On configuration reload, Vector starts spamming debug logs:

vector::utilization: Couldn't send utilization start wait message.

This is caused by building the config diff, which just creates a new utilization emitter, registers all the changed components to that new emitter and then just drops it at the end, because one already exists in the running topology. This changes it so that the existing emitter is reused on reloads, ensuring that reloaded components still send their utilization messages.

How did you test this PR?

Ran vector with any configuration, made changes to the configuration and forced a reload (using SIGHUP, but config watching would work too). Before this fix the debug spam was visible for changed components, indicating that they didn't have receiver to send utilization messages to. After this fix, the spam was gone.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

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 here.

Sponsored by Quad9

On configuration reload, Vector starts spamming debug logs:
```
vector::utilization: Couldn't send utilization start wait message.
```

This is caused by building the config diff, which just creates a new utilization emitter, registers
all the changed components to that new emitter and then just drops it at the end, because one
already exists in the running topology. This changes it so that the existing emitter is reused on
reloads, ensuring that reloaded components still send their utilization messages.

Related: vectordotdev#24060 (comment)
@esensar esensar requested a review from a team as a code owner October 27, 2025 10:06
@github-actions github-actions bot added the domain: topology Anything related to Vector's topology code label Oct 27, 2025
@esensar esensar changed the title fix: prevent utilization metric loss on configuration reload fix(metrics): prevent utilization metric loss on configuration reload Oct 27, 2025
Comment on lines +201 to +209
impl Clone for UtilizationEmitter {
/// Cloning for UtilizationEmitter skipps the timer received. Only one instance is expected to
/// hold it and that instance should be running the `run_utilization` task.
fn clone(&self) -> Self {
Self {
timers: self.timers.clone(),
timer_rx: None,
timer_tx: self.timer_tx.clone(),
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have opted for Clone implementation which skips timer_rx for the cloned version.

I have also considered an approach with 2 separate components - the emitter, which would run the task and "registry" which would just be used to add components. While the second approach sounds better to me, it would require more significant changes to the codebase, but without any further benefit (I would still need to have a lock on timers map, since that part would be shared).

@pront pront added the domain: reload Anything related to reloading Vector (updating configuration) label Oct 27, 2025
@pront
Copy link
Member

pront commented Oct 27, 2025

Hi @esensar, I will prioritize reviewing this. FYI, I will push a small PR to convert the builder to actually use a builder pattern and will add a few related unit tests (you are welcome to add more). Just trying to clean up and future proof this part of the codebase.

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

Labels

domain: reload Anything related to reloading Vector (updating configuration) domain: topology Anything related to Vector's topology code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants