Skip to content

fix(sdk): add validation for export_timeout_millis <= 0 in BatchSpanP… - #5650

Open
Dotify71 wants to merge 2 commits into
open-telemetry:mainfrom
Dotify71:fix-batch-span-processor-timeout-validation
Open

Dotify71 wants to merge 2 commits into
open-telemetry:mainfrom
Dotify71:fix-batch-span-processor-timeout-validation

Conversation

@Dotify71

Copy link
Copy Markdown
Contributor

Description

Fixes #5648

Currently, BatchSpanProcessor validates max_queue_size, schedule_delay_millis, and max_export_batch_size during initialization to ensure they are positive integers. However, export_timeout_millis was omitted from argument validation, allowing non-positive or negative values (0 or negative integers) to be passed without error.

This PR adds validation for export_timeout_millis in BatchSpanProcessor._validate_arguments(), raising a ValueError if export_timeout_millis <= 0.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit tests in opentelemetry-sdk/tests/trace/export/test_export.py (test_invalid_export_timeout_millis)

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

@Dotify71
Dotify71 requested a review from a team as a code owner September 10, 2026 06:02
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 10, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Dotify71 / name: Dushyant Acharya (9b5daa0)

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 10, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-09-17 08:34 UTC

Review the latest changes.

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.

@henry3260 henry3260 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.

Do we actually need to validate this? export_timeout_millis is stored in BatchProcessor but never read, and the log processor even has a comment saying "Not used. No way currently to pass timeout to export." So a non-positive value has no runtime effect today.

@Dotify71

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look @henry3260

I added validation mainly for consistency with schedule_delay_millis and max_queue_size, so users don't pass invalid negative values for OTEL_BSP_EXPORT_TIMEOUT.

That said, if we prefer not validating it until export timeouts are enforced in the export loop, happy to follow your lead!

@henry3260

Copy link
Copy Markdown
Contributor

cc @emdneto @xrmx

@henry3260

Copy link
Copy Markdown
Contributor

If we want to add validation here, we should add this too :)

BatchLogRecordProcessor._validate_arguments(max_queue_size, schedule_delay_millis, max_export_batch_size)

@Dotify71

Copy link
Copy Markdown
Contributor Author

Added validation to BatchLogRecordProcessor as well and updated unit tests :))

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] BatchSpanProcessor missing validation for export_timeout_millis <= 0

2 participants