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

feat: introduce telemetry #33

Merged
merged 12 commits into from
Aug 22, 2023
Merged

feat: introduce telemetry #33

merged 12 commits into from
Aug 22, 2023

Conversation

f1ames
Copy link
Contributor

@f1ames f1ames commented Aug 21, 2023

This PR fixes #24.

Based on #31 and should be merged after it.

Changes

  • Introduced Telemetry, see below for events list with properties.
  • Added enableTelemetry config option (trueby default).
  • Was inspired by Desktop, so we have install and session events based on similar logic as Desktop has.
  • Used machineId provided by VSC env.
  • Each event also sends native VSC sessionId. This can be used to group all events from single session (new session is when VSC instance is started/restarted).
  • There is VSC native TelemetryLogger, but I realized a bit too late. Still I think what we have now is quite stable and good enough for now.

export type EventStatus = 'started' | 'success' | 'failure' | 'cancelled';
export type BaseEvent = {status: EventStatus, error?: string};
export type Event = keyof EventMap;
export type EventMap = {
'ext/installed': BaseEvent & {appVersion: string; deviceOS: NodeJS.Platform};
'ext/session': BaseEvent & {appVersion: string, startTimeMs: number};
'ext/session_end': BaseEvent & {endTimeMs: number, timeSpentSec: number};
'command/login': BaseEvent & {method?: string};
'command/logout': BaseEvent;
'command/validate': BaseEvent & {rootCount?: number};
'command/show_panel': BaseEvent;
'command/show_configuration': BaseEvent & {configurationType?: string};
'command/bootstrap_configuration': BaseEvent & {configurationType?: string};
'command/synchronize': BaseEvent;
'config/change': BaseEvent & {name: string; value: string};
// When new folder is added/removed to/from VSC workspace.
'workspace/change': BaseEvent & {rootCount: number};
// When validation is completed for a workspace, usually triggered by file modification.
'workspace/validate': BaseEvent & {
resourceCount?: number,
configurationType?: string,
isValidConfiguration?: boolean,
validationWarnings?: number,
validationErrors?: number,
};
// When policy is synced from Monokle Cloud.
'policy/synchronize': BaseEvent & {errorCode?: string};
};

Fixes

  • None.

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@f1ames f1ames force-pushed the f1ames/fix/28-error-improvements branch from 012a58a to 86141fb Compare August 21, 2023 14:50
@f1ames f1ames force-pushed the f1ames/feat/24-telemetry branch 2 times, most recently from 4fa3f8f to 6e052e7 Compare August 21, 2023 15:07
@f1ames f1ames marked this pull request as ready for review August 21, 2023 15:08
@f1ames f1ames requested a review from olensmar August 21, 2023 15:09
Copy link
Member

@devcatalin devcatalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@f1ames f1ames force-pushed the f1ames/fix/28-error-improvements branch from a15285e to 9bf5849 Compare August 22, 2023 10:22
Base automatically changed from f1ames/fix/28-error-improvements to main August 22, 2023 10:27
@f1ames f1ames force-pushed the f1ames/feat/24-telemetry branch from 6e052e7 to 2db8d5e Compare August 22, 2023 10:28
@f1ames
Copy link
Contributor Author

f1ames commented Aug 22, 2023

I rechecked if we can send telemetry events differently, so properties are split in MixPanel instead of being shown as single property, but it seems this is how @segment/analytics-node works and there is no easy way to change it.

@f1ames f1ames merged commit 24f979b into main Aug 22, 2023
@f1ames f1ames deleted the f1ames/feat/24-telemetry branch August 22, 2023 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usage Telemetry
2 participants