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

Add flush timeout setting to filebeat registrar #5146

Merged
merged 1 commit into from
Sep 11, 2017

Conversation

urso
Copy link

@urso urso commented Sep 11, 2017

No description provided.

@urso urso added Filebeat Filebeat review needs_backport PR is waiting to be backported to other branches. labels Sep 11, 2017
Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Can you add a CHANGELOG entry?

@@ -21,6 +21,7 @@ const (
type Config struct {
Prospectors []*common.Config `config:"prospectors"`
RegistryFile string `config:"registry_file"`
RegistryFlush time.Duration `config:"registry_flush"`
Copy link
Member

Choose a reason for hiding this comment

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

Would prefer registry.flush and registry.file but too late to change I think.

@@ -34,12 +38,13 @@ var (
registryWrites = monitoring.NewInt(nil, "registrar.writes")
)

func New(registryFile string, out successLogger) (*Registrar, error) {
func New(registryFile string, flushTimeout time.Duration, out successLogger) (*Registrar, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we call the config also flush_timeout? Would make it more explicit.

Copy link
Author

@urso urso Sep 11, 2017

Choose a reason for hiding this comment

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

you mean filebeat.registry_flush_timeout? Well, actually it's more like a 'delay' setting...

@@ -198,6 +212,17 @@ func (r *Registrar) Stop() {
r.wg.Wait()
}

func (r *Registrar) flushRegistry() {
if err := r.writeRegistry(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a check here that if bufferedStateUpdates==0 it just returns? Like this flushTimeout could be set very low and still not have frequent writes in case there are no updates.

Copy link
Author

Choose a reason for hiding this comment

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

The timer is only started after an event has been added.

@urso urso force-pushed the filebeat/registry-flush-timeout branch from 6b53f28 to 3dc174b Compare September 11, 2017 15:31
@ruflin ruflin merged commit 0d89cc7 into elastic:master Sep 11, 2017
@urso urso removed the needs_backport PR is waiting to be backported to other branches. label Sep 12, 2017
urso pushed a commit to urso/beats that referenced this pull request Sep 12, 2017
andrewkroh pushed a commit that referenced this pull request Sep 12, 2017
@urso urso deleted the filebeat/registry-flush-timeout branch February 19, 2019 18:32
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants