Telemetry platform architecture¶
Ownership¶
The platform and each consumer have deliberately different responsibilities.
| Concern | Telemetry repository | Consumer repository |
|---|---|---|
| Runtime lifecycle, OTLP exporters, batching and shutdown | Owns | Configures and constructs once per process |
| Metric names, units, dimensions and meaning | Enforces registered schema | Owns |
| Operation, event and correlation vocabulary | Enforces registered schema | Owns |
| Domain assessment such as recommendation quality or drift | Never imports | Owns |
| Framework and database instrumentation mechanics | Owns | Calls composition hooks |
| Safety floor, redaction and resource limits | Owns; cannot be weakened | May make stricter |
| Collector base, topology and backend profiles | Owns | Supplies deployment overlays only when needed |
| Collector/runtime health views and runbooks | Owns | Extends with domain views and runbooks |
| Domain dashboards and alerts | Does not own | Owns |
The dependency direction is one-way: a consumer imports telemetry; the telemetry source tree must
never import consumer packages or domain types.
For a code-oriented walkthrough of how these boundaries collaborate, including the concrete design patterns and their trade-offs, see the implementation guide. The chaptered implementation specification remains the exact behavioral reference.
Public interface¶
The external seam consists of:
TelemetrySchema, which registers every operation, event, metric, metric instrument, unit, dimension, correlation attribute, operation outcome, error outcome, and failure category accepted by one consumer schema version;- immutable
TelemetryContext,OperationSpec,MetricObservation, andEventObservationenvelopes; - the three-capability
Telemetryinterface:bind,operation, andobserve; TelemetryRuntime, which owns providers, exporters, framework hooks, context propagation, flush, and shutdown; and- typed, secret-safe
TelemetryConfigvalues.
Consumers retain their own typed interface. A consumer adapter converts its enums and domain objects into platform envelopes. The platform validates every name and attribute against the registered schema before emitting it, so generic transport types do not create a free-form escape hatch in application code.
Schema registration also enforces the platform safety and capacity floor. Attribute names are
normalized by splitting camel-case boundaries, case-folding, and treating every run of
non-alphanumeric characters as one separator. The privacy rules therefore treat names such as
AuthorizationToken, authorization-token, and authorization.token consistently. Credential,
connection, SQL, header/body, raw-interaction, recommendation-payload, feature-vector, raw Order
identifier, and raw Browsing Session identifier families cannot be registered for any attribute
channel. Metric dimensions additionally reject request, run, snapshot, Commerce Account/Scope,
catalog, product, order, job, and Browsing Session identity spellings. Consumer policy may reject
more names but cannot admit these families.
The public envelope ceiling is 64 attributes. The schema reserves platform-generated fields and therefore admits at most 57 custom resource attributes, 61 combined context/operation attributes, 62 combined context/event attributes, and 64 dimensions on one metric. Each operation, event, metric, and outcome vocabulary contains at most 256 names; failure categories contain at most 64. Attribute strings and sequence elements contain at most 1,024 characters, string sequences contain at most 16 elements, integers use the signed 64-bit range, and floating-point values must be finite. These are platform maxima; deployment configuration may impose stricter emission limits.
Runtime and failure semantics¶
One runtime is created at each process composition root. Importing modules does not initialize providers, install handlers, instrument frameworks, or start exporter threads. Disabled telemetry is side-effect free and does not import OpenTelemetry. Invalid enabled configuration fails startup; after startup, conversion/export failure is fail-open for business behavior. Queues, attributes, flushes, and shutdown waits are bounded.
Post-startup failures emit at most one local stderr line per fixed failure category. This path uses
neither application log records nor exception text, so it cannot re-enter OTLP logging or disclose
record bodies and credentials. OpenTelemetry and gRPC internal loggers are excluded from the OTLP
handler. One monotonic shutdown_timeout_ms deadline covers every provider flush and shutdown;
timeout closes the runtime and leaves at most one daemon lifecycle worker. Repeated flush and
shutdown calls are safe.
FastAPI receives the runtime's tracer and meter providers, with an explicit no-op provider substituted
when the corresponding trace or metric signal is disabled. Each app and SQLAlchemy engine is
instrumented once and its owned hooks are removed at shutdown or after partial startup. Database spans
contain only the fixed operation name, span kind, status, exception type, and db.system.name;
statements, parameters, connection URLs, and SQL comments are never attached.
Configuration and security¶
The platform owns OTLP transport, TLS/mTLS, secret references, signal switches, batching, logging, instrumentation, resource ceilings, redaction, and safe endpoint validation. Consumers own parsing and precedence in their deployment format, service names, environment identities, logging-profile names, schema versions, and any stricter domain policy.
Secret values are resolved only while constructing a runtime and never participate in a configuration fingerprint, representation, exception, metric, or log. Applications target one Collector endpoint and contain no vendor endpoint or credential.
Environment secret references use uppercase environment-variable tokens. File references use
bounded paths. Application-to-Collector secret headers are restricted to authorization and
x-api-key. A client-key reference always resolves to a filesystem path for both HTTP and gRPC;
the referenced file contains the private key. An environment reference therefore contains a path,
while a file reference is the path itself. The runtime reads the key bytes for gRPC and supplies
the same validated path to HTTP.
Named logging profiles are exact and unknown names fail startup. When console output is enabled,
the runtime owns one text or JSON handler selected by console_format; shutdown removes only that
handler and restores only logger levels changed by the runtime. Disabling console output installs
no runtime-owned console handler and does not remove or alter pre-existing handlers.
Collector delivery¶
collector/base.yaml owns common OTLP intake, required standard resource identity, privacy and
cardinality processing, Collector-owned sampling, batching, and pre-fan-out connectors. Topology
profiles and backend fragments compose after the base. Remote ingress is TLS- and
bearer-authenticated. Vendor branches have isolated bounded queues and retry windows.
The opt-in local Grafana topology keeps the same base processing path and sends the three processed signals to a loopback-only Grafana LGTM development stack. It is not a production deployment profile.
Consumers may add overlays, but a supported composition must still include the base safety processors before fan-out. Consumer-specific telemetry names and domain dashboards do not belong in the base profile.
Version identities¶
The following identities are independent:
- Python distribution version: reusable runtime compatibility;
- Consumer Integration contract version: envelope/schema mechanics;
- consumer telemetry schema version: names and emitted semantics;
- Collector configuration bundle version and digest; and
- upstream Collector image digest.
A change in one does not silently relabel another. compatibility.toml records the tested tuple.