thunderbird_accounts.telemetry.client

Functions

capture(event, keycloak_user_id[, ...])

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

hash_id(raw_id)

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

shutdown()

Flush pending events and tear down the client.

submit_event(distinct_id, event[, ...])

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

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

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

thunderbird_accounts.telemetry.client.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.

thunderbird_accounts.telemetry.client.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.client.shutdown()[source]

Flush pending events and tear down the client.