Skip to content

events

diapason.analytics.events

Canonical registry of external analytics events.

Single source of truth for every event name and property the Diapason analytics module is allowed to send. Any event not declared here is dropped at send time. Any property not declared on a known event is also dropped. This is the fail-closed half of the PII guardrail — see :mod:diapason.analytics.redaction for the value-level filters.

Keeping the catalog in code (not config) means PR review is the gate for adding a new event, and docs/telemetry.md can render from this module as the source of truth.

EventSpec dataclass

Declaration for one analytics event.

known_event_names()

All event names declared in the catalog (for docs and tests).

validate_event(name, properties)

Return cleaned properties or None if the event name is unknown.

Unknown properties are silently dropped. Properties whose values fail the spec's validator are silently dropped. Empty result is valid (the event itself is still recorded).