thunderbird_accounts.telemetry

thunderbird_accounts.telemetry.capture(event: str, keycloak_user_id: str, properties: dict | None = None, service: str = 'accounts')[source]

Submit an event to PostHog with standardized identity and privacy controls.

All events are tagged with sha256(keycloak_user_id) as distinct_id, and service/environment are added automatically.

thunderbird_accounts.telemetry.hash_id(raw_id: str) str[source]

SHA-256 hash an identifier for use as a PostHog distinct_id.

thunderbird_accounts.telemetry.shutdown()[source]

Flush pending events and tear down the client.

thunderbird_accounts.telemetry.submit_event(distinct_id: str, event: str, properties: dict | None = None, service: str = 'accounts', uuid: str | None = None, timestamp: str | datetime | None = None)[source]

Submit an event to PostHog with an already-hashed distinct_id.

service/environment are added automatically. Pass uuid and timestamp (RFC3339 string or datetime) when you have a stable source-side identifier and time; PostHog dedupes on (timestamp, distinct_id, event, uuid), so this makes retries idempotent. Callers that have a raw Keycloak user id should use capture() instead so hashing is centralized.

Modules

api

client

tasks

tests

tests_keycloak

tests_stalwart

Tests for Stalwart telemetry: webhook view, user resolver, event processor.

views