Initial project setup with quality gates, OTel logging, and full test coverage
72 files · 7,829+
14 files changed
  • __init__.py Public API surface
  • config.py Pydantic-based TelemetryConfig from UNDEF_*/OTEL_* env vars (142 lines)
  • setup.py Idempotent setup_telemetry() / shutdown_telemetry() (42 lines)
  • middleware.py TelemetryMiddleware binding per-request context via contextvars (45 lines)
  • websocket.py WebSocket telemetry integration (32 lines)
  • core.py Structlog pipeline with context processors and configurable handlers (203 lines)
  • processors.py Log processors: sanitization, context binding
  • context.py Context propagation helpers
  • provider.py OTel TracerProvider with graceful no-op fallback (125 lines)
  • decorators.py Tracing decorators
  • context.py Trace context utilities
  • provider.py OTel MeterProvider (111 lines)
  • instruments.py Counter/gauge/histogram wrappers (84 lines)
  • events.py Event name validation and required-key enforcement
  • undef.telemetry package: structured logging (structlog), optional OTel tracing/metrics, ASGI middleware, and schema-validated event emission. Config parsed from UNDEF_/OTEL_ env vars via Pydantic. setup_telemetry() / shutdown_telemetry() are idempotent. Logger pipeline uses structlog with context processors and configurable handlers (console/JSON/OTel). Tracer and meter providers fall back gracefully to no-ops when OTel SDK is absent. instantiate architectural
    6 files
    • config.py
    • setup.py
    • core.py
    • provider.py
    • provider.py
    • events.py

Quality gates

7 files changed
  • run_mutation_gate.py mutmut gate script (139 lines)
  • run_pytest_gate.py Coverage gate script
  • check_max_loc.py 500 LOC max per file enforcement
  • check_spdx_headers.py SPDX Apache-2.0 license header check
  • .pre-commit-config.yaml Pre-commit hooks: mypy, ruff, bandit, codespell
  • ci.yml CI workflow (147 lines)
  • release.yml Release workflow
  • 100% branch coverage via pytest gate. 100% mutation kill score via mutmut gate. SPDX Apache-2.0 headers required on all source files. 500 LOC max per file enforced. mypy strict mode, ruff, bandit, codespell. Integration/e2e tests marked no-cov. OTel-dependent tests behind pytest marker. baseline internal
    4 files
    • run_mutation_gate.py
    • check_max_loc.py
    • .pre-commit-config.yaml
    • ci.yml

Test suites

14 files changed
  • test_middleware_and_setup.py ASGI middleware tests (225 lines)
  • test_config_env.py Config env var tests (120 lines)
  • test_logger_core.py Logger core tests (257 lines)
  • test_logger_build_handlers.py Handler build tests (288 lines)
  • test_logger_configuration.py Logger config tests
  • test_logger_context_processors.py Context processor tests
  • test_metrics_core.py Metrics core tests (297 lines)
  • test_tracing_core.py Tracing core tests (287 lines)
  • test_otlp_integration.py OTLP integration tests
  • test_provider_helpers.py Provider helper tests (135 lines)
  • test_otel_extras.py OTel extras tests
  • test_exports.py Public API export tests
  • test_events.py Schema event tests
  • test_setup_lifecycle.py Setup lifecycle tests
  • Full unit suites: asgi/, logger/ (split to stay within 500 LOC), metrics/, tracing/. OTLP integration tests. OTel extras and provider helper tests. Public API export tests verify all surface. Schema event validation tests. Tooling tests for gate scripts. qualify internal
    5 files
    • test_middleware_and_setup.py
    • test_logger_core.py
    • test_metrics_core.py
    • test_tracing_core.py
    • test_otlp_integration.py

Examples and docs

7 files changed
  • 01_emit_all_signals.py OpenObserve emit all signals example (116 lines)
  • 02_verify_ingestion.py OpenObserve verify ingestion example (193 lines)
  • 01_basic_telemetry.py Basic telemetry usage example
  • ARCHITECTURE.md Architecture overview (50 lines)
  • CONVENTIONS.md Coding conventions (66 lines)
  • OPERATIONS.md Operations runbook (81 lines)
  • README.md README (113 lines)
  • Two OpenObserve examples (emit all signals, verify ingestion) and basic telemetry example. Architecture, conventions, operations, release, and compliance docs. specify internal
    4 files
    • 01_emit_all_signals.py
    • 02_verify_ingestion.py
    • ARCHITECTURE.md
    • README.md