aeat.core.telemetry._emit module¶
The single remote-telemetry emit call site.
emit_telemetry_event() is the ONLY function a producer
calls to emit a remote-eligible telemetry event. It composes the consent gate
(telemetry_emit_permitted()) with a pluggable
TelemetrySink; when the gate refuses, emission is a
pure no-op – nothing is constructed, nothing is written, nothing is sent.
No network-transmitting sink exists in this slice. The only implementation
here, LocalNoopTelemetrySink, deliberately does
nothing observable: it exists so callers and tests can exercise the full
gate-then-emit sequence without a real transport, proving the payload a future
HTTP sink would send is already the allowlisted, scrubbed shape
(2026-07-04-remote-telemetry-adr).
See also
build_telemetry_payload()Constructs the allowlisted payload consumed here.
HttpTelemetrySinkOptional network transport that implements the same sink protocol.
- class TelemetrySink(*args, **kwargs)[source]¶
Bases:
ProtocolA destination for an allowlisted
TelemetryEventPayload.Implementations of this protocol are the only place a telemetry payload can leave this function’s caller. No implementation in this slice transmits over the network; a future slice adds the real HTTP sink behind this same protocol once the gate and schema have been reviewed.
- send(payload)[source]¶
Deliver
payloadto this sink’s destination.- Return type:
- Parameters:
payload (TelemetryEventPayload)
- class LocalNoopTelemetrySink[source]¶
Bases:
objectA sink that intentionally does nothing.
Used as the default sink in this slice: there is no remote transport yet, so the safe default is to accept the already-gated, already-allowlisted payload and discard it. This lets
emit_telemetry_event()be called end-to-end (gate, schema validation, sink dispatch) without any observable network or disk side effect.- send(payload)[source]¶
Discard
payload. Deliberately a no-op.- Return type:
- Parameters:
payload (TelemetryEventPayload)
- emit_telemetry_event(payload, *, settings, acknowledged, sink=None)[source]¶
Emit
payloadtosinkif and only if the consent gate permits it.- Parameters:
payload (
TelemetryEventPayload) – The already-constructed, already-allowlistedTelemetryEventPayload(build it withbuild_telemetry_payload()so its counters/timings are schema-validated).settings (
Settings) – Resolved deployment settings.acknowledged (
bool) – Whether the operator acknowledged remote telemetry for this specific invocation. Never sticky; re-affirm at every call site.sink (
TelemetrySink|None) – The destination to hand the payload to when permitted. Defaults toLocalNoopTelemetrySink(no transport exists in this slice).
- Return type:
- Returns:
Truewhen the event was handed to the sink;Falsewhen the consent gate refused and emission was a no-op.