Repository navigation
Fix --otlp-exporter-compression none being ignored; store compression as a plain CompressionEncoding - #375
Merged
Conversation
OTLPExporterBaseArgs::try_into_exporter_config passed
`self.compression.into()` to with_compression_encoding(), which goes
through the blanket `From<T> for Option<T>` and turns
CompressionEncoding::None into Some(CompressionEncoding::None). The
request builder only checks `compression.is_some()`, so "none" (and the
per-signal --otlp-exporter-{traces,metrics,logs}-compression none)
still gzip-compressed every request and sent grpc-encoding/
Content-Encoding: gzip. Verified at a mock sink: 62/62 requests arrived
gzip-encoded with --otlp-exporter-compression none.
Map CompressionEncoding::None to no compression and add a test.
Benchmark (rotel-bench, Intel N95, 5 runs per variant, ABBA, mean ±
stddev), --otlp-exporter-compression none (what the rotel-otel-wrapper
load-test setup passes):
traces 50k spans/s, 2 cores CPU/span 7.33±0.04 -> 5.60±0.02 %/10k (-23.6%)
RSS 35.2 -> 33.8 MiB (-3.8%)
traces max, 1 core, 1000/req 277.2k±0.1k -> 434.6k±3.7k spans/s (+56.8%)
CPU/span -50.9%, p50 -26%, p99 -31%, RSS -27%
Wire bytes per span 19.7 -> 148.6 (uncompressed, as requested).
Default (gzip) configuration unchanged (traces-otlp/traces-max within
±0.4%, same wire bytes).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the previous workaround (mapping CompressionEncoding::None to
Option::None in OTLPExporterBaseArgs) with a simpler model: the OTLP
exporter config and RequestBuilderConfig now hold a plain
CompressionEncoding (default Gzip) instead of Option<CompressionEncoding>.
The original bug came from the Option: `self.compression.into()` turned
CompressionEncoding::None into Some(CompressionEncoding::None), and the
request builder only checked `compression.is_some()`, so "none" still
sent gzip bodies and grpc-encoding/Content-Encoding: gzip headers. The
gRPC/HTTP header and body-encoding checks now compare against
CompressionEncoding::Gzip explicitly, and the CLI value is passed
straight through to with_compression_encoding().
Per-signal --otlp-exporter-{traces,metrics,logs}-compression flags stay
Option (unset = inherit the base setting) and resolve to a plain
CompressionEncoding in build_*_config.
Tests: CLI none/gzip pass-through, per-signal override/inherit, and
gRPC + HTTP request headers and bodies (uncompressed frame/body for
None, gzip flag/magic for Gzip).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
--otlp-exporter-compression nonehad no effect. The OTLP exporter always gzipped request bodies and sentgrpc-encoding: gziporContent-Encoding: gzip.The exporter config stored compression as
Option<CompressionEncoding>, but the CLI value is the enumCompressionEncoding { Gzip, None }..into()convertedCompressionEncoding::NoneintoSome(CompressionEncoding::None), and the request path only checkedcompression.is_some(), so "none" still enabled gzip.Fix
CompressionEncoding(defaultGzip) instead of anOption.is_some()checks for the gRPC header, the HTTP header and body encoding are now explicit checks forCompressionEncoding::Gzip.with_compression_encoding.--otlp-exporter-{traces,metrics,logs}-compression) stayOption, where unset means "inherit the base setting."CompressionEncodingnow derivesPartialEq.Kafka, ClickHouse and Parquet already use plain enums, so they don't have this bug.
Breaking change
OTLPExporterConfig::with_compression_encodingnow takesCompressionEncodinginstead ofOption<CompressionEncoding>. External callers passingSome(x)should passx, and callers passingNoneshould passCompressionEncoding::None.Testing
noneproduces no compression and no gzip headers, andgzipproduces both, over gRPC and HTTP.cargo fmtis clean, andcargo testpasses.cargo clippy --all-targetsadds no new warnings. It already fails onmainbecause of an existing benchconfig_builderarity error.compression nonenow uses about 51% less CPU per span than the old gzip behavior.