Skip to content

[OTLP] Add support for GZip compression#7055

Open
martincostello wants to merge 8 commits intoopen-telemetry:mainfrom
martincostello:gh-3961
Open

[OTLP] Add support for GZip compression#7055
martincostello wants to merge 8 commits intoopen-telemetry:mainfrom
martincostello:gh-3961

Conversation

@martincostello
Copy link
Copy Markdown
Member

@martincostello martincostello commented Apr 10, 2026

Fixes #3961

Changes

Add support for GZip compression to the OTLP exporter.

Continues the work started in #6494.

Once released, should also update the compliance matrix.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions Bot added the pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package label Apr 10, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.16%. Comparing base (7dd46f4) to head (3b9d5c8).
⚠️ Report is 14 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7055      +/-   ##
==========================================
+ Coverage   89.09%   89.16%   +0.07%     
==========================================
  Files         271      271              
  Lines       13065    13120      +55     
==========================================
+ Hits        11640    11699      +59     
+ Misses       1425     1421       -4     
Flag Coverage Δ
unittests-Project-Experimental 88.87% <100.00%> (-0.21%) ⬇️
unittests-Project-Stable 88.90% <100.00%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ol/Implementation/ExportClient/OtlpExportClient.cs 100.00% <100.00%> (ø)
...mplementation/ExportClient/OtlpGrpcExportClient.cs 78.94% <100.00%> (+4.21%) ⬆️
...mplementation/ExportClient/OtlpHttpExportClient.cs 100.00% <100.00%> (ø)
...orter.OpenTelemetryProtocol/OtlpExporterOptions.cs 99.37% <100.00%> (+0.09%) ⬆️

... and 6 files with indirect coverage changes

@martincostello martincostello marked this pull request as ready for review April 10, 2026 14:34
@martincostello martincostello requested a review from a team as a code owner April 10, 2026 14:34
Copilot AI review requested due to automatic review settings April 10, 2026 14:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds configurable gzip compression support to the OTLP exporter to align with the OTLP exporter specification (including env var configuration) and validates behavior via new/updated unit tests.

Changes:

  • Introduces OtlpExportCompression and OtlpExporterOptions.Compression, with spec env var support (OTEL_EXPORTER_OTLP*_COMPRESSION).
  • Implements gzip request compression for OTLP over HTTP and gRPC export clients.
  • Adds/updates unit tests and updates changelog + public API tracking files.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpSpecConfigDefinitionTests.cs Extends spec config test data and assertions to include compression env vars.
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpHttpExportClientTests.cs Adds HTTP export tests validating payload and headers with/without gzip.
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpGrpcExportClientTests.cs Adds gRPC export tests validating compressed framing and decompression behavior.
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpExporterOptionsTests.cs Extends options/config tests to cover compression env var parsing and invalid values.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs Adds Compression option, parsing helper, and spec-env-var application.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExportCompression.cs New public enum defining supported compression modes.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/IOtlpExporterOptions.cs Adds Compression to internal options contract.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpSpecConfigDefinitions.cs Adds spec env var constants for compression across signals.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpHttpExportClient.cs Implements gzip compression for HTTP request content.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcExportClient.cs Implements gzip compression for gRPC framing + request header.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpExportClient.cs Centralizes content creation via overridable method; wires CompressionEnabled.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md Documents new opt-in gzip compression configuration.
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/.publicApi/Stable/PublicAPI.Unshipped.txt Tracks new public API surface (OtlpExportCompression, OtlpExporterOptions.Compression).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs Outdated
Comment thread src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs Outdated
martincostello and others added 4 commits April 13, 2026 15:26
Add support for GZip compression to the OTLP exporter.

Picks up from open-telemetry#6494.

Resolves open-telemetry#3961.

Co-Authored-By: Hannah Haering <157852144+hannahhaering@users.noreply.github.com>
- Avoid allocating a buffer for every write of compressed gRPC data.
- Simplify `IsTransientNetworkError()`.
Add coverage for different ways to specify the compression value.
- Ensure only one `grpc-encoding` header.
- Remove redundant null checks.
Remove trailing spaces.
Add missing blank line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Exporter.OpenTelemetryProtocol] Support for Compression

2 participants