Crypto | Posthog analytics for to-device decryption errors #234
Labels
A-E2EE
A-Telemetry
Telemetry / analytics to understand usage
T-Feature
Request to add a new feature which does not exist right now
Team: Crypto
There are various failure modes that can lead to failures to decrypt to-device messages, which will then almost inevitably lead to UTD errors of some sort. Currently, these are not reported in Posthog, so we lack visibility into how often they happen.
See also #2409 which covers analytics for the sending side.
Implementation design
matrix-org/matrix-analytics-events#56 did some groundwork here, by adding a new
domain
ofTO_DEVICE
, and aname
ofToDeviceFailedToDecrypt
, to the properties of the currentError
event. However,ToDeviceFailedToDecrypt
seems insufficiently specific, and instead we need a number of newnames
.As a first pass, I suggest adding a new
name
for each type ofOlmError
in matrix-crypto-sdk (https://github.com/matrix-org/matrix-rust-sdk/blob/main/crates/matrix-sdk-crypto/src/error.rs), with a prefix ofToDeviceFailedToDecrypt_
.There is also an optional freeform string field
context
, though its purpose seems a bit unclear. I suggest not using it for now.So an example event would be:
I think probably the best way to implement this is to add a method
OlmMachine::to_device_decryption_failure_stream
, which returns aStream
, and each timeOlmMachine::decrypt_to_device_event
fails, we write a new entry to the stream. The stream could then be wrapped in both (Rust) matrix-sdk and matrix-js-sdk, for turning into Posthog events.Sub-tasks
Name
s forErrorEvent
in matrix-analytics-eventsOlmMachine::to_device_decryption_failure_stream
tomatrix-sdk-crypto
matrix-sdk
to turn failures into posthog eventsThe text was updated successfully, but these errors were encountered: