Skip to content

opentelemetry-sdk: allow zero schedule delay in batch span and log record processors - #5807

Merged
herin049 merged 4 commits into
open-telemetry:mainfrom
herin049:fix/decl-config-zero-delay
Oct 22, 2026
Merged

herin049 merged 4 commits into
open-telemetry:mainfrom
herin049:fix/decl-config-zero-delay

Conversation

@herin049

Copy link
Copy Markdown
Contributor

Description

BatchSpanProcessor and BatchLogRecordProcessor rejected schedule_delay_millis=0 with a ValueError. The declarative configuration schema allows schedule_delay: 0, so a config that set it failed during SDK setup and no telemetry was exported.

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:57
@opentelemetry-pr-dashboard

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

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-22 18:35 UTC

Status above doesn't look right?
  • 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 found no blocking issues in validation, worker notification handling, or regression coverage; tests were not executed.

No open issues 🎉

What changed in this PR

This PR aligns SDK batch processors with declarative configuration by accepting a zero schedule delay and exporting telemetry promptly without idle polling.

Changes:

  • Allow zero schedule delay for batch span and log record processors while continuing to reject negative values.
  • Update worker notifications to support immediate export, including telemetry emitted during an export.
  • Add SDK, configuration, and end-to-end regression coverage, plus a changelog entry.
File Description
tests/​opentelemetry-docker-tests/​tests/​declconfig/​scenarios/​general_batch_zero_schedule_delay/​scenario.yaml Defines expected span and log exports.
tests/​opentelemetry-docker-tests/​tests/​declconfig/​scenarios/​general_batch_zero_schedule_delay/​run.py Emits spans and a correlated log record.
tests/​opentelemetry-docker-tests/​tests/​declconfig/​scenarios/​general_batch_zero_schedule_delay/​otel-config.yaml Configures zero-delay batch processors with OTLP/HTTP exporters.
opentelemetry-sdk/​tests/​trace/​export/​test_export.py Checks that span processors accept zero delay.
opentelemetry-sdk/​tests/​shared_internal/​test_batch_processor.py Tests immediate export and emission during export.
opentelemetry-sdk/​tests/​logs/​test_export.py Checks that log processors accept zero delay.
opentelemetry-sdk/​src/​opentelemetry/​sdk/​trace/​export/​__init__.py Allows non-negative span processor delays.
opentelemetry-sdk/​src/​opentelemetry/​sdk/​_shared_internal/​__init__.py Implements event-driven zero-delay export handling.
opentelemetry-sdk/​src/​opentelemetry/​sdk/​_logs/​_internal/​export/​__init__.py Allows non-negative log processor delays.
opentelemetry-configuration/​tests/​test_tracer_provider.py Verifies zero-delay tracer configuration.
opentelemetry-configuration/​tests/​test_logger_provider.py Verifies zero-delay logger configuration.
.changelog/​5807.fixed Documents the fix.

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Oct 22, 2026
@herin049
herin049 enabled auto-merge October 22, 2026 18:21
@herin049
herin049 added this pull request to the merge queue Oct 22, 2026
Merged via the queue into open-telemetry:main with commit 1d6fa4b Oct 22, 2026
580 checks passed
@herin049
herin049 deleted the fix/decl-config-zero-delay branch October 22, 2026 18:32
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants