fix(config): allow deflate for OTLP HTTP exporters#5075
fix(config): allow deflate for OTLP HTTP exporters#5075officialasishkumar wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
Map declarative OTLP compression values through a shared helper that recognizes Deflate when the exporter enum supports it, while leaving gRPC validation unchanged. Add regression coverage for the shared mapping helper plus tracer and meter provider HTTP exporter construction.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80ca78e192
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if value.lower() == "deflate" and hasattr(compression_enum, "Deflate"): | ||
| return compression_enum.Deflate # type: ignore[attr-defined] |
There was a problem hiding this comment.
Restrict deflate mapping to OTLP HTTP exporters
The shared mapper now returns Deflate for any enum that exposes that member, and both gRPC exporter builders (_create_otlp_grpc_span_exporter and _create_otlp_grpc_metric_exporter) call this helper, so declarative otlp_grpc.compression: deflate is now accepted. That changes prior validation behavior and creates a mismatch with the gRPC exporter’s own env parsing (environ_to_compression only accepts gzip/none), so users can get different accepted values depending on configuration path.
Useful? React with 👍 / 👎.
Description
Fixes #5059
Map declarative OTLP compression values through a shared helper that recognizes
Deflatewhen the target exporter enum supports it. This allows the tracer and meter OTLP HTTP exporters to acceptcompression: deflatewithout changing gRPC validation.Type of change
How Has This Been Tested?
/tmp/opentelemetry-python/.venv-codex/bin/python -m pytest opentelemetry-sdk/tests/_configuration/test_common.py opentelemetry-sdk/tests/_configuration/test_tracer_provider.py opentelemetry-sdk/tests/_configuration/test_meter_provider.py/tmp/opentelemetry-python/.venv-codex/bin/python -m ruff check opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_common.py opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_tracer_provider.py opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_meter_provider.py opentelemetry-sdk/tests/_configuration/test_common.py opentelemetry-sdk/tests/_configuration/test_tracer_provider.py opentelemetry-sdk/tests/_configuration/test_meter_provider.pyDoes This PR Require a Contrib Repo Change?
Checklist: