Repository navigation
feat(otlp-exporter-base): support gzip compression in browser OTLP HTTP exporters - #7166
Open
YangJonghun wants to merge 10 commits into
Open
YangJonghun wants to merge 10 commits into
YangJonghun wants to merge 10 commits into
Conversation
transport - gzip the body with `CompressionStream`, read with a stream reader so that exports started on page unload still reach `fetch` - charge the keepalive budget with the compressed size - the deprecated `createOtlpSendBeaconExportDelegate()` now applies the `compression` option it is given
…LP HTTP exporters - move `compression` and `CompressionAlgorithm` to the shared legacy configuration - pass `compression` through `convertLegacyBrowserHttpOptions` - document browser behavior and CORS requirements in the READMEs
Pull request dashboard statusWaiting on reviewers · refreshed 2026-10-23 21:26 UTC Review the latest changes. Also blocked by: Merge conflicts. Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7166 +/- ##
==========================================
- Coverage 95.07% 95.01% -0.07%
==========================================
Files 384 387 +3
Lines 13548 13619 +71
Branches 3127 3140 +13
==========================================
+ Hits 12881 12940 +59
- Misses 667 679 +12
🚀 New features to boost your workflow:
|
- expect lowercase header names from `Headers` - run the page unload regression test with gzip - import `createOtlpSendBeaconExportDelegate` from the public entry
compression - keep comments within 80 columns - fix a typo in the README
- Next.js fails Edge Runtime builds on a bare `CompressionStream` reference
CompressionAlgorithm - drop the duplicate enum from the base configuration, so the enum exported from the root matches the option type - remove the unused import from the Node.js configuration
| // would not survive. | ||
| const suppressedContext = suppressTracing(context.active()); | ||
|
|
||
| // Compressed first so that the keepalive budget counts the bytes sent. |
Contributor
There was a problem hiding this comment.
Could we make the timeout cover compression too? Right now, gzip runs before the timer starts, so slow or stalled compression can exceed the timeout or hang flushing.
- Start the abort timer before compressing, so compression time counts toward the timeout - Pass the timeout signal to the compression pipe, so a stalled compressor fails the export instead of hanging
YangJonghun
force-pushed
the
feat/browser-otlp-gzip
branch
from
October 11, 2026 13:59
d75205c to
1ec50b4
Compare
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Which problem is this PR solving?
Browser OTLP HTTP exporters ignore the
compressionoption that the OTLP exporter spec requires.Refs #5686
Short description of the changes
CompressionStreamAPI and charges the keepalive budget with the compressed size, so more telemetry fits into requests that survive page unload.gzip/none, or runtimes that connot gzip (older browsers, some edge runtimes), fall back to uncompressed requests with a warning.compressionthrough: it moves fromOTLPExporterNodeConfigBasetoOTLPExporterConfigBase.Notes:
[otlp-exporter-base] come up with plan for implementing the
compressionoption for browser exporters #5686 suggested not extending the legacy config. The exporters' published types still describe the Node.js implementation, so browser TS users can already passcompression(it was silently ignored), Node.js has the option, and the new interface has not landed yet. The transport change can be split out from exposing the option if preferred.Measured with Playwright 1.63 (Chromium 153, Firefox 155, WebKit 26.6) on synthetic OTLP trace bodies:
A 100-span JSON batch exported from
pagehide/visibilitychangereached the collector 0/10 times uncompressed in WebKit (over the keepalive budget) and 10/10 gzipped. Chromium and Firefox delivered both.Cross-origin collectors must allow the
Content-Encodingheader.Type of change
How Has This Been Tested?
pagehide/visibilitychangewere deliveredChecklist: