You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Ruby SDK sent batch payloads uncompressed, while other PostHog SDKs support request-body compression for ingestion uploads. This enables gzip compression by default for Ruby batch uploads, sets Content-Encoding: gzip, and preserves delivery by falling back to uncompressed JSON if local gzip compression fails before sending. Users can opt out with compress_request: false.
No breaking change or entry added to the changelog.
If releasing new changes
Ran pnpm changeset to generate a changeset file
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with pi. I checked the existing SDK gzip behavior for the expected header-based compression, then made Ruby batch uploads gzip by default. The implementation uses Ruby stdlib gzip support, sets Content-Encoding: gzip without adding a compression query parameter, and falls back to the original uncompressed body only for Zlib::Error compression failures so events are not dropped.
The stub debug log still references @path (the original constant path) after the refactor, so when compression is enabled the log will show /batch/ instead of the actual /batch/?compression=gzip path that would be used for a real request. request_path is already in scope and captures the correct value.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Addressed Greptile feedback in f40aedc: simplified compress_request option forwarding in Client/SendWorker, and updated the stub debug log to reference the computed request path.
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.
💡 Motivation and Context
Fixes #201.
The Ruby SDK sent batch payloads uncompressed, while other PostHog SDKs support request-body compression for ingestion uploads. This enables gzip compression by default for Ruby batch uploads, sets
Content-Encoding: gzip, and preserves delivery by falling back to uncompressed JSON if local gzip compression fails before sending. Users can opt out withcompress_request: false.💚 How did you test it?
bundle exec rspecbundle exec rubocop lib/posthog/client.rb lib/posthog/send_worker.rb lib/posthog/transport.rb spec/posthog/client_spec.rb spec/posthog/transport_spec.rbbundle exec rake public_api:check📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with pi. I checked the existing SDK gzip behavior for the expected header-based compression, then made Ruby batch uploads gzip by default. The implementation uses Ruby stdlib gzip support, sets
Content-Encoding: gzipwithout adding a compression query parameter, and falls back to the original uncompressed body only forZlib::Errorcompression failures so events are not dropped.