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

fix-#181: Send the ack token as String #182

Merged
merged 2 commits into from
Feb 11, 2021
Merged

Conversation

elruwen
Copy link
Contributor

@elruwen elruwen commented Feb 4, 2021

Hi!

As discussed in the ticket, here the fix. I fixed small issues I found around the places I changed, too.

Cheers
Ruwen

PS: I struggled a bit with the code style, I hope I didn't miss anything.

Copy link
Owner

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

Thanks @elruwen ! Overall LGTM, but I left a few comments. Can you take a look at them?

@@ -71,12 +66,15 @@ public void ingest(String tag, ByteBuffer dataBuffer)
ByteBuffer headerBuffer = ByteBuffer.wrap(header.toByteArray());

if (config.isAckResponseMode()) {
byte[] uuidBytes = UUID.randomUUID().toString().getBytes(CHARSET);
ByteBuffer optionBuffer = ByteBuffer.wrap(objectMapper.writeValueAsBytes(new RequestOption(dataLength, uuidBytes)));
// The spec says to encode a 128 bit value as base64, but fluent-bit currently
Copy link
Owner

Choose a reason for hiding this comment

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

Which document does it mean by The spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

ByteBuffer optionBuffer = ByteBuffer.wrap(objectMapper.writeValueAsBytes(new RequestOption(dataLength, uuidBytes)));
// The spec says to encode a 128 bit value as base64, but fluent-bit currently
// uses a 32 char long hex string, so we do the same for now.
String token = UUID.randomUUID().toString().replace("-", "");
Copy link
Owner

Choose a reason for hiding this comment

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

ACK token formats in Fluentd and Fluent Bit are different and there is no validation of it. How about simply passing a UUID hex string as is without removing hyphen? If Fluentd and Fluent Bit implement a validation of ACK token in the future, it would be time to change this format in Fluency as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. I still think it is better to comply with the spec straight away, but I am also fine with going ahead like this for now.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks!
Let's follow the spec later after Fluentd and Fluent bit use a consistent format.

@komamitsu komamitsu merged commit 4f61a5c into komamitsu:master Feb 11, 2021
@komamitsu komamitsu mentioned this pull request Feb 11, 2021
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.

None yet

2 participants