Skip to content

Enforce OTLP request size limits#8446

Open
ADITYA-CODE-SOURCE wants to merge 1 commit into
open-telemetry:mainfrom
ADITYA-CODE-SOURCE:issue-8444-otlp-message-limits
Open

Enforce OTLP request size limits#8446
ADITYA-CODE-SOURCE wants to merge 1 commit into
open-telemetry:mainfrom
ADITYA-CODE-SOURCE:issue-8444-otlp-message-limits

Conversation

@ADITYA-CODE-SOURCE
Copy link
Copy Markdown
Contributor

Fixes #8444.

Why

  • opentelemetry-proto#782 now recommends that OTLP exporters enforce configurable outbound request/message size limits.
  • OpenTelemetry Java already limits response body reads, but OTLP exporters did not enforce outbound request/message limits.

What

  • add configurable request/message size limits to OTLP HTTP and gRPC exporter builders with a default of 64 MiB
  • enforce the limit in the shared OTLP HTTP and gRPC exporter layers before dispatching requests
  • cover both known-size binary payloads and unknown-size payloads (for example OTLP HTTP JSON) by measuring when needed
  • add focused tests for over-limit failure behavior and builder configuration plumbing
  • update docs/apidiffs/current_vs_latest/opentelemetry-exporter-otlp.txt for the new public builder methods

Testing

I was not able to complete local Gradle verification on this Windows machine because Gradle / the Kotlin compiler daemon repeatedly failed to start due to paging-file / metaspace limits before compilation finished. The changes are pushed for CI verification.

@ADITYA-CODE-SOURCE ADITYA-CODE-SOURCE requested a review from a team as a code owner June 3, 2026 03:28
@otelbot otelbot Bot added the api-change Changes to public API surface area label Jun 3, 2026
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented Jun 3, 2026

⚠️ API changes detected — additional maintainer review required

@jack-berg @jkwatson

This PR modifies the public API surface area of the following module(s):

  • opentelemetry-exporter-otlp

Please review the changes in docs/apidiffs/current_vs_latest/ carefully before approving.

@ADITYA-CODE-SOURCE ADITYA-CODE-SOURCE force-pushed the issue-8444-otlp-message-limits branch from 280870d to 6720aae Compare June 3, 2026 03:30

private static final String DEFAULT_ENDPOINT = "http://localhost:4318/v1/traces";
private static final MemoryMode DEFAULT_MEMORY_MODE = MemoryMode.REUSABLE_DATA;
private static final long DEFAULT_MAX_REQUEST_BODY_SIZE = 64 * 1024L * 1024L;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: can we add _BYTES to the end of this constant

/**
* Sets the maximum OTLP HTTP request body size in bytes. If unset, defaults to 64 MiB.
*/
public OtlpHttpLogRecordExporterBuilder setMaxRequestBodySize(long maxRequestBodySize) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: can we add Bytes to the end of the parameter name (here and the other public API surfaces)

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

Labels

api-change Changes to public API surface area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OTLP exporters should enforce message limits

2 participants