Skip to content

Mirror: align PeriodicMetricReader export timeout semantics - #1

Open
skrcode wants to merge 9 commits into
mainfrom
mirror/upstream-pr-8684
Open

Mirror: align PeriodicMetricReader export timeout semantics#1
skrcode wants to merge 9 commits into
mainfrom
mirror/upstream-pr-8684

Conversation

@skrcode

@skrcode skrcode commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Exact-head evaluation mirror of open-telemetry/opentelemetry-java#8684.

  • Original author: Rajkaran-122
  • Exact source head: b25a0bbb11c6f4795df05df5399d0aaa38ab4658
  • Purpose: run a same-repository JAIPilot evaluation against the immutable upstream PR head.
  • Authorship: this mirror does not claim the original work.
  • Publication: do not merge this mirror and do not open a duplicate upstream PR. Any validated companion improvement will be offered to the original contributor branch first.

The upstream PR was ready for review with its Java 8/11/17/21/25/26 build matrix green on macOS, Ubuntu, and Windows, plus CodeQL, API-surface, wrapper-validation, CLA, and coverage checks.

…cheduler

Replace scheduler-based withTimeout() with CompletableResultCode.join(),
matching the established pattern in BatchSpanProcessor and
BatchLogRecordProcessor. The previous approach used scheduler.schedule()
which throws RejectedExecutionException during shutdown because the
scheduler is intentionally shut down before the final export flush.
…ication

- Added setExporterTimeout() API to PeriodicMetricReaderBuilder with 30-second default per spec
- Removed @SInCE 1.40.0 annotations as requested by reviewer
- Updated API-diff to reflect new public API
- Added comprehensive tests for timeout behavior
- Implemented conditional timeout enforcement (only when explicitly configured)
- Addressed blocking concern by making timeout opt-in via setExporterTimeout()
…Reader

Add asynchronous timeout enforcement for MetricExporter operations in
PeriodicMetricReader using a dedicated timeout executor. This preserves
the existing asynchronous scheduling and batching behavior while enforcing
the spec-required 30-second default export timeout.

Changes:
- Add dedicated ScheduledExecutorService for timeout scheduling
- Implement applyTimeout() method with asynchronous timeout enforcement
- Preserve async batch processing with Iterator-based sequential execution
- Fix Error Prone warnings (UnusedVariable, PreferJavaTimeOverload)
- Add timeout enforcement test

The timeout executor is shut down after final export completes to avoid
RejectedExecutionException during shutdown. Timeout enforcement fails
the result when timeout expires without blocking the periodic scheduler.

Resolves CI compilation failures in PR open-telemetry#8684.
… jack-berg review

- Remove separate timeout executor and reuse existing scheduler
- Increase scheduler from 1 to 2 threads to handle both periodic exports and timeout tasks
- Simplify applyTimeout() by removing AtomicBoolean/timedOut state tracking
- Combine SlowMetricExporter and FastMetricExporter into single DelayingMetricExporter
- Add RejectedExecutionException handling for shutdown race condition
- Fix BooleanParameter warnings in tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants