55 checkIsAuthenticated ,
66 requestAuthentication ,
77 saveAuthToken ,
8+ readAuthToken ,
89} from "../utils/authenticate.ts" ;
910import { configureAwsProfiles } from "../utils/configure-aws.ts" ;
1011import { runInstallProcess } from "../utils/install.ts" ;
@@ -38,26 +39,6 @@ export default createPlugin(
3839 payload : {
3940 namespace : "onboarding" ,
4041 origin : origin_trigger ,
41- expected_steps : [
42- {
43- name : "emulator_installed" ,
44- is_first_step : true ,
45- is_last_step : false ,
46- position : 1 ,
47- } ,
48- {
49- name : "auth_token_configured" ,
50- is_first_step : false ,
51- is_last_step : false ,
52- position : 2 ,
53- } ,
54- {
55- name : "aws_profile_configured" ,
56- is_first_step : false ,
57- is_last_step : true ,
58- position : 3 ,
59- } ,
60- ] ,
6142 } ,
6243 } ) ;
6344
@@ -84,7 +65,7 @@ export default createPlugin(
8465 payload : {
8566 namespace : "onboarding" ,
8667 origin : origin_trigger ,
87- position : 1 ,
68+ step_order : 1 ,
8869 started_at : installationStartedAt ,
8970 ended_at : new Date ( ) . toISOString ( ) ,
9071 status : "CANCELLED" ,
@@ -113,8 +94,38 @@ export default createPlugin(
11394 name : "setup_ended" ,
11495 payload : {
11596 namespace : "onboarding" ,
116- steps : [ 1 , 2 , 3 ] ,
97+ steps : [
98+ {
99+ name : "emulator_installed" ,
100+ is_first_step : true ,
101+ is_last_step : false ,
102+ step_order : 1 ,
103+ status : "COMPLETED" ,
104+ } ,
105+ {
106+ name : "auth_token_configured" ,
107+ is_first_step : false ,
108+ is_last_step : false ,
109+ step_order : 2 ,
110+ status : "CANCELLED" ,
111+ } ,
112+ {
113+ name : "license_setup_ended" ,
114+ is_first_step : false ,
115+ is_last_step : false ,
116+ step_order : 3 ,
117+ status : "SKIPPED" ,
118+ } ,
119+ {
120+ name : "aws_profile_configured" ,
121+ is_first_step : false ,
122+ is_last_step : true ,
123+ step_order : 4 ,
124+ status : "SKIPPED" ,
125+ } ,
126+ ] ,
117127 status : "CANCELLED" ,
128+ auth_token : await readAuthToken ( ) ,
118129 } ,
119130 } ) ;
120131 return ;
@@ -128,7 +139,7 @@ export default createPlugin(
128139 payload : {
129140 namespace : "onboarding" ,
130141 origin : origin_trigger ,
131- position : 2 ,
142+ step_order : 2 ,
132143 started_at : authStartedAuthAt ,
133144 ended_at : new Date ( ) . toISOString ( ) ,
134145 status : "SKIPPED" ,
@@ -153,7 +164,7 @@ export default createPlugin(
153164 payload : {
154165 namespace : "onboarding" ,
155166 origin : origin_trigger ,
156- position : 2 ,
167+ step_order : 2 ,
157168 auth_token : authToken ,
158169 started_at : authStartedAuthAt ,
159170 ended_at : new Date ( ) . toISOString ( ) ,
@@ -174,7 +185,7 @@ export default createPlugin(
174185 payload : {
175186 namespace : "onboarding" ,
176187 origin : origin_trigger ,
177- position : 2 ,
188+ step_order : 2 ,
178189 auth_token : authToken ,
179190 started_at : authStartedAuthAt ,
180191 ended_at : new Date ( ) . toISOString ( ) ,
@@ -193,6 +204,7 @@ export default createPlugin(
193204 // then there will be no license info to be reported by `localstack license info`.
194205 // Also, an expired license could be cached.
195206 // Activating the license pre-emptively to know its state during the setup process.
207+ const licenseCheckStartedAt = new Date ( ) . toISOString ( ) ;
196208 const licenseIsValid = await minDelay (
197209 activateLicense ( outputChannel ) . then ( ( ) =>
198210 checkIsLicenseValid ( outputChannel ) ,
@@ -209,15 +221,28 @@ export default createPlugin(
209221 await activateLicenseUntilValid (
210222 outputChannel ,
211223 cancellationToken ,
224+ telemetry ,
225+ origin_trigger ,
226+ licenseCheckStartedAt ,
212227 ) ;
213228 }
214229
215230 if ( cancellationToken . isCancellationRequested ) {
231+ telemetry . track ( {
232+ name : "license_setup_ended" ,
233+ payload : {
234+ namespace : "onboarding" ,
235+ step_order : 3 ,
236+ origin : origin_trigger ,
237+ auth_token : await readAuthToken ( ) ,
238+ started_at : licenseCheckStartedAt ,
239+ ended_at : new Date ( ) . toISOString ( ) ,
240+ status : "COMPLETED" ,
241+ } ,
242+ } ) ;
216243 return ;
217244 }
218245
219- //TODO add telemetry
220-
221246 /////////////////////////////////////////////////////////////////////
222247 progress . report ( {
223248 message : "Configuring AWS profiles..." ,
@@ -284,8 +309,38 @@ export default createPlugin(
284309 name : "setup_ended" ,
285310 payload : {
286311 namespace : "onboarding" ,
287- steps : [ 1 , 2 , 3 ] ,
312+ steps : [
313+ {
314+ name : "emulator_installed" ,
315+ is_first_step : true ,
316+ is_last_step : false ,
317+ step_order : 1 ,
318+ status : "COMPLETED" ,
319+ } ,
320+ {
321+ name : "auth_token_configured" ,
322+ is_first_step : false ,
323+ is_last_step : false ,
324+ step_order : 2 ,
325+ status : "COMPLETED" ,
326+ } ,
327+ {
328+ name : "license_setup_ended" ,
329+ is_first_step : false ,
330+ is_last_step : false ,
331+ step_order : 3 ,
332+ status : "COMPLETED" ,
333+ } ,
334+ {
335+ name : "aws_profile_configured" ,
336+ is_first_step : false ,
337+ is_last_step : true ,
338+ step_order : 4 ,
339+ status : "COMPLETED" ,
340+ } ,
341+ ] ,
288342 status : "COMPLETED" ,
343+ auth_token : await readAuthToken ( ) ,
289344 } ,
290345 } ) ;
291346 } ,
0 commit comments