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: sentry add gzipped with compression #954

Merged

Conversation

Strive-Sun
Copy link
Contributor

Hi, I noticed that the http request from sentry is missing content-encoding, so I added this parameter. DeflateInit2 references header file in crashpad, and I am not sure if this reference is appropriate. if further modifications are needed, please let me know at any time. Thx in advance.

Copy link
Member

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

What is missing here is building / linking the zlib code

src/sentry_transport.h Outdated Show resolved Hide resolved
src/sentry_transport.c Outdated Show resolved Hide resolved
src/sentry_transport.c Outdated Show resolved Hide resolved
@Strive-Sun Strive-Sun force-pushed the feat/sentry_add_gzipped_with_compression branch from 0804baf to a0e3698 Compare March 4, 2024 11:35
@Strive-Sun Strive-Sun changed the title feat: sentry add gizziped with compression feat: sentry add gzipped with compression Mar 4, 2024
src/sentry_transport.c Outdated Show resolved Hide resolved
@Strive-Sun
Copy link
Contributor Author

Strive-Sun commented Mar 5, 2024

There is a new question, if diable SENTRY_TRANSPORT_COMPRESSION, sentry_transport.c will complie failed on due to missing zlib.lib. Is there a macro that does not compile sentry_gzipped_with_compression function and zlib.h.

@supervacuus
Copy link
Collaborator

supervacuus commented Mar 5, 2024

There is a new question, if diable SENTRY_TRANSPORT_COMPRESSION, sentry_transport. c will complie failed on due to missing zlib.lib. Is there a macro that does not compile sentry_gzipped_with_compression function and zlib.h.

It would be best if you created a compile definition in the CMakeLists.txt and #ifdef that definition in the transport module. Specifically, you must include the zlib header and your entire compression code only when that definition exists. Otherwise, users without zlib developer packages will have failed builds.

Given that sentry__gzipped_with_compression is only called from within sentry_transport.c, exposing it in a header is unnecessary. Please,

  • remove the header declaration,
  • remove the sentry__ prefix from the function name,
  • move the function before its first use and
  • make the function static

Thx!

@Strive-Sun
Copy link
Contributor Author

There is a new question, if diable SENTRY_TRANSPORT_COMPRESSION, sentry_transport. c will complie failed on due to missing zlib.lib. Is there a macro that does not compile sentry_gzipped_with_compression function and zlib.h.

It would be best if you created a compile definition in the CMakeLists.txt and #ifdef that definition in the transport module. Specifically, you must include the zlib header and your entire compression code only when that definition exists. Otherwise, users without zlib developer packages will have failed builds.

Given that sentry__gzipped_with_compression is only called from within sentry_transport.c, exposing it in a header is unnecessary. Please,

  • remove the header declaration,
  • remove the sentry__ prefix from the function name,
  • move the function before its first use and
  • make the function static

Thx!

Great idea, please help me review again. Thx a lot.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

Attention: Patch coverage is 28.57143% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 82.68%. Comparing base (fda2a37) to head (42ebfb5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #954      +/-   ##
==========================================
+ Coverage   82.64%   82.68%   +0.04%     
==========================================
  Files          53       53              
  Lines        7444     7450       +6     
  Branches     1198     1199       +1     
==========================================
+ Hits         6152     6160       +8     
+ Misses       1182     1179       -3     
- Partials      110      111       +1     

@supervacuus
Copy link
Collaborator

This is a quick heads-up, @Strive-Sun: the error in the MinGW build is unrelated to this PR (the fact that it is zlib is a coincidence). I'll find out what is going on and continue my review tomorrow. Thx.

@supervacuus
Copy link
Collaborator

The CMake failure to find zlib in the MinGW build is due to a change in the GHA runner image. In previous builds, zlib was found in the StrawberryPerl installation 😅 .

I will provide a fix for this, which the open PRs can rebase on, next week.

Copy link
Collaborator

@supervacuus supervacuus left a comment

Choose a reason for hiding this comment

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

A few minor changes are still necessary. Thanks for your work so far.

Integration tests that validate the setting on supported platforms would be great, but I can add those after merging this PR.

CMakeLists.txt Outdated Show resolved Hide resolved
src/sentry_transport.c Outdated Show resolved Hide resolved
src/sentry_transport.c Outdated Show resolved Hide resolved
src/sentry_transport.c Outdated Show resolved Hide resolved
src/sentry_transport.c Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
@Strive-Sun Strive-Sun force-pushed the feat/sentry_add_gzipped_with_compression branch from 435b091 to 3154cb2 Compare March 15, 2024 10:39
@Strive-Sun
Copy link
Contributor Author

Hi, I have rebased #964. Please help review again, thx a lot

Copy link
Collaborator

@supervacuus supervacuus left a comment

Choose a reason for hiding this comment

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

We can soon merge this. Only minor additions, please

  • add a change-log
  • wrap find_package() in the crashpad build
  • apply the suggestions with MAX_HTTP_HEADERS (or tell me why that is a bad idea 😸)
  • please rebase once more because yet another GHA runner image update introduced an ASAN issue (fix: failing clang-asan/llvm-cov tests #965).

Thx!

I will take care of an integration test in a follow-up PR, because it might also require a few changes to the CI config.

src/sentry_transport.c Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
@Strive-Sun Strive-Sun force-pushed the feat/sentry_add_gzipped_with_compression branch from 3154cb2 to 282100f Compare March 21, 2024 10:27
...we require 3.16.4 for almost 4 years.

Android is set to 3.10, but doesn't support either curl or crashpad.
@Strive-Sun Strive-Sun force-pushed the feat/sentry_add_gzipped_with_compression branch from 696d918 to 42ebfb5 Compare March 22, 2024 07:01
@supervacuus
Copy link
Collaborator

Thanks a lot for your contribution @Strive-Sun!

@supervacuus supervacuus merged commit 9f9436a into getsentry:master Mar 22, 2024
19 checks passed
@Strive-Sun
Copy link
Contributor Author

Strive-Sun commented Mar 23, 2024

Thanks a lot for your contribution @Strive-Sun!

My pleasure. Without your suggestions and help, I wouldn't have been able to complete it smoothly.😄

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.

None yet

3 participants