-
Notifications
You must be signed in to change notification settings - Fork 847
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
Fix gzip compression for OTLP HTTP exporter #3046
Conversation
@dyladan Can you take a look or forward to the appropriate person for review? |
I understand the changes, I'm just trying to understand why it was introduced in the first place. Looks like it was a performance optimization to avoid creating a new gzip for each request, but since requests don't happen often (by computer standards) I think it was an unnecessary micro-optimization. |
experimental/packages/otlp-exporter-base/test/node/util.test.ts
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #3046 +/- ##
==========================================
+ Coverage 92.64% 93.10% +0.46%
==========================================
Files 187 188 +1
Lines 6198 6224 +26
Branches 1314 1316 +2
==========================================
+ Hits 5742 5795 +53
+ Misses 456 429 -27
|
Please fix linting errors and add your fix to the changelog at |
@dyladan Ok, should be good to go. And yes, I think this was a case of an unnecessary micro-optimization in the original PR. |
I've been looking into this a little more and came across this https://nodejs.org/api/zlib.html#threadpool-usage-and-performance-considerations I think this may be why the original author was avoiding creating many gzip objects which can affect not just the performance of the gzip but the whole application as it reduces the available thread pool. But in the examples on that page a new gzip object is created for each request so I think this is probably fine. |
I agree - it would be one thing if we were creating these gzip streams rapidly and concurrently, but in this situation, we only do it when sending http requests to the collector, which happen at most every |
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.
Looks good! Thank you for taking the time to fix this. 🙂
Which problem is this PR solving?
Fixes #3040
Currently if you configure your OTLP HTTP exporter to use gzip compression, it will succeed on the first request and fail on subsequent requests. This PR makes it more reliable.
Short description of the changes
Instead of sharing the same gzip stream across multiple requests, create a new one for each request. This bug was introduced in #2581
Type of change
Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
I have tested this manually in my application by running several requests through the OTLP exporter to a local lightstep dev collector.
In addition, I wrote a failing unit test and then show that the code change fixes it.
Without the code change, the newly written unit test fails with the following:
Checklist: