@@ -32,7 +32,7 @@ export type SegmentProperties = {
3232
3333type LinkClickedTelemetryEventProperties = {
3434 screen : string ;
35- link_id : string ; // eslint-disable-line camelcase
35+ link_id : string ;
3636} ;
3737
3838type ExtensionCommandRunTelemetryEventProperties = {
@@ -48,15 +48,25 @@ type DocumentEditedTelemetryEventProperties = {
4848 source : DocumentSource ;
4949} ;
5050
51- /* eslint-disable camelcase */
5251type QueryExportedTelemetryEventProperties = {
5352 language : string ;
5453 num_stages ?: number ;
5554 with_import_statements : boolean ;
5655 with_builders : boolean ;
5756 with_driver_syntax : boolean ;
5857} ;
59- /* eslint-enable camelcase */
58+
59+ type PlaygroundCreatedTelemetryEventProperties = {
60+ playground_type : string ;
61+ } ;
62+
63+ type PlaygroundSavedTelemetryEventProperties = {
64+ file_type ?: string ;
65+ } ;
66+
67+ type PlaygroundLoadedTelemetryEventProperties = {
68+ file_type ?: string ;
69+ } ;
6070
6171export type TelemetryEventProperties =
6272 | PlaygroundTelemetryEventProperties
@@ -65,7 +75,10 @@ export type TelemetryEventProperties =
6575 | NewConnectionTelemetryEventProperties
6676 | DocumentUpdatedTelemetryEventProperties
6777 | DocumentEditedTelemetryEventProperties
68- | QueryExportedTelemetryEventProperties ;
78+ | QueryExportedTelemetryEventProperties
79+ | PlaygroundCreatedTelemetryEventProperties
80+ | PlaygroundSavedTelemetryEventProperties
81+ | PlaygroundLoadedTelemetryEventProperties ;
6982
7083export enum TelemetryEventTypes {
7184 PLAYGROUND_CODE_EXECUTED = 'Playground Code Executed' ,
@@ -78,6 +91,7 @@ export enum TelemetryEventTypes {
7891 DOCUMENT_EDITED = 'Document Edited' ,
7992 QUERY_EXPORTED = 'Query Exported' ,
8093 AGGREGATION_EXPORTED = 'Aggregation Exported' ,
94+ PLAYGROUND_CREATED = 'Playground Created' ,
8195}
8296
8397/**
@@ -117,11 +131,11 @@ export default class TelemetryService {
117131 const constantsFile = fs . readFileSync ( segmentKeyFileLocation , 'utf8' ) ;
118132 const constants = JSON . parse ( constantsFile ) as { segmentKey : string } ;
119133
120- log . info ( 'SegmentKey received ' , { type : typeof constants . segmentKey } ) ;
134+ log . info ( 'SegmentKey was found ' , { type : typeof constants . segmentKey } ) ;
121135
122136 return constants . segmentKey ;
123137 } catch ( error ) {
124- log . error ( 'Reading SegmentKey failed ' , error ) ;
138+ log . error ( 'SegmentKey was not found ' , error ) ;
125139 return ;
126140 }
127141 }
@@ -183,7 +197,7 @@ export default class TelemetryService {
183197 if ( error ) {
184198 log . error ( 'Failed to track telemetry' , error ) ;
185199 } else {
186- log . info ( 'Telemetry sent' , error ) ;
200+ log . info ( 'Telemetry sent' , segmentProperties ) ;
187201 }
188202 } ) ;
189203 }
@@ -285,12 +299,16 @@ export default class TelemetryService {
285299 } ) ;
286300 }
287301
288- trackPlaygroundLoaded ( ) : void {
289- this . track ( TelemetryEventTypes . PLAYGROUND_LOADED ) ;
302+ trackPlaygroundLoaded ( fileType ?: string ) : void {
303+ this . track ( TelemetryEventTypes . PLAYGROUND_LOADED , {
304+ file_type : fileType ,
305+ } ) ;
290306 }
291307
292- trackPlaygroundSaved ( ) : void {
293- this . track ( TelemetryEventTypes . PLAYGROUND_SAVED ) ;
308+ trackPlaygroundSaved ( fileType ?: string ) : void {
309+ this . track ( TelemetryEventTypes . PLAYGROUND_SAVED , {
310+ file_type : fileType ,
311+ } ) ;
294312 }
295313
296314 trackDocumentUpdated ( source : DocumentSource , success : boolean ) : void {
@@ -312,4 +330,10 @@ export default class TelemetryService {
312330 ) : void {
313331 this . track ( TelemetryEventTypes . AGGREGATION_EXPORTED , aggExportedProps ) ;
314332 }
333+
334+ trackPlaygroundCreated ( playgroundType : string ) : void {
335+ this . track ( TelemetryEventTypes . PLAYGROUND_CREATED , {
336+ playground_type : playgroundType ,
337+ } ) ;
338+ }
315339}
0 commit comments