Description
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
of TO_DEVICE
, and a name
of ToDeviceFailedToDecrypt
, to the properties of the current Error
event. However, ToDeviceFailedToDecrypt
seems insufficiently specific, and instead we need a number of new names
.
As a first pass, I suggest adding a new name
for each type of OlmError
in matrix-crypto-sdk (https://github.com/matrix-org/matrix-rust-sdk/blob/main/crates/matrix-sdk-crypto/src/error.rs), with a prefix of ToDeviceFailedToDecrypt_
.
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:
{
"event": "Error",
"properties": {
"domain": "TO_DEVICE",
"name": "ToDeviceFailedToDecrypt_SessionWedged",
"cryptoSDK": "Rust",
}
}
I think probably the best way to implement this is to add a method OlmMachine::to_device_decryption_failure_stream
, which returns a Stream
, and each time OlmMachine::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
- Add more
Name
s forErrorEvent
in matrix-analytics-events - Add
OlmMachine::to_device_decryption_failure_stream
tomatrix-sdk-crypto
- Add support in
matrix-sdk
to turn failures into posthog events - Crypto | Basic analytics for to_device olm decryption failure element-web#22016
- Crypto | Basic analytics for to_device olm decyption failure element-android#5889
- Crypto | Basic analytics for to_device olm decyption failure element-ios#6097