oppia-android icon indicating copy to clipboard operation
oppia-android copied to clipboard

[Feature Request]: SessionID and UUID should be part of all logs

Open kkmurerwa opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

When merged, #5240 will introduce the ability to log feature flags at the beginning of every app session. Each unique session and feature flag log is identified by a unique UUID and an app session ID.

Currently, a UUID does not exist and will need to be created as per the rules dictated in the section below.

Once that is done, in order to track logs and crashes during the session, we will need to add an app session ID and a UUID to each log made on the app.

UUID Generation

In order to uniquely track each individual user, we will need to generate a statistically unique UUID for every user. This is because UUIDs will be generated on each user's device and we have to ensure that each UUID is unique enough to avoid collisions. In order to to this, we will create a custom algorithm based on the Twitter Snowflake algorithm.

For this purpose, we will generate a 64-bit UUID with the following bit division;

  • 1 bit - Signed bit that will be switched on in 2038 to fix the Year 2038 problem. In the meantime, this bit will always be 0.
  • 41 bits - Timestamp representation of the UTC time of generation of the UUID.
  • 22 bits - Random number to increase the uniqueness of the UUID generated.

UUID Persistence

It is also important to persist the UUID once it has been generated on a per-user basis. Once a UUID has been generated, it should be persisted in the Cache Store. A check should be made every time a profile is launched to retrieve the UUID and optionally generate one if it does not exist.

Describe the solution you'd like

Every log should include an app session ID and a UUID. The two will be created using the modified Twitter Snowflake algorithm as detailed above. The UUID will help collect logs made in the same session by the same user.

It is important to note that the app session ID is already being populated with a pseudo-random value generated by the LoggingIdentifierController and the generation of this value will need to be switched to the modified Twitter Snowflake algorithm once it has been implemented.

Describe alternatives you've considered

No response

Additional context

No response

kkmurerwa avatar Feb 14 '24 07:02 kkmurerwa

Can I start work on this issue?

pradyuman04 avatar Mar 13 '24 09:03 pradyuman04

@pradyuman04, as a first time contributor, it would be great to begin with starter issues from https://github.com/oppia/oppia-android/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 in order to farmiliarize with the codebase, then you could proceed to something like this.

adhiamboperes avatar Mar 13 '24 17:03 adhiamboperes