Skip to content

opentelemetry-exporter-otlp-proto-http: add max request size limit to OTLP HTTP exporters#5369

Open
Krishnachaitanyakc wants to merge 1 commit into
open-telemetry:mainfrom
Krishnachaitanyakc:feat/otlp-max-request-size
Open

opentelemetry-exporter-otlp-proto-http: add max request size limit to OTLP HTTP exporters#5369
Krishnachaitanyakc wants to merge 1 commit into
open-telemetry:mainfrom
Krishnachaitanyakc:feat/otlp-max-request-size

Conversation

@Krishnachaitanyakc

Copy link
Copy Markdown
Contributor

Description

Implements the client side of opentelemetry-proto#782: the OTLP/HTTP exporters drop a serialized request larger than a configurable limit (measured before compression) instead of sending it. Adds a max_request_size argument and OTEL_EXPORTER_OTLP_MAX_REQUEST_SIZE (plus per-signal _TRACES_/_METRICS_/_LOGS_ overrides) to the trace, log, and metric HTTP exporters. Default 64 MiB (the spec's RECOMMENDED value, enabled); 0 (or any non-positive value) disables. Mirrors opentelemetry-go#8157.

Behavior-change note: with the default-on limit, batches whose serialized size exceeds 64 MiB (previously sent) are now dropped client-side and recorded as a failed export. gRPC exporters are out of scope here and will follow separately.

Related to #4533 (this is the proactive request-size half; reactive 413 splitting is tracked in #5032).

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit tests across all three HTTP exporters: oversized request dropped before Session.post (asserted not called); 0/negative disables; env precedence (constructor > per-signal > generic > default) including malformed/empty fallback; failed-export metric records error.type.
  • Discriminating "before compression" test: a payload whose gzip size is below the limit but uncompressed size exceeds it is still dropped.
  • End-to-end test against a real local HTTP server: a normal payload is received; an oversized one never reaches the server.

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

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

@Krishnachaitanyakc Krishnachaitanyakc requested a review from a team as a code owner June 29, 2026 16:50
Comment thread opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py Outdated
@github-project-automation github-project-automation Bot moved this to Reviewed PRs that need fixes in Python PR digest Jun 30, 2026
… OTLP HTTP exporters

Implements the client side of opentelemetry-proto#782: serialized OTLP/HTTP requests larger than a configurable limit are dropped before sending, measured before compression. Adds a max_request_size keyword-only argument to the trace, log, and metric HTTP exporters. Default 64 MiB; 0 (or any non-positive value) disables. Mirrors opentelemetry-go#8157. Refs open-telemetry#4533.
@Krishnachaitanyakc Krishnachaitanyakc force-pushed the feat/otlp-max-request-size branch from d487296 to 7b30681 Compare June 30, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

2 participants