File tree Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { exec } from '../services/node'
2020import { WORKSPACE_ROOT , TUTORIAL_URL } from '../environment'
2121import reset from '../services/reset'
2222import getLastCommitHash from '../services/reset/lastHash'
23+ import { onEvent } from '../services/telemetry'
2324
2425const readFileAsync = promisify ( readFile )
2526
@@ -128,6 +129,12 @@ class Channel implements Channel {
128129 try {
129130 const data : TT . Tutorial = action . payload . tutorial
130131
132+ onEvent ( 'tutorial_start' , {
133+ tutorial_id : data . id ,
134+ tutorial_version : data . version ,
135+ tutorial_title : data . summary . title ,
136+ } )
137+
131138 // validate extension version
132139 const expectedAppVersion = data . config ?. appVersions ?. vscode
133140 if ( expectedAppVersion ) {
Original file line number Diff line number Diff line change @@ -23,13 +23,17 @@ class Editor {
2323 workspaceState : this . vscodeExt . workspaceState ,
2424 } )
2525
26+ const subscribe = ( sub : any ) => {
27+ this . vscodeExt . subscriptions . push ( sub )
28+ }
29+
2630 // register commands
2731 for ( const cmd in commands ) {
2832 const command : vscode . Disposable = vscode . commands . registerCommand ( cmd , commands [ cmd ] )
29- this . vscodeExt . subscriptions . push ( command )
33+ subscribe ( command )
3034 }
3135
32- telemetry . activate ( )
36+ telemetry . activate ( subscribe )
3337 }
3438 public deactivate = ( ) : void => {
3539 // cleanup subscriptions/tasks
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const EXTENSION_ID = 'coderoad'
88// Node env
99export type Env = 'test' | 'local' | 'development' | 'production'
1010// @ts -ignore
11- export const NODE_ENV : Env = process . env . NODE_ENV || 'production '
11+ export const NODE_ENV : Env = process . env . NODE_ENV || 'development '
1212
1313// toggle logging in development
1414export const LOG = false
Original file line number Diff line number Diff line change @@ -17,9 +17,10 @@ interface Measurements {
1717
1818let reporter : any
1919
20- export const activate = ( ) : void => {
20+ export const activate = ( subscribeFn : ( reporter : any ) => void ) : void => {
2121 if ( NODE_ENV === 'production' ) {
2222 reporter = new TelemetryReporter ( EXTENSION_ID , VERSION , INSTRUMENTATION_KEY )
23+ subscribeFn ( reporter )
2324 }
2425}
2526
You can’t perform that action at this time.
0 commit comments