Skip to content

Commit

Permalink
Add first session telemtry
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Feb 21, 2024
1 parent f7454cf commit 499b4c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/common/persistentState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class PersistentState<T> implements IPersistentState<T> {
export const GLOBAL_PERSISTENT_KEYS_DEPRECATED = 'PYTHON_EXTENSION_GLOBAL_STORAGE_KEYS';
export const WORKSPACE_PERSISTENT_KEYS_DEPRECATED = 'PYTHON_EXTENSION_WORKSPACE_STORAGE_KEYS';

const GLOBAL_PERSISTENT_KEYS = 'PYTHON_GLOBAL_STORAGE_KEYS';
export const GLOBAL_PERSISTENT_KEYS = 'PYTHON_GLOBAL_STORAGE_KEYS';
const WORKSPACE_PERSISTENT_KEYS = 'PYTHON_WORKSPACE_STORAGE_KEYS';
type KeysStorageType = 'global' | 'workspace';
export type KeysStorage = { key: string; defaultValue: unknown };
Expand Down
3 changes: 3 additions & 0 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { WorkspaceService } from './common/application/workspace';
import { disposeAll } from './common/utils/resourceLifecycle';
import { ProposedExtensionAPI } from './proposedApiTypes';
import { buildProposedApi } from './proposedApi';
import { GLOBAL_PERSISTENT_KEYS } from './common/persistentState';

durations.codeLoadingTime = stopWatch.elapsedTime;

Expand Down Expand Up @@ -116,6 +117,8 @@ async function activateUnsafe(
// activation starts here

// First we initialize.
const isFirstSession = context.globalState.get(GLOBAL_PERSISTENT_KEYS, []).length === 0;
console.log(isFirstSession);
const ext = initializeGlobals(context);
activatedServiceContainer = ext.legacyIOC.serviceContainer;
// Note standard utils especially experiment and platform code are fundamental to the extension
Expand Down
1 change: 1 addition & 0 deletions src/client/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum EventName {
FORMAT_ON_TYPE = 'FORMAT.FORMAT_ON_TYPE',
EDITOR_LOAD = 'EDITOR.LOAD',
REPL = 'REPL',
FIRST_SESSION = 'FIRST_SESSION',
CREATE_NEW_FILE_COMMAND = 'CREATE_NEW_FILE_COMMAND',
SELECT_INTERPRETER = 'SELECT_INTERPRETER',
SELECT_INTERPRETER_ENTER_BUTTON = 'SELECT_INTERPRETER_ENTER_BUTTON',
Expand Down
9 changes: 9 additions & 0 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,15 @@ export interface IEventNamePropertyMapping {
*/
selection: 'Yes' | 'Maybe later' | "Don't show again" | undefined;
};
/**
* Telemetry event sent in the very first session of the user. We check whether persistent cache is empty to figure out if it's the first session.
*/
/* __GDPR__
"first_session" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karrtikr" }
}
*/
[EventName.FIRST_SESSION]: never | undefined;
/**
* Telemetry event sent when starting REPL
*/
Expand Down

0 comments on commit 499b4c1

Please sign in to comment.