Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kkmurerwa opened this issue Feb 14, 2024 · 4 comments · May be fixed by #5552
Open

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

kkmurerwa opened this issue Feb 14, 2024 · 4 comments · May be fixed by #5552
Assignees
Labels
enhancement End user-perceivable enhancements. Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet.

Comments

@kkmurerwa
Copy link
Collaborator

kkmurerwa commented Feb 14, 2024

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 kkmurerwa added enhancement End user-perceivable enhancements. triage needed labels Feb 14, 2024
@seanlip seanlip changed the title [Feature Request]: SessionID and UUID should part of all logs [Feature Request]: SessionID and UUID should be part of all logs Feb 17, 2024
@adhiamboperes adhiamboperes removed their assignment Mar 12, 2024
@adhiamboperes adhiamboperes added Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. labels Mar 12, 2024
@pradyuman04
Copy link

Can I start work on this issue?

@adhiamboperes
Copy link
Collaborator

@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.

@subhajitxyz
Copy link
Collaborator

Hi @adhiamboperes , can I work on this issue?

@BenHenning
Copy link
Member

From discussion, it sounds like we need to re-derive the ID algorithm since we've lost access to the document.

@kennethmurerwa can you please mention how we can implement an ID generator as needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement End user-perceivable enhancements. Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet.
6 participants