1. System boundaries¶
Purpose¶
The repository provides reusable telemetry and performance-evaluation mechanics for Python services. It owns schema enforcement, process lifecycle, OpenTelemetry translation, OTLP export, framework hooks, Collector processing, bounded algorithm evaluation, and portable verification. A consumer owns the meaning of its telemetry and performance Measurements.
The central boundary is the Telemetry protocol. Consumer code converts its typed domain events into
the platform's generic, schema-checked envelopes. The platform never imports a consumer package or a
consumer domain type.
| Concern | Platform implementation | Consumer responsibility |
|---|---|---|
| Process providers, exporters, batching, flush, and shutdown | Owns | Constructs one runtime per process and closes it |
| Operation, event, metric, dimension, outcome, and failure-category vocabulary | Validates a supplied closed schema | Defines meaning and registers the vocabulary |
| Correlation and resource attribute vocabulary | Validates registered names | Chooses safe domain fields and values |
| Framework and SQL instrumentation mechanics | Owns reversible hooks | Calls hooks for owned apps and engines |
| Privacy, cardinality, and capacity floor | Enforces in Python and Collector | May impose stricter rules |
| Collector intake, routing, queues, retry, and backend exporters | Owns composable profiles | Supplies deployment values and infrastructure |
| Model/algorithm evaluation mechanics | Owns bounded execution, statistics, payload-free reports, and generic ranking formulas | Defines cases, relevance, Measurements, and policy |
| Quality, drift, recommendation, commerce, or other domain meaning | Does not define | Owns |
| Domain dashboards, alerts, and runbooks | Does not implement | Owns |
Component model¶
flowchart TB
subgraph Consumer process
D[Domain code]
CA[Consumer-owned typed adapter]
S[TelemetrySchema]
TC[TelemetryConfig]
ID[ResourceIdentity]
RT[TelemetryRuntime]
BT[Backend-neutral Telemetry]
OT[OpenTelemetry adapter]
D --> CA
CA --> BT
S --> RT
TC --> RT
ID --> RT
RT --> BT
RT --> OT
end
subgraph Collector deployment
RX[OTLP receiver]
CP[Common processors]
CO[Forward connectors]
BP[Backend pipelines]
RX --> CP --> CO --> BP
end
OT -->|OTLP| RX
The backend-neutral layer is in core.py. It has no OpenTelemetry
imports. runtime.py selects a no-op adapter or lazily imports
otel.py. The package's required dependency set is empty; the
OpenTelemetry SDK, exporters, FastAPI instrumentation, and SQLAlchemy are in the opentelemetry
optional dependency group.
The performance evaluation core accepts Consumer-owned cases,
algorithms, Measurements, and Assessment Rules without constructing a telemetry runtime or importing
OpenTelemetry. Reports omit case payloads. Explicit aggregate bridges accept Consumer-injected
backend-neutral Telemetry; optional integrations may load their selected dependencies when requested.
Process contract¶
A process is expected to create one TelemetryRuntime at its composition root. This assumption makes
root logger level changes and instrumentation-hook ownership unambiguous. The code does not maintain a
global singleton and does not prevent construction of multiple runtimes, but multiple active runtimes
can each attach handlers and alter the same logger levels.
Importing telemetry only imports configuration, core types, and the lifecycle facade. It does not
create providers, attach log handlers, start exporter threads, or import OpenTelemetry. Enabled runtime
construction is the boundary at which the optional adapter and its dependencies load.
Disabled runtime construction owns no SDK import/provider/exporter setup. Explicit imports and side
effects performed by Consumer code or an injected implementation remain that owner's responsibility.
Deployment shapes¶
Stateless gateway¶
flowchart LR
A1[Application replicas] -->|TLS + bearer-authenticated OTLP| GW[Collector gateway]
GW --> SAFE[Common safety pipeline]
SAFE --> Q1[Backend queue A]
SAFE --> Q2[Backend queue B]
Q1 --> B1[Backend A]
Q2 --> B2[Backend B]
The base pipeline processes each signal once before forward connectors fan out to independent backend queues. Trace head sampling therefore makes one decision before fan-out, so every trace backend sees the same retained trace set.
Persistent egress¶
The persistent profile adds one Collector file_storage extension and changes each selected backend
exporter's sending queue to use it. It is still a Collector gateway; it is not a message broker and it
does not promise exactly-once delivery.
Tail sampling¶
flowchart LR
APP[Applications] --> ROUTER[Stateless routing tier]
ROUTER -->|trace ID hash| SAMPLER[Stateful sampling tier]
SAMPLER --> TB[Trace backends]
ROUTER --> MB[Metric backends]
ROUTER --> LB[Log backends]
The routing tier removes head sampling and uses trace-ID load balancing. Only traces enter the stateful sampler. Metrics and logs remain on routing-tier backend pipelines and can continue when the sampler is unavailable.
Repository-owned artifacts¶
| Path | Responsibility |
|---|---|
src/telemetry/ |
Installable telemetry runtime, production adapter, and performance-evaluation module |
collector/base.yaml |
Common three-signal intake and safety pipeline |
collector/backends/ |
Signal-specific destination exporters and pipelines |
collector/profiles/ |
Ingress, persistence, routing, and tail-sampling overlays |
scripts/validate_collector_profiles.py |
Static invariants, preflight, and native Collector validation |
scripts/verify_collector_local.py |
Synthetic local end-to-end Collector verification |
scripts/verify_installed_package.py |
Clean-wheel and optional-dependency verification |
tests/ |
Unit, SDK contract, framework contract, and workflow contract tests |
.github/workflows/verification.yml |
Required CI evidence pipeline |
compatibility.toml |
Tested cross-artifact version tuple |
Explicit exclusions¶
The repository does not parse consumer configuration files, choose consumer precedence rules, deploy Collectors, provision storage or DNS, manage backend accounts, publish packages or images, sign artifacts, define consumer dashboards, or calculate domain-specific telemetry. Local verification uses synthetic data and deliberately invalid or local endpoints; it does not contact live vendors. The generic ranking functions do not define relevance, sampling, fairness, or product acceptance; those remain Consumer responsibilities.