provide-telemetry
2026-03-07
Initial project setup with quality gates, OTel logging, and full test coverage
72 files · 7,829+
Core package
14 files changed
__init__.pyPublic API surfaceconfig.pyPydantic-based TelemetryConfig from UNDEF_*/OTEL_* env vars (142 lines)setup.pyIdempotent setup_telemetry() / shutdown_telemetry() (42 lines)middleware.pyTelemetryMiddleware binding per-request context via contextvars (45 lines)websocket.pyWebSocket telemetry integration (32 lines)core.pyStructlog pipeline with context processors and configurable handlers (203 lines)processors.pyLog processors: sanitization, context bindingcontext.pyContext propagation helpersprovider.pyOTel TracerProvider with graceful no-op fallback (125 lines)decorators.pyTracing decoratorscontext.pyTrace context utilitiesprovider.pyOTel MeterProvider (111 lines)instruments.pyCounter/gauge/histogram wrappers (84 lines)events.pyEvent 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.pysetup.pycore.pyprovider.pyprovider.pyevents.py
Quality gates
7 files changed
run_mutation_gate.pymutmut gate script (139 lines)run_pytest_gate.pyCoverage gate scriptcheck_max_loc.py500 LOC max per file enforcementcheck_spdx_headers.pySPDX Apache-2.0 license header check.pre-commit-config.yamlPre-commit hooks: mypy, ruff, bandit, codespellci.ymlCI workflow (147 lines)release.ymlRelease 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.pycheck_max_loc.py.pre-commit-config.yamlci.yml
Test suites
14 files changed
test_middleware_and_setup.pyASGI middleware tests (225 lines)test_config_env.pyConfig env var tests (120 lines)test_logger_core.pyLogger core tests (257 lines)test_logger_build_handlers.pyHandler build tests (288 lines)test_logger_configuration.pyLogger config teststest_logger_context_processors.pyContext processor teststest_metrics_core.pyMetrics core tests (297 lines)test_tracing_core.pyTracing core tests (287 lines)test_otlp_integration.pyOTLP integration teststest_provider_helpers.pyProvider helper tests (135 lines)test_otel_extras.pyOTel extras teststest_exports.pyPublic API export teststest_events.pySchema event teststest_setup_lifecycle.pySetup 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.pytest_logger_core.pytest_metrics_core.pytest_tracing_core.pytest_otlp_integration.py
Examples and docs
7 files changed
01_emit_all_signals.pyOpenObserve emit all signals example (116 lines)02_verify_ingestion.pyOpenObserve verify ingestion example (193 lines)01_basic_telemetry.pyBasic telemetry usage exampleARCHITECTURE.mdArchitecture overview (50 lines)CONVENTIONS.mdCoding conventions (66 lines)OPERATIONS.mdOperations runbook (81 lines)README.mdREADME (113 lines)