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

feat: default to gzip compression instead of base64 #1355

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

frankh
Copy link
Contributor

@frankh frankh commented Aug 13, 2024

Changes

it's weird that we do our first requests before the decide response with base64 "compression", as

  1. we've supported gzip for literally years, so there's basically zero risk of somehow hitting an endpoint that doesn't support it
  2. base64 is not compression, it increases the payload size compared to if we did nothing at all
  3. rust capture does not support base64

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

it's weird that we do our first requests before the decide response with base64
"compression", as

1. we've supported gzip for literally years, so there's basically zero risk of somehow hitting
   an endpoint that doesn't support it
2. base64 is not compression, it increases the payload size compared to if we did nothing at all
3. rust capture does not support base64
@frankh frankh requested a review from benjackwhite August 13, 2024 12:44
Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Aug 13, 2024 1:22pm

Copy link

github-actions bot commented Aug 13, 2024

Size Change: 0 B

Total Size: 1.17 MB

ℹ️ View Unchanged
Filename Size
dist/array.full.js 333 kB
dist/array.js 154 kB
dist/exception-autocapture.js 10.4 kB
dist/main.js 155 kB
dist/module.js 154 kB
dist/recorder-v2.js 110 kB
dist/recorder.js 110 kB
dist/surveys-preview.js 59.8 kB
dist/surveys.js 66 kB
dist/tracing-headers.js 8.26 kB
dist/web-vitals.js 5.79 kB

compressed-size-action

Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Will be interesting if no tests fail...

@frankh
Copy link
Contributor Author

frankh commented Aug 13, 2024

had to fix the mock parsing but looks good now

@webjunkie
Copy link

Curious: What is the reason we don't use headers/http level compression?

@benjackwhite benjackwhite added the bump patch Bump patch version when this PR gets merged label Aug 14, 2024
@benjackwhite
Copy link
Collaborator

Curious: What is the reason we don't use headers/http level compression?

You can't for requests. (You can't know what the server accepts before sending the request). Thats why you tell the server what you accept with headers like accept-encoding

@benjackwhite benjackwhite merged commit a84dfe5 into main Aug 14, 2024
12 checks passed
@benjackwhite benjackwhite deleted the frank/default-gzip branch August 14, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants