Skip to content

Commit 02e6cbd

Browse files
Added a metric to record number of retry attempts for Filesystem test (#3466)
* Improving the Dev environment launch time by removing Filesystem test * fixed detekt issues * Added a metric to record number of retry attempts for fileSystem check * Addressed feedback comments on PR --------- Co-authored-by: manodnyab <[email protected]>
1 parent 382c674 commit 02e6cbd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

jetbrains-gateway/src/software/aws/toolkits/jetbrains/gateway/CawsConnectionProvider.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ class CawsConnectionProvider : GatewayConnectionProvider {
197197
return@startUnderModalProgressAsync JLabel()
198198
}
199199

200+
val start = System.currentTimeMillis()
201+
var attemptCount = 0
200202
val fsTestTime = measureTimeMillis {
201203
val attempts = 15
202204
run repeatBlock@{
@@ -208,6 +210,7 @@ class CawsConnectionProvider : GatewayConnectionProvider {
208210
)
209211

210212
LOG.debug { "$testFs" }
213+
attemptCount = it + 1
211214
when (testFs.resultFromStdOut()) {
212215
StdOutResult.SUCCESS -> {
213216
LOG.info { "Filesystem writablity test succeeded for $pluginPath on attempt $it" }
@@ -226,11 +229,27 @@ class CawsConnectionProvider : GatewayConnectionProvider {
226229
}
227230

228231
if (it == attempts - 1) {
232+
CodecatalystTelemetry.devEnvironmentWorkflowStatistic(
233+
project = null,
234+
userId = userId,
235+
result = TelemetryResult.Failed,
236+
duration = (System.currentTimeMillis() - start).toDouble(),
237+
codecatalystDevEnvironmentWorkflowStep = "fileSystemCheck",
238+
value = attemptCount.toDouble()
239+
)
229240
error("Dev Environment did not have a writable filesystem after $attempts attempts")
230241
}
231242
}
232243
}
233244
}
245+
CodecatalystTelemetry.devEnvironmentWorkflowStatistic(
246+
project = null,
247+
userId = userId,
248+
result = TelemetryResult.Succeeded,
249+
duration = fsTestTime.toDouble(),
250+
codecatalystDevEnvironmentWorkflowStep = "fileSystemCheck",
251+
value = attemptCount.toDouble()
252+
)
234253
LOG.info { "FS test took ${fsTestTime}ms" }
235254

236255
runBackendWorkflow(

0 commit comments

Comments
 (0)