Telemetry implementation specification¶
This book describes the behavior implemented by this repository. It is a descriptive specification: statements such as “requires,” “rejects,” and “emits” report what the current code, Collector configuration, or verification automation does. They are not proposals for future behavior.
The implementation has two deliverables:
- the
telemetryPython distribution, which supplies a backend-neutral schema and runtime, an optional OpenTelemetry adapter, and dependency-free Consumer performance evaluation; and - a composable OpenTelemetry Collector configuration bundle, including stateless, persistent-queue, and tail-sampling topologies.
The repository's canonical domain vocabulary is defined in CONTEXT.md; Chapter 2
maps those terms to the concrete public types.
The implementation guide complements this reference with an educational
code tour and pattern-focused explanation; it does not replace the exact contracts in these chapters.
flowchart LR
C[Consumer-owned domain code] --> A[Consumer adapter]
A --> P[telemetry public API]
P --> R[TelemetryRuntime]
R -->|disabled| N[No-op adapter]
R -->|enabled| O[OpenTelemetry SDK adapter]
O -->|OTLP gRPC or HTTP/protobuf| I[Collector intake]
I --> S[Identity and safety processors]
S --> T[Sampling and batching]
T --> F[Per-backend pipelines]
F --> H[Honeycomb]
F --> G[Grafana Cloud]
F --> M[Self-managed Tempo, Mimir, and Loki]
F --> L[Local JSONL capture]
Chapters¶
| Chapter | Subject |
|---|---|
| 1. System boundaries | Product scope, ownership, components, and deployment shapes |
| 2. Domain model and public API | Public telemetry and performance-evaluation types, protocols, reports, and adapters |
| 3. Schema validation and data safety | Closed vocabularies, limits, privacy rules, cardinality rules, and validation behavior |
| 4. Configuration schema | Every Python configuration object, default, bound, and cross-field invariant |
| 5. Runtime lifecycle | Construction, lazy loading, context propagation, diagnostics, flush, and shutdown |
| 6. Signal translation and instrumentation | Resource, trace, metric, log, FastAPI, SQLAlchemy, and OTLP mappings |
| 7. Collector processing | Base intake pipelines, safety processing, sampling, batching, and fan-out |
| 8. Collector profiles and topologies | Backend fragments, supported compositions, persistence, and tail sampling |
| 9. Deployment inputs and preflight | Collector environment variables, sizing contracts, image pins, and validation |
| 10. Verification, packaging, and release | Tests, local verification, CI jobs, artifacts, and compatibility identities |
| 11. Traceability and implementation inventory | File-by-file responsibility, guarantees, exclusions, and maintenance rules |
Source-of-truth order¶
When prose and executable behavior disagree, use this order:
- Python code in
src/telemetry; - Collector YAML in
collector; - executable verification in
testsandscripts; - this book; then
- the older narrative documents directly under
docs.
The material under .scratch/ is planning history. It is useful provenance, but it does not define
the current runtime or Collector contract. Consumer-specific telemetry vocabularies, dashboards,
alerts, and domain runbooks live in consumer repositories and are outside this implementation.
Version tuple described here¶
The checked-in compatibility tuple identifies Python distribution telemetry version 0.1.0,
Consumer Integration contract 3, Python >=3.12,<3.15, OpenTelemetry core >=1.44,<1.45,
OpenTelemetry instrumentation 0.65b0, Collector configuration contract 2, and Collector contrib
0.161.0. Qualification crosses SQLAlchemy 2.0.0 and the locked 2.0.54 upper edge.
Repository-owned artifacts use SHA3-512. The immutable Collector and telemetrygen image
digests retain their registry-issued algorithms and are recorded in
compatibility.toml and collector/images.env.