Skip to content

Reduce tailwatcher argument#2832

Merged
ganmacs merged 12 commits into
fluent:masterfrom
ganmacs:reduce-Tailwatcher-argument
Feb 25, 2020
Merged

Reduce tailwatcher argument#2832
ganmacs merged 12 commits into
fluent:masterfrom
ganmacs:reduce-Tailwatcher-argument

Conversation

@ganmacs

@ganmacs ganmacs commented Feb 20, 2020

Copy link
Copy Markdown
Member

Which issue(s) this PR fixes:
no

What this PR does / why we need it:

Reduce TailWatcher's arguments. it's hard to maintain now.

Docs Changes:

no

Release Note:

no

Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
TailWatcher is not related to this

Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
and this log is no need to be put here

Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>

@cosmo0920 cosmo0920 left a comment

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.

Looks reasonable for me.

And I added a nitpicks for logging messages in #update_watcher.
Is it copy and paste mistake?

def update_watcher(path, pe)
log_msg = "detected rotation of #{path}"
log_msg << "; waiting #{@rotate_wait} seconds" # wait rotate_time if previous file exists

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.

Missing log.info here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch…thank you 🙏 9940869

Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Comment thread lib/fluent/plugin/in_tail.rb Outdated
def on_change(prev, cur)
@callback.call
rescue
# TODO log?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can remove too old comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed 269ea68

Comment thread lib/fluent/plugin/in_tail.rb Outdated
def update_watcher(path, pe)
log_msg = "detected rotation of #{path}"
log_msg << "; waiting #{@rotate_wait} seconds" # wait rotate_time if previous file exists
log.info(log_msg)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can combine 3 lines.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed 857d9cb

@update_watcher.call(@path, swap_state(@pe))
else
@io_handler = IOHandler.new(self, &method(:wrap_receive_lines))
@log.info "detected rotation of #{@path}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this line needed?

@ganmacs ganmacs Feb 21, 2020

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

L658 and L660 is invoked even if watcher_needs_update is false, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, I see.

Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
@ganmacs ganmacs self-assigned this Feb 21, 2020
@ganmacs ganmacs merged commit 2acf3f7 into fluent:master Feb 25, 2020
@ganmacs ganmacs deleted the reduce-Tailwatcher-argument branch February 25, 2020 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants