-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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(config): Allow reloading on URL config change #15388
Conversation
This introduces a new config-url-watch-interval option, which when set will, at each interval, check the Last-Modified header of the file to determine if telegraf should reload. If the header is not available then the watcher is disabled for the file. fixes: influxdata#8730
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I've once concern about removing the warning if we cannot watch a file...
cmd/telegraf/telegraf.go
Outdated
} else { | ||
log.Printf("W! Cannot watch config %s: %s", fConfig, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep this warning for local files? I'm not sure if there is a sensible case where you can read the file but not stat it, but if there is, I would like to inform the user that we are actually not watching a file he expects us to watch...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! I've added a check, let me know if that is what you had in mind.
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Thanks @powersj!
How does this new function work? Putting "configURLWatchInterval: 1m " under agent or is this already explained somewhere? |
It's a CLI option |
Summary
This introduces a new config-url-watch-interval option, which when set will, at each interval, check the Last-Modified header of the file to determine if telegraf should reload.
If the header is not available then the watcher is disabled for the file.
Checklist
Related issues
fixes: #8730