Skip to content

in_tcp: skip emitting an empty event stream - #5608

Open
lbarrosby wants to merge 1 commit into
fluent:masterfrom
lbarrosby:in-tcp-skip-empty-stream
Open

lbarrosby wants to merge 1 commit into
fluent:masterfrom
lbarrosby:in-tcp-skip-empty-stream

Conversation

@lbarrosby

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #5602

What this PR does / why we need it:

Without <extract>, in_tcp called router.emit_stream(@tag, es) after every read, also when the read did not complete any message and es was empty. A long message that arrives in many reads made the router, the filters and the output run once per read with an empty stream, and each call counted in the output's emit_count. This emits only when es has events, which is what the <extract> path already does (it emits per record).

Test: a new case in the delimiter sub test case (both batch_emit and single_emit) sends hel, waits, then sends lo\n, and checks that one record arrives in one emit. On master the batch case fails with emit_count 2 instead of 1. All 28 tests in test/plugin/test_in_tcp.rb pass.

Docs Changes:
None.

Release Note:
in_tcp: skip emitting an empty event stream when a read has no complete message.

Without <extract>, in_tcp called router.emit_stream after every read,
also when the read did not complete a message. A long message that
arrives in many reads made the router, filters and output run once per
read with an empty stream, and inflated the output's emit_count. Emit
only when the stream has events, like the <extract> path already does.

Fixes fluent#5602

Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
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.

in_tcp: skip emitting an empty event stream when a read has no complete message

1 participant