-
Notifications
You must be signed in to change notification settings - Fork 25
feat: Add gzip compression turned on by default #84
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
Merged
+137
−6
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| hex/posthog: minor | ||
| --- | ||
|
|
||
| This is *technically* a breaking change because we're now always sending data gzip compressed and people might not want that, but this will not break anyone's code so we'll release it as a minor knowing that it's an improvement. It's always been possible to swap the client off, but we weren't documenting how to do that exactly - this is now solved too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
some SDKs provide a client config for that eg https://github.com/PostHog/posthog-js/blob/a3cc497d977298637155a2c15030f3fcfe1e613f/packages/types/src/posthog-config.ts#L1228-L1234
also remote config returns
supportedCompressionwhich then we know if the server supports gzip or notnot a blocker, as this is already the default behaviour for many SDKs, and PH Cloud supports gzip.
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.
Exposing that to the client is a bit complicated and very not-Elixir. The best way to do this in Elixir really is to let people override the client - like we explained in the README.
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.
what i meant is the posthog config client, something next to api_key and api_host, where compress_body is optiona and defaults to true
its a much better UX to expose a compress_body config rather than telling the user to replace the whole http client.
Simpleness wins here, not a blocker.
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.
We can absolutely do that in the future if we wanna reduce the number of times people need to redefine the client, but you can also look at the docs above and see that "replacing the client" is very easy in Elixir.
Also, I'm pretty sure Elixir-heavy companies will find replacing the client to be a much sounder approach than just throwing yet another new config - this also simplifies the whole implementation, there's less things for people to think about if they don't have the 200 options we have in posthog-js, for example.
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.
happy to disagree with what would be easier, a boolean vs replacing the client (I did see the docs).
obv 200 options bloats and isn't great either.
alright, PR is approved anyway so it was just a suggestion