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

Use ByteString instead of String for stats callback #159

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

phile314
Copy link
Contributor

@phile314 phile314 commented Nov 18, 2020

This avoids the round-trip via String if one wants to pass the statistics JSON to aeson for further parsing.

Note that aeson has no decoding function accepting String nor Text, but only accepts ByteStrings.

See also #158

Copy link
Contributor

@sir4ur0n sir4ur0n left a comment

Choose a reason for hiding this comment

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

I don't use this feature so I don't have any strong opinion, though I guess it make sense not to force String on users.

Maybe alternatively we could provide the data type of statistics to help users, but this would definitely be another PR 😄

src/Kafka/Callbacks.hs Outdated Show resolved Hide resolved
src/Kafka/Callbacks.hs Outdated Show resolved Hide resolved
This avoids the round-trip via String if one wants to pass the
statistics JSON to aeson for further parsing.
@phile314
Copy link
Contributor Author

I have applied your comments, thanks.

Regarding the statistics type, I think without the FromJSON instances they are not terribly useful. And if we want FromJSON instances, hw-kafka-client will incur a dependency on aeson. Not that I have a problem with that, but it will increase the dependency footprint of hw-kafka-client. Though granted, for production systems one is likely to depend on Aeson for other reasons anyway.

Copy link
Contributor

@sir4ur0n sir4ur0n left a comment

Choose a reason for hiding this comment

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

@AlexeyRaga I don't know if you also saw this PR, I'm tagging you just in case

@AlexeyRaga
Copy link
Member

LGTM, perhaps would require bumping a major version since switching to ByteString is a breaking change

@AlexeyRaga AlexeyRaga merged commit 3a3291c into haskell-works:master Dec 2, 2020
@phile314
Copy link
Contributor Author

phile314 commented Dec 3, 2020

I agree, bumping the major version is probably the right thing to do.

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