Provider state gating, circuit breaker half-open, OTel context sync, and regression test suite
36 files · 1,617+ · 102-

Provider State Gating

5 files changed
  • provider.py `get_tracer()` now checks provider initialization state before returning; falls back to no-op if not initialized
  • provider.py `get_meter()` now checks provider initialization state before returning; falls back to no-op if not initialized
  • api.py API layer updated to propagate state-gating behavior
  • __init__.py Metrics package init updated for state gating
  • test_metrics_early_get_meter.py Real-SDK lifecycle test verifying the full provider initialization flow
  • get_tracer() and get_meter() now check whether the OTel provider is properly initialized before returning; returns safe no-op tracer/meter if not initialized harden behavioral
    2 files
    • provider.py
    • provider.py
  • Real-SDK lifecycle test verifies the full provider initialization flow qualify internal
    1 file
    • test_metrics_early_get_meter.py

Circuit Breaker Half-Open Recovery

2 files changed
  • resilience.py Circuit breaker now implements half-open state; decoupled from metrics initialization
  • core.py Logging subsystem decoupled from metrics subsystem initialization
  • Logging subsystem no longer depends on metrics subsystem initialization harden behavioral
    1 file
    • core.py
  • Circuit breaker now implements half-open state: allows a probe request through after recovery window harden behavioral
    1 file
    • resilience.py

OTel Trace Context Sync and Lazy SLO Loading

4 files changed
  • _otel.py OTel trace context now synced into Python's contextvars for cross-coroutine propagation
  • __init__.py SLO module made lazily loaded to reduce import cost
  • decorators.py Tracing decorators updated for context sync
  • test_trace_context_sync.py Tests verifying OTel context propagation into contextvars (145 lines)
  • OpenTelemetry trace context now synced into Python’s contextvars for cross-coroutine propagation instantiate behavioral
    2 files
    • _otel.py
    • test_trace_context_sync.py
  • SLO module (slo.py) made lazily loaded to reduce import cost streamline internal
    1 file
    • __init__.py

Bug Fixes from Code Review

8 files changed
  • setup.py Race conditions and clean shutdown sequence fixed
  • runtime.py Stale cache invalidation fixed
  • sampling.py Sampling subsystem correctness fixes
  • config.py Config correctness fixes
  • fallback.py Stale meter cache fix
  • test_code_review_regressions.py Regression tests for race conditions, staleness, shutdown, and circuit breaker edge cases
  • test_code_review_regressions_2.py Second batch of code review regression tests
  • test_code_review_regressions_3.py Third batch of code review regression tests
  • Fixed 6 code review issues: race conditions in concurrent telemetry access, stale cache invalidation, clean shutdown sequence, circuit breaker edge cases remediate behavioral
    4 files
    • setup.py
    • runtime.py
    • resilience.py
    • fallback.py
  • Fixed stale meter cache, hardened mutation coverage, improved test isolation remediate internal
    2 files
    • fallback.py
    • test_dx_stability.py

Mutation Testing Survivor Kills

7 files changed
  • test_setup_mutations.py Boundary tests and resolve name assertions to kill remaining mutation survivors
  • test_setup_lifecycle.py Setup lifecycle tests with frozen time for cooldown boundary
  • test_otel_integration.py Updated OTel integration tests
  • test_logger_mutations.py Logger mutation test updates
  • test_processors_mutations.py Processor mutation test updates
  • test_thread_safety.py Thread-safety tests updated for mutation coverage
  • test_middleware_cancellation.py ASGI middleware cancellation tests updated
  • Killed remaining mutation survivors with boundary tests and resolve name assertions qualify internal
    1 file
    • test_setup_mutations.py
  • Tests frozen with time.freeze() to eliminate boundary timing ambiguity in cooldown tests qualify internal
    1 file
    • test_setup_lifecycle.py

Test Suite Expansion

8 files changed
  • test_code_review_regressions.py Code review regression tests
  • test_code_review_regressions_2.py Second regression batch
  • test_code_review_regressions_3.py Third regression batch
  • test_dx_stability.py DX stability tests
  • test_trace_context_sync.py Trace context sync tests (145 lines)
  • test_metrics_early_get_meter.py Early get_meter lifecycle tests
  • test_openobserve_e2e.py End-to-end OpenObserve tests
  • test_metrics_core.py Metrics core test updates
  • New test subdirectories and files: test_code_review_regressions.py (three files, ~1,000 lines total), test_dx_stability.py, test_trace_context_sync.py, test_metrics_early_get_meter.py, end-to-end OpenObserve tests qualify internal
    6 files
    • test_code_review_regressions.py
    • test_code_review_regressions_2.py
    • test_code_review_regressions_3.py
    • test_dx_stability.py
    • test_trace_context_sync.py
    • test_openobserve_e2e.py