11. Traceability and implementation inventory¶
This chapter maps behavior to its implementation and calls out boundaries that are easy to assume but are not present in the current code.
Python source inventory¶
| File | Responsibility |
|---|---|
src/telemetry/__init__.py |
Stable public import surface and __all__ |
src/telemetry/core.py |
Enums, frozen envelopes, closed schema, name/value safety, protocols, recording adapter, no-op adapter, immutable attribute helper |
src/telemetry/config.py |
Frozen configuration graph, endpoint/TLS/secret validation, logging profiles, limits, fingerprint |
src/telemetry/runtime.py |
No-op selection, lazy optional-adapter import, identity override, public lifecycle facade, thread-context wrapper, facade diagnostics |
src/telemetry/otel.py |
SDK imports, signal translation, providers/exporters, bounded logging, framework hooks, provider lifecycle, adapter diagnostics |
src/telemetry/performance/__init__.py |
Compatibility-preserving public exports and exact __all__ |
src/telemetry/performance/api.py |
Compact recommended public evaluation interface |
src/telemetry/performance/core/contracts.py |
Evaluation Cases, Measurement contracts, plans, trials, and summaries |
src/telemetry/performance/core/reports.py |
Closed report records, versions, and in-memory validation |
src/telemetry/performance/core/identity.py |
Dataset, candidate, Measurement, execution, and provenance identities |
src/telemetry/performance/core/environment_collection.py |
Explicit bounded execution-environment collection |
src/telemetry/performance/core/randomness.py |
Independent deterministic seed streams |
src/telemetry/performance/core/paired.py |
Private aligned paired observations and Measurement evidence |
src/telemetry/performance/core/slices.py |
Slice declarations, membership, and bounded report evidence |
src/telemetry/performance/core/checkpoints.py |
Closed completed-trial checkpoint records and validation |
src/telemetry/performance/core/statistics.py |
Dependency-free descriptive, bootstrap, percentile, and trend calculations shared with Capacity Evaluation |
src/telemetry/performance/core/resampling.py |
Bounded paired case/group/trial resampling and uncertainty provenance |
src/telemetry/performance/execution/evaluator.py |
Bounded repeated candidate execution and compatibility-facing evaluation entry points |
src/telemetry/performance/execution/adapters.py |
Sync, async, seeded, and lifecycle adapter contracts and execution |
src/telemetry/performance/execution/async_evaluation.py |
Bounded async candidate scheduling and result accounting |
src/telemetry/performance/execution/batch.py |
Bounded batch execution and batch sweeps |
src/telemetry/performance/execution/resources.py |
Injected process/device resource aggregates and optional readers |
src/telemetry/performance/execution/streaming.py |
Replayable inputs, mergeable moments, and bounded KLL sketches |
src/telemetry/performance/execution/isolation.py |
Opt-in spawned-child evaluation with bounded JSON-only IPC |
src/telemetry/performance/analysis/assessment.py |
Assessment Rules, statuses, reasons, and assessment evidence |
src/telemetry/performance/analysis/compatibility.py |
Ordered, payload-safe report compatibility diagnostics |
src/telemetry/performance/analysis/comparison.py |
Paired difference estimates and aggregate comparison documents |
src/telemetry/performance/analysis/quantiles.py |
Exact-binomial quantile intervals over declared independent units |
src/telemetry/performance/analysis/slices.py |
Paired slice estimates and corrected required-family evidence |
src/telemetry/performance/analysis/sufficiency.py |
Slice independent-unit and interval sufficiency diagnostics |
src/telemetry/performance/serving/runner.py |
Bounded injected-client arrivals, workers, queues, and conservation evidence |
src/telemetry/performance/serving/sweep.py |
Fixed-identity cold/warm serving grids and local curves |
src/telemetry/performance/integrations/_registry.py |
Closed optional-dependency registry and lazy direct-package loader |
src/telemetry/performance/integrations/torch.py |
Lazy PyTorch execution adapter with Consumer-owned model lifecycle |
src/telemetry/performance/integrations/sklearn.py |
Lazy scikit-learn classification, regression, and calibration measurements |
src/telemetry/performance/integrations/curation.py |
Reference-only Consumer curation selection evidence |
src/telemetry/performance/integrations/ranking.py |
Duplicate-safe ranking metrics |
src/telemetry/performance/integrations/mlflow.py |
Explicit metadata-only MLflow export |
src/telemetry/performance/integrations/telemetry.py |
Explicit schema-validated aggregate evaluation telemetry |
src/telemetry/performance/integrations/llm.py |
Bounded LLM streaming and judge evidence with Consumer-owned transport |
src/telemetry/performance/tooling/persistence.py |
Atomic report and checkpoint filesystem I/O |
src/telemetry/performance/tooling/history.py |
Bounded local history for payload-free reports |
src/telemetry/performance/tooling/provenance.py |
Opt-in local code, lock, and distribution provenance collection |
src/telemetry/performance/tooling/presentation.py |
Deterministic Markdown and HTML views of validated evidence |
src/telemetry/performance/tooling/cli.py |
Dependency-free local evaluation-evidence CLI |
src/telemetry/py.typed |
PEP 561 marker for inline typing |
Collector inventory¶
| File or directory | Responsibility |
|---|---|
collector/base.yaml |
Common three-signal receiver, resource/safety processors, head sampler, log filter, batch, forward connectors, health and self-metrics |
collector/profiles/gateway-ingress.yaml |
TLS plus bearer-authenticated application ingress |
collector/profiles/persistent-queue.yaml |
File-storage extension and service-extension replacement |
collector/profiles/persistent-{honeycomb,grafana-cloud,self-managed}.yaml |
Persistent storage and required sizing overrides for each selected exporter |
collector/profiles/tail-routing.yaml |
Trace pipeline replacement and trace-ID load balancing to sampler instances |
collector/profiles/tail-sampling.yaml |
Standalone stateful trace sampler tier |
collector/backends/local-*.yaml |
Rotating JSONL captures for local verification |
collector/backends/local-grafana-*.yaml |
Three bounded OTLP/gRPC pipelines to the local LGTM development service |
collector/backends/honeycomb-*.yaml |
Three Honeycomb OTLP/HTTP exporter pipelines |
collector/backends/grafana-cloud-*.yaml |
Three Grafana Cloud OTLP/HTTP exporter pipelines |
collector/backends/self-managed-*.yaml |
Tempo gRPC, Mimir HTTP, and Loki HTTP pipelines |
collector/tests/*.yaml |
Verification-only trace copy, OTLP sink, and plaintext persistent overlay |
collector/tests/performance/counting-sink.yaml |
Local-only bounded exporters to the fault-controllable counting sink |
collector/config.env.example |
Empty deployment input template and safe defaults |
collector/images.env |
Immutable Collector, telemetrygen, and Grafana LGTM image references |
collector/local-grafana/compose.yaml |
Loopback-only local Collector and Grafana logs/metrics/traces topology |
Delivery and support inventory¶
| File | Responsibility |
|---|---|
pyproject.toml |
Build backend, package metadata, supported Python, extras, pytest, Ruff, and mypy policy |
uv.lock |
Fully resolved development and optional-adapter dependency graph |
.python-version |
Authoritative local Python toolchain pin |
Makefile |
Setup, diagnostics, focused feedback, test, smoke, Docker, and full verification entry points |
compatibility.toml |
Cross-artifact version and image tuple |
Dockerfile |
Pinned, non-root, locked repository validation environment |
scripts/doctor.sh |
Local harness prerequisite and state diagnostics |
scripts/validate_architecture.py |
Import-boundary and package-cycle checks |
scripts/validate_repository_docs.py |
Relative-link, verification test-module, and Make command-surface checks |
scripts/validate_collector_profiles.py |
Composition registry, static invariants, advanced preflight, and native validation |
scripts/verify_collector_local.py |
Synthetic Docker delivery and failure scenarios |
scripts/verify_installed_package.py |
Clean installed-wheel report for base and adapter environments |
scripts/qualify_platform.py |
Exact-stack, paired-sample, fixed-budget qualification evidence evaluator |
scripts/performance_sink.py |
Benchmark-only OTLP request/item/byte/duplicate counting and fault responses |
scripts/run_performance.py |
Bounded open-loop stateless and local-file load, local orchestration, resource sampling, exact sink accounting, and raw evidence |
scripts/performance_execution.py |
Spawned POSIX trial groups, wall deadlines, bounded control statuses and interruption cleanup |
scripts/measure_runtime.py |
Public TelemetryRuntime disabled, in-memory, gRPC, and HTTP/protobuf overhead repetitions with retained call/flush/shutdown samples |
scripts/validate_performance_report.py |
Pure performance schema, count, classification, capacity, and comparison calculations |
docs/performance-testing.md |
Local benchmark commands, evidence, interpretation, cleanup, and limitations |
docs/performance-evaluation.md |
Consumer evaluation interface, recommendation example, comparison, policy, privacy, and limits |
scripts/verify_upgrade_compatibility.py |
Installed-candidate SQLAlchemy/OTLP edge and unavailable-Collector isolation verifier |
.github/workflows/verification.yml |
Required test, package, Collector, and compatibility evidence jobs |
.github/actions/setup-python-uv/action.yml |
macOS ARM64 runner validation plus provisioned Python and pinned uv setup shared by CI jobs |
scripts/sha3sum.py |
Portable deterministic SHA3-512 evidence digests for macOS CI |
README.md |
Project entry point |
CONTRIBUTING.md |
Contribution gates and ownership guardrails |
SECURITY.md |
Private reporting expectations and current release-channel status |
docs/index.md |
Question-oriented documentation navigation |
docs/implementation-guide.md |
Educational end-to-end code tour and design-pattern rationale |
docs/testing.md |
Feedback ladder, fixtures, regression discipline, and generated outputs |
docs/agent-readiness.md |
Research-backlog coverage and measurement contract |
Guarantee traceability¶
| Guarantee | Primary implementation | Executable evidence |
|---|---|---|
| Disabled runtime does not import OpenTelemetry or mutate logging | TelemetryRuntime.create, _NoopRuntime |
core unit test; clean-wheel verifier |
| Names and values are closed and bounded | TelemetrySchema, envelope __post_init__, attributes() |
core unit tests |
| Privacy/cardinality spellings normalize consistently | _normalized_name_parts, phrase matchers |
parameterized core tests |
| Secret contents do not enter fingerprints/errors | SecretReference, TelemetryConfig.fingerprint |
core/config tests |
| Production conversion failures preserve business flow | OpenTelemetry, _OtelOperation, facade catches |
runtime-hardening tests |
| One deadline bounds flush/shutdown callers | provider worker and monotonic deadline | runtime-hardening tests |
| FastAPI/SQLAlchemy hooks are idempotent and reversible | runtime hook ownership collections | framework contract tests |
| SQL content is not captured | three engine callbacks | SQLAlchemy contract test |
| Trace/metric/log mapping matches schema | production adapter | OpenTelemetry contract tests |
| Required resource identity and safety run before fan-out | base Collector pipeline | static validation and local verifier |
| Local Grafana cannot bypass the platform Collector | loopback-only Compose topology and local Grafana fragments | delivery artifact contract and native composition validation |
| Failed backend queues are isolated | signal-specific backend pipelines | failed-fan-out and saturation scenarios |
| Persistent queue survives restart | file-storage overlays | persistent restart/drain scenario |
| Head sampling is identical across fan-out | sampler before forward connector | 1,000-trace dual-capture scenario |
| Tail decisions operate on complete traces and metrics/logs bypass | routing and sampler profiles | deterministic tail scenario |
| Non-local ingress requires TLS and bearer auth | gateway overlay | temporary-certificate scenario |
| Candidate wheels work without source-tree imports | build/install workflow | installed-package verifier and CI jobs |
| Supported SQLAlchemy edges and OTLP clients preserve business behavior during Collector loss | upgrade verifier | Python/SQLAlchemy/transport CI matrix |
| Qualification summaries match retained normalized samples and fixed budgets | qualification evaluator | delivery qualification contracts |
| Local performance results bind exact artifacts and distinguish product failure from environment limits | performance runner and validator | deterministic performance unit tests and opt-in perf-smoke |
| Consumer algorithms support custom case/corpus Measurements without retaining payloads | telemetry.performance |
performance-evaluation unit tests and installed-wheel verifier |
| Platform source preserves dependency direction and lazy adapter imports | architecture validator | make architecture-check and delivery contract |
| Agent-facing paths and commands remain resolvable | docs validator | make docs-check and delivery contract |
Implemented boundaries and non-behaviors¶
These details prevent the specification from implying capabilities the repository does not contain:
- The platform validates typed configuration objects; it does not load TOML, YAML, environment prefixes, command-line arguments, or framework settings into them.
TelemetrySchemais an in-memory Python dataclass contract. The repository does not publish or parse a JSON Schema, Protocol Buffers schema, or schema-registry artifact for consumer vocabulary.- Framework instrumentation is opt-in by explicit method call. Configuration switches do not discover or instrument apps and engines automatically.
- The runtime does not install OpenTelemetry global tracer or meter providers. It passes owned providers directly to its translators and FastAPI instrumentation.
- Telemetry context is added to operation spans and exported logs, but not to metric dimensions.
- Arbitrary Python log messages are intentionally replaced with
application.log; the platform does not provide free-form message export. - The Python log redactor applies to copied record extras, not context values. Collector safety removes suspicious keys and does not scan bodies or safe-named values.
- The base local Collector receiver is plaintext. TLS/auth appears only when the gateway overlay is part of the composition.
- The tail sampler's own receiver has no TLS/auth block in its standalone YAML. Network isolation and any additional internal transport hardening are deployment responsibilities.
- The persistent capacity, quota, outage, and drain declarations are preflight contracts. Only storage directory, queue size, and retry window directly configure the current persistent YAML.
- Persistent queues are at-least-once and can duplicate data. There is no deduplication or exactly-once layer.
- The repository provides one opt-in local-development Collector and Grafana Compose topology. It does not deploy production Collectors, create storage quotas, configure headless DNS, or contact live vendor backends during verification.
- Collector YAML is not embedded in the Python wheel. Consumers or deployment automation must obtain the matching repository/configuration artifact separately.
- The CI workflow builds evidence but does not publish, sign, or deploy artifacts.
- No dashboard, alert rule, service-level objective, domain telemetry schema, or live runbook is shipped
here. Operational threshold recommendations in
collector/README.mdare prose, not provisioned rules.
Maintenance rule¶
A change to public types, validation, defaults, signal mappings, runtime lifecycle, Collector components,
supported compositions, preflight constraints, package metadata, or CI evidence changes this descriptive
specification. Update the affected chapter with the implementation change and keep
compatibility.toml aligned when a public or cross-artifact identity changes.