Skip to content

opentelemetry-configuration: treat timeout of 0 as infinite - #5806

Open
herin049 wants to merge 3 commits into
open-telemetry:mainfrom
herin049:opentelemetry-python-decl-config-zero-timeout
Open

herin049 wants to merge 3 commits into
open-telemetry:mainfrom
herin049:opentelemetry-python-decl-config-zero-timeout

Conversation

@herin049

@herin049 herin049 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

In the declarative configuration schema, a timeout of 0 on an OTLP exporter or a periodic metric reader means "no limit". Before this change, 0 was passed through literally, so every export got a zero second deadline and failed right away.

Type of change

Please delete options that are not relevant.

  • 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

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • I am a human and not a bot
  • I have run tox -e precommit
  • I have run tox -e typecheck
  • I have run the relevant tests and linting tox environments
  • This requires the following PR in contrib:

@herin049
herin049 requested a review from a team as a code owner October 22, 2026 00:47
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on maintainers · refreshed 2026-10-28 22:28 UTC

Resolve merge conflicts, then merge when ready.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Copilot AI left a comment

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.

🟢 Approval recommended

Static review supports consistent timeout handling across configuration and transports, with focused regression coverage and no unresolved blocking issues.

No open issues 🎉

What changed in this PR

This PR aligns declarative configuration with the schema’s “no limit” semantics for zero timeouts, preventing immediate export failures.

Changes:

  • Convert zero timeouts to infinity for OTLP exporters and periodic metric readers.
  • Translate infinite timeouts to None at HTTP and gRPC transport boundaries.
  • Add regression coverage and a changelog entry.
File Description
opentelemetry-configuration/​tests/​test_tracer_provider.py Test zero-timeout HTTP span exporter configuration.
opentelemetry-configuration/​tests/​test_meter_provider.py Test zero-timeout metric exporters and periodic readers.
opentelemetry-configuration/​tests/​test_logger_provider.py Test zero-timeout HTTP and gRPC log exporters.
opentelemetry-configuration/​tests/​test_common.py Test shared timeout conversion.
opentelemetry-configuration/​src/​opentelemetry/​configuration/​_tracer_provider.py Apply shared timeout conversion to span exporters.
opentelemetry-configuration/​src/​opentelemetry/​configuration/​_meter_provider.py Handle unlimited exporter and periodic reader timeouts.
opentelemetry-configuration/​src/​opentelemetry/​configuration/​_logger_provider.py Apply shared timeout conversion to log exporters.
opentelemetry-configuration/​src/​opentelemetry/​configuration/​_common.py Centralize timeout conversion and zero handling.
exporter/​opentelemetry-exporter-otlp-proto-grpc/​tests/​test_otlp_exporter_mixin.py Verify infinite timeouts disable gRPC deadlines.
exporter/​opentelemetry-exporter-otlp-proto-grpc/​src/​opentelemetry/​exporter/​otlp/​proto/​grpc/​exporter.py Translate infinite deadlines to None.
exporter/​opentelemetry-exporter-otlp-common/​tests/​test_http_client.py Verify unlimited HTTP timeouts across retry paths.
exporter/​opentelemetry-exporter-otlp-common/​src/​opentelemetry/​exporter/​otlp/​common/​http.py Normalize infinite timeouts before transport calls.
.changelog/​5806.fixed Document the zero-timeout fix.

Review effort: Balanced

@tammy-baylis-swi tammy-baylis-swi moved this to Ready for review in Python PR digest Oct 22, 2026
Comment thread .changelog/5806.fixed Resolved


def _transport_timeout(timeout: float) -> float | None:
"""Map an infinite timeout to ``None``, which transports treat as no timeout."""

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.

Suggested change
"""Map an infinite timeout to ``None``, which transports treat as no timeout."""
"""Map an infinite timeout (as set by declarative configuration) to ``None``, which transports treat as no timeout."""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This isn't quite true, a user can still theoretically pass in timeout=math.inf in the exporter constructors.

herin049 and others added 3 commits October 26, 2026 20:37
@herin049
herin049 force-pushed the opentelemetry-python-decl-config-zero-timeout branch from 3086cfe to 90b4805 Compare October 27, 2026 00:38

This branch has not been deployed

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

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

3 participants