Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(watcher): add support for poll watcher #21258

Closed

Conversation

amribm
Copy link

@amribm amribm commented Sep 10, 2024

Change for adding poll watcher for vector config change

Closes #21111

@bits-bot
Copy link

bits-bot commented Sep 10, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
10 out of 12 committers have signed the CLA.

✅ dependabot[bot]
✅ pront
✅ jszwedko
✅ amribm
✅ maxboone
✅ ArunPiduguDD
✅ leshow
✅ hamirmahal
✅ esensar
✅ jorgehermo9
❌ Ameer Ibrahim
❌ nsollecito


Ameer Ibrahim seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -19,21 +19,60 @@ const CONFIG_WATCH_DELAY: std::time::Duration = std::time::Duration::from_secs(1

const RETRY_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);

pub enum ConfigWatcher {
Copy link
Contributor

Choose a reason for hiding this comment

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

I found confusing that this PR includes two ConfigWatcher struct with the same name but different meanings

Copy link
Author

Choose a reason for hiding this comment

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

yeah , one i used enum for clap options and another one in watcher.

if u can suggest me a different name. i will change

// Ok((watcher, receiver))
// }

fn add_paths(watcher: &mut Box<dyn Watcher>, config_paths: &[PathBuf]) -> Result<(), Error> {
Copy link
Contributor

@jorgehermo9 jorgehermo9 Sep 10, 2024

Choose a reason for hiding this comment

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

I think you could use

Suggested change
fn add_paths(watcher: &mut Box<dyn Watcher>, config_paths: &[PathBuf]) -> Result<(), Error> {
fn add_paths<T: Watcher>(watcher: &mut T, config_paths: &[PathBuf]) -> Result<(), Error> {

Or it does not work with the boxed dyn Watcher?

@jorgehermo9
Copy link
Contributor

jorgehermo9 commented Sep 10, 2024

Just as a recommendation, if your PR description contains the text Closes #<issue-number>, Github will link this PR to the issue and close the issue when the PR is closed

src/cli.rs Outdated

pub fn watcher_config(method: ConfigWatcher, interval: NonZeroU64) -> watcher::ConfigWatcher {
match method {
ConfigWatcher::Inotify => watcher::ConfigWatcher::RecommendedWatcher,
Copy link
Contributor

Choose a reason for hiding this comment

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

the ConfigWatcher::Inotify variant does not always set the inotify watcher, it sets the RecommendedWatcher, which would be inotify on supported platforms and polling in others.

I think we should rename those variants (or at least, the Inotify one), as it is a bit misleading for the user (also, the default value in the args should be change accordingly)

@amribm amribm marked this pull request as ready for review September 12, 2024 09:48
@amribm amribm requested a review from a team as a code owner September 12, 2024 09:48
@amribm amribm force-pushed the poll_watcher_for_config_watch branch 3 times, most recently from 53b02e2 to fb6766e Compare September 12, 2024 10:31
@amribm amribm requested review from a team as code owners September 12, 2024 10:31
@github-actions github-actions bot added domain: topology Anything related to Vector's topology code domain: transforms Anything related to Vector's transform components domain: sinks Anything related to the Vector's sinks domain: ci Anything related to Vector's CI environment domain: releasing Anything related to releasing Vector domain: external docs Anything related to Vector's external, public documentation domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: vdev Anything related to the vdev tooling labels Sep 12, 2024
@amribm amribm closed this Sep 12, 2024
@amribm amribm force-pushed the poll_watcher_for_config_watch branch from fb6766e to 2e702b3 Compare September 12, 2024 10:32
@amribm amribm deleted the poll_watcher_for_config_watch branch September 12, 2024 10:34
@jszwedko
Copy link
Member

Did you mean to close this @amribm ?

@amribm
Copy link
Author

amribm commented Sep 13, 2024

i had some commits without my github email and CLA is not passing. in effort to ammend the username in commit . i messed up the tree. when i force pushed this PR got closed.

Though i already created new one. #21290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: ci Anything related to Vector's CI environment domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: external docs Anything related to Vector's external, public documentation domain: releasing Anything related to releasing Vector domain: sinks Anything related to the Vector's sinks domain: topology Anything related to Vector's topology code domain: transforms Anything related to Vector's transform components domain: vdev Anything related to the vdev tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Polling based extension of the —watch-config flag that doesn’t rely on inotify/SIGHUP
4 participants