Skip to content

fix(config): allow deflate for OTLP HTTP exporters#5075

Open
officialasishkumar wants to merge 1 commit intoopen-telemetry:mainfrom
officialasishkumar:config-http-deflate
Open

fix(config): allow deflate for OTLP HTTP exporters#5075
officialasishkumar wants to merge 1 commit intoopen-telemetry:mainfrom
officialasishkumar:config-http-deflate

Conversation

@officialasishkumar
Copy link
Copy Markdown

Description

Fixes #5059

Map declarative OTLP compression values through a shared helper that recognizes Deflate when the target exporter enum supports it. This allows the tracer and meter OTLP HTTP exporters to accept compression: deflate without changing gRPC validation.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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.py

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

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.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +62 to +63
if value.lower() == "deflate" and hasattr(compression_enum, "Deflate"):
return compression_enum.Deflate # type: ignore[attr-defined]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

bug(config): _map_compression does not support deflate for HTTP exporters

1 participant