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" ;
@@ -31,26 +32,6 @@ export default createPlugin(
3132 payload : {
3233 namespace : "onboarding" ,
3334 origin : origin_trigger ,
34- expected_steps : [
35- {
36- name : "emulator_installed" ,
37- is_first_step : true ,
38- is_last_step : false ,
39- position : 1 ,
40- } ,
41- {
42- name : "auth_token_configured" ,
43- is_first_step : false ,
44- is_last_step : false ,
45- position : 2 ,
46- } ,
47- {
48- name : "aws_profile_configured" ,
49- is_first_step : false ,
50- is_last_step : true ,
51- position : 3 ,
52- } ,
53- ] ,
5435 } ,
5536 } ) ;
5637
@@ -77,7 +58,7 @@ export default createPlugin(
7758 payload : {
7859 namespace : "onboarding" ,
7960 origin : origin_trigger ,
80- position : 1 ,
61+ step_order : 1 ,
8162 started_at : installationStartedAt ,
8263 ended_at : new Date ( ) . toISOString ( ) ,
8364 status : "CANCELLED" ,
@@ -98,8 +79,38 @@ export default createPlugin(
9879 name : "setup_ended" ,
9980 payload : {
10081 namespace : "onboarding" ,
101- steps : [ 1 , 2 , 3 ] ,
82+ steps : [
83+ {
84+ name : "emulator_installed" ,
85+ is_first_step : true ,
86+ is_last_step : false ,
87+ step_order : 1 ,
88+ status : "COMPLETED" ,
89+ } ,
90+ {
91+ name : "auth_token_configured" ,
92+ is_first_step : false ,
93+ is_last_step : false ,
94+ step_order : 2 ,
95+ status : "CANCELLED" ,
96+ } ,
97+ {
98+ name : "license_setup_ended" ,
99+ is_first_step : false ,
100+ is_last_step : false ,
101+ step_order : 3 ,
102+ status : "SKIPPED" ,
103+ } ,
104+ {
105+ name : "aws_profile_configured" ,
106+ is_first_step : false ,
107+ is_last_step : true ,
108+ step_order : 4 ,
109+ status : "SKIPPED" ,
110+ } ,
111+ ] ,
102112 status : "CANCELLED" ,
113+ auth_token : await readAuthToken ( ) ,
103114 } ,
104115 } ) ;
105116 return ;
@@ -113,7 +124,7 @@ export default createPlugin(
113124 payload : {
114125 namespace : "onboarding" ,
115126 origin : origin_trigger ,
116- position : 2 ,
127+ step_order : 2 ,
117128 started_at : authStartedAuthAt ,
118129 ended_at : new Date ( ) . toISOString ( ) ,
119130 status : "SKIPPED" ,
@@ -135,7 +146,7 @@ export default createPlugin(
135146 payload : {
136147 namespace : "onboarding" ,
137148 origin : origin_trigger ,
138- position : 2 ,
149+ step_order : 2 ,
139150 auth_token : authToken ,
140151 started_at : authStartedAuthAt ,
141152 ended_at : new Date ( ) . toISOString ( ) ,
@@ -156,7 +167,7 @@ export default createPlugin(
156167 payload : {
157168 namespace : "onboarding" ,
158169 origin : origin_trigger ,
159- position : 2 ,
170+ step_order : 2 ,
160171 auth_token : authToken ,
161172 started_at : authStartedAuthAt ,
162173 ended_at : new Date ( ) . toISOString ( ) ,
@@ -175,6 +186,7 @@ export default createPlugin(
175186 // then there will be no license info to be reported by `localstack license info`.
176187 // Also, an expired license could be cached.
177188 // Activating the license pre-emptively to know its state during the setup process.
189+ const licenseCheckStartedAt = new Date ( ) . toISOString ( ) ;
178190 const licenseIsValid = await minDelay (
179191 activateLicense ( outputChannel ) . then ( ( ) =>
180192 checkIsLicenseValid ( outputChannel ) ,
@@ -191,15 +203,28 @@ export default createPlugin(
191203 await activateLicenseUntilValid (
192204 outputChannel ,
193205 cancellationToken ,
206+ telemetry ,
207+ origin_trigger ,
208+ licenseCheckStartedAt ,
194209 ) ;
195210 }
196211
197212 if ( cancellationToken . isCancellationRequested ) {
213+ telemetry . track ( {
214+ name : "license_setup_ended" ,
215+ payload : {
216+ namespace : "onboarding" ,
217+ step_order : 3 ,
218+ origin : origin_trigger ,
219+ auth_token : await readAuthToken ( ) ,
220+ started_at : licenseCheckStartedAt ,
221+ ended_at : new Date ( ) . toISOString ( ) ,
222+ status : "COMPLETED" ,
223+ } ,
224+ } ) ;
198225 return ;
199226 }
200227
201- //TODO add telemetry
202-
203228 /////////////////////////////////////////////////////////////////////
204229 progress . report ( {
205230 message : "Configuring AWS profiles..." ,
@@ -234,8 +259,38 @@ export default createPlugin(
234259 name : "setup_ended" ,
235260 payload : {
236261 namespace : "onboarding" ,
237- steps : [ 1 , 2 , 3 ] ,
262+ steps : [
263+ {
264+ name : "emulator_installed" ,
265+ is_first_step : true ,
266+ is_last_step : false ,
267+ step_order : 1 ,
268+ status : "COMPLETED" ,
269+ } ,
270+ {
271+ name : "auth_token_configured" ,
272+ is_first_step : false ,
273+ is_last_step : false ,
274+ step_order : 2 ,
275+ status : "COMPLETED" ,
276+ } ,
277+ {
278+ name : "license_setup_ended" ,
279+ is_first_step : false ,
280+ is_last_step : false ,
281+ step_order : 3 ,
282+ status : "COMPLETED" ,
283+ } ,
284+ {
285+ name : "aws_profile_configured" ,
286+ is_first_step : false ,
287+ is_last_step : true ,
288+ step_order : 4 ,
289+ status : "COMPLETED" ,
290+ } ,
291+ ] ,
238292 status : "COMPLETED" ,
293+ auth_token : await readAuthToken ( ) ,
239294 } ,
240295 } ) ;
241296 } ,
0 commit comments