Skip to content

Declarative config max_request_size: 0 fails SDK creation instead of meaning no limit #8940

Closed

Description

@thswlsqls

Describe the bug
Setting max_request_size: 0 on an otlp_http or otlp_grpc exporter in declarative config makes SDK creation fail. The configuration schema says 0 means no limit.

Steps to reproduce
Declarative config:

tracer_provider:
  processors:
    - batch:
        exporter:
          otlp_http:
            max_request_size: 0

What did you expect to see?
The exporter is created with no request size limit. opentelemetry-configuration v1.2.0 schema/common.yaml defines max_request_size with minimum: 0 and says: "Value must be non-negative. A value of 0 indicates no limit (infinity) and is not recommended." timeout: 0 already works this way.

What did you see instead?
DeclarativeConfigException: Error configuring io.opentelemetry.sdk.trace.export.SpanExporter with name "otlp_http", caused by IllegalArgumentException: maxRequestBodySizeBytes must be positive. OtlpDeclarativeConfigUtil.configureOtlpExporterBuilder() passes 0 to setMaxRequestBodySize / setMaxRequestMessageSize, which only accept positive values. All six OTLP HTTP/gRPC span, metric, and log exporters are affected.

What version and what artifacts are you using?
Artifacts: opentelemetry-exporter-otlp, opentelemetry-sdk-extension-declarative-config
Version: main @ 387f5c5
How did you reference these artifacts? N/A

Environment
Compiler: Temurin 21
OS: N/A

Additional context
The option was wired in #8446. The schema meaning of 0 was agreed in open-telemetry/opentelemetry-configuration#700.

Activity

  1. psx95 commented on Oct 13, 2026

    @psx95
    Contributor

    I think this issue could be expanded to fix the general behavior of the SDK, instead of just fixing it at the declarative config level. I believe that the behavior when configuring SDK programmatically and via declarative config should be consistent.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions