-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix(codecs): Ensure that batches using newline delimited framing end in a newline #21097
base: master
Are you sure you want to change the base?
Conversation
…in a newline Fixes: #21086 Signed-off-by: Jesse Szwedko <[email protected]>
Datadog ReportBranch report: ❌ 6 Failed (0 Known Flaky), 334 Passed, 0 Skipped, 4m 18.73s Total Time ❌ Failed Tests (6)
|
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.
It does feel a bit strange that this is only coming up now 🤔
Agreed. I think most consumers would handle newline or EOF as the delimiter though so needing the trailing newline may not be a common need. I think it is more "correct" though and less likely to cause weird issues if EOFs aren't handled as delimiters. |
Signed-off-by: Jesse Szwedko <[email protected]>
@@ -93,12 +93,14 @@ impl Encoder<Framer> { | |||
} | |||
|
|||
/// Get the suffix that encloses a batch of events. | |||
pub const fn batch_suffix(&self) -> &[u8] { | |||
match (&self.framer, &self.serializer) { | |||
pub const fn batch_suffix(&self, empty: bool) -> &[u8] { |
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.
I think ideally the encoding, for newline delimited framing, would append the newline while encoding each element (including the last) rather than adding it when finalizing the batch, but that was a bit more refactoring than I was willing to take on at the moment.
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.
LGTM
Fixes: #21086
Signed-off-by: Jesse Szwedko [email protected]