Skip to content

Compress event payload by default#1314

Merged
st0012 merged 2 commits intomasterfrom
gzip-event-payload
Mar 5, 2021
Merged

Compress event payload by default#1314
st0012 merged 2 commits intomasterfrom
gzip-event-payload

Conversation

@st0012
Copy link
Copy Markdown
Contributor

@st0012 st0012 commented Mar 4, 2021

Rules:

  • If config.transport.encoding == "gzip" and the event envelope's size is larger than 30kb, the envelope will be compressed.
  • If config.transport.encoding == "gzip" but the event envelope's size is smaller than 30kb, the envelope won't be compressed.
  • If config.transport.encoding != "gzip", the event won't be compressed regardless how but it is.

@st0012 st0012 added this to the 4.3.0 milestone Mar 4, 2021
@st0012 st0012 self-assigned this Mar 4, 2021
@st0012 st0012 force-pushed the gzip-event-payload branch from 3e5579e to 3f9d1ae Compare March 5, 2021 08:26
@st0012 st0012 requested review from HazAT and jan-auer March 5, 2021 08:44
class HTTPTransport < Transport
CONTENT_TYPE = 'application/json'
GZIP_ENCODING = "gzip"
GZIP_THRESHOLD = 1024 * 30
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the "usual" size and throughput of Ruby events that you've seen so far? A threshold of somewhere around 32kB seems reasonable intuitively, I'd just love to confirm.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In Rails apps, I think it's generally over 40kb because of the framework's stacktrace. But it could be quite small on non-Ruby apps, like 1x kb.

@st0012 st0012 force-pushed the gzip-event-payload branch from 3f9d1ae to 9ad9732 Compare March 5, 2021 09:10
Rules:
- If `config.transport.encoding == "gzip"` and the event envelope's
  size is larger than 30kb, the envelope will be compressed.
- If `config.transport.encoding == "gzip"` but the event envelope's
  size is smaller than 30kb, the envelope won't be compressed.
- If `config.transport.encoding != "gzip"`, the event won't be
  compressed regardless how but it is.
@st0012 st0012 force-pushed the gzip-event-payload branch from 9ad9732 to 998b591 Compare March 5, 2021 09:38
@st0012 st0012 requested a review from jan-auer March 5, 2021 09:40
Copy link
Copy Markdown
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Deferring final review to @HazAT.

The implementation sets Content-Encoding: <empty> if should_compress? returns false. I believe that this will work, but please make sure to test this against Sentry SaaS once.

@st0012
Copy link
Copy Markdown
Contributor Author

st0012 commented Mar 5, 2021

@jan-auer thanks for the review. I've tested it and it works as expected 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants