@@ -32,7 +32,7 @@ export type SegmentProperties = {
32
32
33
33
type LinkClickedTelemetryEventProperties = {
34
34
screen : string ;
35
- link_id : string ; // eslint-disable-line camelcase
35
+ link_id : string ;
36
36
} ;
37
37
38
38
type ExtensionCommandRunTelemetryEventProperties = {
@@ -48,15 +48,25 @@ type DocumentEditedTelemetryEventProperties = {
48
48
source : DocumentSource ;
49
49
} ;
50
50
51
- /* eslint-disable camelcase */
52
51
type QueryExportedTelemetryEventProperties = {
53
52
language : string ;
54
53
num_stages ?: number ;
55
54
with_import_statements : boolean ;
56
55
with_builders : boolean ;
57
56
with_driver_syntax : boolean ;
58
57
} ;
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
+ } ;
60
70
61
71
export type TelemetryEventProperties =
62
72
| PlaygroundTelemetryEventProperties
@@ -65,7 +75,10 @@ export type TelemetryEventProperties =
65
75
| NewConnectionTelemetryEventProperties
66
76
| DocumentUpdatedTelemetryEventProperties
67
77
| DocumentEditedTelemetryEventProperties
68
- | QueryExportedTelemetryEventProperties ;
78
+ | QueryExportedTelemetryEventProperties
79
+ | PlaygroundCreatedTelemetryEventProperties
80
+ | PlaygroundSavedTelemetryEventProperties
81
+ | PlaygroundLoadedTelemetryEventProperties ;
69
82
70
83
export enum TelemetryEventTypes {
71
84
PLAYGROUND_CODE_EXECUTED = 'Playground Code Executed' ,
@@ -78,6 +91,7 @@ export enum TelemetryEventTypes {
78
91
DOCUMENT_EDITED = 'Document Edited' ,
79
92
QUERY_EXPORTED = 'Query Exported' ,
80
93
AGGREGATION_EXPORTED = 'Aggregation Exported' ,
94
+ PLAYGROUND_CREATED = 'Playground Created' ,
81
95
}
82
96
83
97
/**
@@ -117,11 +131,11 @@ export default class TelemetryService {
117
131
const constantsFile = fs . readFileSync ( segmentKeyFileLocation , 'utf8' ) ;
118
132
const constants = JSON . parse ( constantsFile ) as { segmentKey : string } ;
119
133
120
- log . info ( 'SegmentKey received ' , { type : typeof constants . segmentKey } ) ;
134
+ log . info ( 'SegmentKey was found ' , { type : typeof constants . segmentKey } ) ;
121
135
122
136
return constants . segmentKey ;
123
137
} catch ( error ) {
124
- log . error ( 'Reading SegmentKey failed ' , error ) ;
138
+ log . error ( 'SegmentKey was not found ' , error ) ;
125
139
return ;
126
140
}
127
141
}
@@ -183,7 +197,7 @@ export default class TelemetryService {
183
197
if ( error ) {
184
198
log . error ( 'Failed to track telemetry' , error ) ;
185
199
} else {
186
- log . info ( 'Telemetry sent' , error ) ;
200
+ log . info ( 'Telemetry sent' , segmentProperties ) ;
187
201
}
188
202
} ) ;
189
203
}
@@ -285,12 +299,16 @@ export default class TelemetryService {
285
299
} ) ;
286
300
}
287
301
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
+ } ) ;
290
306
}
291
307
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
+ } ) ;
294
312
}
295
313
296
314
trackDocumentUpdated ( source : DocumentSource , success : boolean ) : void {
@@ -312,4 +330,10 @@ export default class TelemetryService {
312
330
) : void {
313
331
this . track ( TelemetryEventTypes . AGGREGATION_EXPORTED , aggExportedProps ) ;
314
332
}
333
+
334
+ trackPlaygroundCreated ( playgroundType : string ) : void {
335
+ this . track ( TelemetryEventTypes . PLAYGROUND_CREATED , {
336
+ playground_type : playgroundType ,
337
+ } ) ;
338
+ }
315
339
}
0 commit comments