nat.utils.telemetry.payload#

Wire envelope construction for telemetry payloads.

Privacy: every potentially identifying field in the envelope is hardcoded to "undefined". The only fields populated from runtime data are the version string, CPU architecture, and the events themselves.

Classes#

QueuedEvent

In-memory wrapper around an event awaiting flush.

Functions#

_iso_timestamp(→ str)

build_payload(→ dict[str, Any])

Build a wire envelope for a batch of queued events.

Module Contents#

class QueuedEvent#

In-memory wrapper around an event awaiting flush.

event: nat.utils.telemetry.events.TelemetryEvent#
timestamp: datetime.datetime#
retry_count: int = 0#
_iso_timestamp(dt: datetime.datetime | None = None) str#
build_payload(
events: list[QueuedEvent],
*,
source_client_version: str,
session_id: str = 'undefined',
) dict[str, Any]#

Build a wire envelope for a batch of queued events.

All identity-bearing fields are hardcoded to "undefined"; do not change them without a privacy review. Only the events themselves and the harmless metadata (version, CPU arch) carry runtime information.