You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: There is a function called `setupTelemetryId` which syncs the client Id between the two extensions when both are installed. However, there is a race condition that causes toolkit to generate the client ID before calling this setup function. The result is that amazon q is signalled to update its client id with a fresh one from toolkit. This results in telemetry showing we have a new user even though that is not the case.
Solution: Bypass this race condition by putting the logic in the client id generation function. We will also change how we compute the client ID so that extensions more intuitively converge to the same client id.
See code for computation docs.
Cases:
1. New user installs an extension -> client id is generated once and stored in global state
2. Existing extension user installs another extension -> new extension will fetch the client id from the first extension via env variables, and store it itself
3. Existing users of both extensions update to the newer versions -> client ids were already synced between extensions, so they will store their identical client ids to themselves and env variables
There is an edge case that will still result in a failure:
4. Existing extension user installs another extension manually while vscode is closed -> the new extension loads first and stores its fresh client id in environment variables. The first extension will see this and update its client id to the new one, resulting in the original issue.
This is unavoidable because:
- Extensions can load in arbitrary orders
- There is no way to know which extension's client ID is the one to use unless we check which one has something stored in its global state already.
- This requires the new extension to ask the old extension, so it must be initialized already.
- While waiting for this request, either extension could already start emitting telemetry. It has also already initialized a bunch of internal memory states with the other client id.
- Creating a local file will only help if the file pre-exists. Users updating to this version will have no file to determine from.
- We want to preserve current client IDs
0 commit comments