Per-module log level overrides, FilteringBoundLogger, executor saturation tests, TypeScript examples
47 files · 8,962+ · 51-

Per-module log level overrides via UNDEF_LOG_MODULE_LEVELS

6 files changed
  • config.py Added module_levels field to LoggingConfig; added _parse_module_levels() helper that parses 'module=LEVEL,module2=LEVEL2' from UNDEF_LOG_MODULE_LEVELS env var into a normalized dict
  • processors.py Added _LevelFilter structlog processor with longest-prefix matching: drops events below the configured threshold for their module; added make_level_filter() factory; added _FAST_LEVEL_LOOKUP dict for O(1) level-name → numeric conversion
  • core.py Added _LEVEL_NAME_TO_NUMERIC map; wires make_level_filter() into the processor chain when module_levels is non-empty; added _make_filtering_bound_logger() that extends structlog.make_filtering_bound_logger with .trace(), .is_debug_enabled(), .is_trace_enabled(), and a permissive no-op for filtered levels
  • __init__.py Updated exports
  • test_level_filter.py 223-line test file covering _LevelFilter prefix matching, default vs override thresholds, exact and prefix matches, TRACE level, and edge cases
  • test_logger_mutations.py Extended mutation test suite for per-module level override paths; 100% branch coverage and mutation kill score enforced
  • UNDEF_LOG_MODULE_LEVELS=‘asyncio=WARNING,undef.server=DEBUG’ configures per-module thresholds. _LevelFilter performs longest-prefix matching on the logger name field in each event dict — e.g. ‘undef.server.rpc’ matches ‘undef.server’ before ‘undef’. Events below the matching threshold are dropped before output. instantiate behavioral
    3 files
    • config.py
    • processors.py
    • core.py
  • _make_filtering_bound_logger() extends structlog’s FilteringBoundLogger with .trace() (routes through .debug(_trace=True)), .is_debug_enabled() and .is_trace_enabled() O(1) level checks for guarding expensive argument construction, and a permissive no-op for filtered-out log methods that accepts arbitrary args/kwargs. instantiate behavioral
    1 file
    • core.py

Executor saturation load tests

3 files changed
  • test_executor_saturation.py 222-line load test suite covering three failure modes under sustained export failures: ghost thread accumulation (circuit breaker bounds growth), circuit breaker lifecycle (trip→block→half-open→reset→re-trip), and cross-signal isolation (log timeout storm cannot starve traces/metrics workers)
  • 2026-03-22-executor-saturation-load-test.md Implementation plan for executor saturation load tests
  • 2026-03-22-executor-saturation-load-test-design.md Design spec for executor saturation load tests
  • Three integration test classes exercise the resilience.py circuit breaker under sustained failure: ghost thread accumulation asserts worker pool stays bounded; circuit breaker lifecycle drives the full state machine; cross-signal isolation verifies that a log exporter saturated by timeouts cannot starve traces or metrics workers. Each test uses a 5ms timeout for reliable triggering and autouse fixtures that reset resilience state. qualify internal
    1 file
    • test_executor_saturation.py
  • Added docs covering the design spec and step-by-step implementation plan for the executor saturation load test suite. specify internal
    2 files
    • 2026-03-22-executor-saturation-load-test.md
    • 2026-03-22-executor-saturation-load-test-design.md

Resilience test hardening and memray fixes

10 files changed
  • test_logger_core.py Extended tests for the updated FilteringBoundLogger behavior
  • conftest.py Anchors memray test paths to project root via VERSION file lookup
  • test_backpressure_stress.py Fixed test path anchoring
  • test_bounded_growth_stress.py Fixed test path anchoring
  • test_logging_stress.py Fixed test path anchoring
  • test_metrics_stress.py Fixed test path anchoring
  • test_pii_stress.py Fixed test path anchoring
  • test_sampling_stress.py Fixed test path anchoring
  • test_tracing_stress.py Fixed test path anchoring
  • test_code_review_regressions_4b.py Updated regression test for new processor behavior
  • Memray test conftest now resolves the project root by walking up from file to find VERSION rather than using relative paths, making tests relocatable. Memray tests excluded from mutmut stats collection to prevent false mutation-kill credit. qualify internal
    8 files
    • conftest.py
    • test_backpressure_stress.py
    • test_bounded_growth_stress.py
    • test_logging_stress.py
    • test_metrics_stress.py
    • test_pii_stress.py
    • test_sampling_stress.py
    • test_tracing_stress.py
  • Thread drain assertion in test_logger_core changed from < to <= to avoid flaky failures under parallel test runners where exact thread counts vary by timing. qualify internal
    1 file
    • test_logger_core.py

TypeScript SDK examples

22 files changed
  • basic_logging.ts Basic logging usage example
  • context_binding.ts Context binding example
  • metrics.ts Metrics API example
  • tracing.ts Distributed tracing example
  • pii_sanitization.ts PII sanitization example
  • openobserve.ts OpenObserve integration example
  • 01_emit_all_signals.ts Emit logs, metrics, and traces to OpenObserve
  • 02_verify_ingestion.ts Verify signal ingestion in OpenObserve
  • 03_hardening_profile.ts Hardening profile with OpenObserve
  • 01_basic_telemetry.ts Basic telemetry setup
  • 02_w3c_propagation.ts W3C trace context propagation
  • 03_sampling_and_backpressure.ts Sampling and backpressure configuration
  • 04_runtime_reconfigure.ts Runtime reconfiguration
  • 05_pii_and_cardinality_policy.ts PII and cardinality policy configuration
  • 06_exporter_resilience_modes.ts Exporter resilience modes
  • 07_slo_and_health_snapshot.ts SLO and health snapshot
  • 08_full_hardening_profile.ts Full hardening profile
  • 09_error_handling_and_degradation.ts Error handling and graceful degradation
  • 10_performance_metrics.ts Performance metrics
  • 11_lazy_loading_proof.ts Lazy loading proof-of-concept
  • package-lock.json Lockfile for TypeScript examples dependencies
  • .gitignore Ignore stryker reports and build artifacts
  • Added 20+ TypeScript example files covering the full SDK surface: basic logging, context binding, metrics, tracing, PII sanitization, OpenObserve integration (3 scenarios), and 11 progressive telemetry examples covering W3C propagation, sampling, backpressure, runtime reconfiguration, cardinality policy, exporter resilience, SLO health, hardening profiles, and lazy loading. specify internal
    22 files
    • basic_logging.ts
    • context_binding.ts
    • metrics.ts
    • tracing.ts
    • pii_sanitization.ts
    • openobserve.ts
    • 01_emit_all_signals.ts
    • 02_verify_ingestion.ts
    • 03_hardening_profile.ts
    • 01_basic_telemetry.ts
    • 02_w3c_propagation.ts
    • 03_sampling_and_backpressure.ts
    • 04_runtime_reconfigure.ts
    • 05_pii_and_cardinality_policy.ts
    • 06_exporter_resilience_modes.ts
    • 07_slo_and_health_snapshot.ts
    • 08_full_hardening_profile.ts
    • 09_error_handling_and_degradation.ts
    • 10_performance_metrics.ts
    • 11_lazy_loading_proof.ts
    • package-lock.json
    • .gitignore

Bump to v0.3.18

6 files changed
  • VERSION Bumped to 0.3.18
  • pyproject.toml Version bump; updated codespell skip list to include typescript artifacts
  • CONFIGURATION.md Added UNDEF_LOG_MODULE_LEVELS to configuration reference
  • memray_analysis.py Minor updates
  • memray_bounded_growth_stress.py Minor updates
  • tracemalloc_audit.py Minor updates
  • Bumped VERSION to 0.3.18. Updated codespell skip list to include package-lock.json and stryker report artifacts generated by TypeScript example setup. baseline internal
    2 files
    • VERSION
    • pyproject.toml