Skip to content

Crypto | Posthog analytics for to-device decryption errors #234

Open
@BillCarsonFr

Description

@BillCarsonFr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-E2EEA-TelemetryTelemetry / analytics to understand usageT-FeatureRequest to add a new feature which does not exist right nowTeam: Crypto

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions