@@ -104,8 +104,14 @@ func (a *App) reconcileDeploy() error {
104
104
105
105
func (a * App ) reconcileFetchTemplateDeploy () exec.CmdRunResult {
106
106
reconcileStartTS := time .Now ()
107
+ a .isFirstReconcile = "false"
108
+ if a .appMetrics .GetReconcileAttemptCounterValue (a .app .Name , a .app .Namespace ) == 1 {
109
+ a .isFirstReconcile = "true"
110
+ }
111
+
107
112
defer func () {
108
- a .timeMetrics .RegisterOverallTime (a .app .Kind , a .app .Name , a .app .Namespace , "" , time .Since (reconcileStartTS ))
113
+ a .timeMetrics .RegisterOverallTime (a .app .Kind , a .app .Name , a .app .Namespace , a .isFirstReconcile ,
114
+ time .Since (reconcileStartTS ))
109
115
}()
110
116
111
117
tmpDir := memdir .NewTmpDir ("fetch-template-deploy" )
@@ -134,6 +140,9 @@ func (a *App) reconcileFetchTemplateDeploy() exec.CmdRunResult {
134
140
UpdatedAt : metav1 .NewTime (time .Now ().UTC ()),
135
141
}
136
142
143
+ a .timeMetrics .RegisterFetchTime (a .app .Kind , a .app .Name , a .app .Namespace , a .isFirstReconcile ,
144
+ a .app .Status .Fetch .UpdatedAt .Sub (a .app .Status .Fetch .StartedAt .Time ))
145
+
137
146
err := a .updateStatus ("marking fetch completed" )
138
147
if err != nil {
139
148
return exec .NewCmdRunResultWithErr (err )
@@ -144,6 +153,8 @@ func (a *App) reconcileFetchTemplateDeploy() exec.CmdRunResult {
144
153
}
145
154
}
146
155
156
+ templateStartTime := time .Now ()
157
+
147
158
tplResult := a .template (assetsPath )
148
159
149
160
a .app .Status .Template = & v1alpha1.AppStatusTemplate {
@@ -153,6 +164,9 @@ func (a *App) reconcileFetchTemplateDeploy() exec.CmdRunResult {
153
164
UpdatedAt : metav1 .NewTime (time .Now ().UTC ()),
154
165
}
155
166
167
+ a .timeMetrics .RegisterTemplateTime (a .app .Kind , a .app .Name , a .app .Namespace , a .isFirstReconcile ,
168
+ a .app .Status .Template .UpdatedAt .Sub (templateStartTime ))
169
+
156
170
err = a .updateStatus ("marking template completed" )
157
171
if err != nil {
158
172
return exec .NewCmdRunResultWithErr (err )
@@ -201,6 +215,9 @@ func (a *App) updateLastDeploy(result exec.CmdRunResult) exec.CmdRunResult {
201
215
},
202
216
}
203
217
218
+ a .timeMetrics .RegisterDeployTime (a .app .Kind , a .app .Name , a .app .Namespace , a .isFirstReconcile ,
219
+ a .Status ().Deploy .UpdatedAt .Sub (a .Status ().Deploy .StartedAt .Time ))
220
+
204
221
return result
205
222
}
206
223
0 commit comments