Skip to content

Commit

Permalink
fix(core): warn about missing metrics only once
Browse files Browse the repository at this point in the history
  • Loading branch information
Malinskiy committed Aug 13, 2023
1 parent b622e54 commit 9c797fe
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class MetricsProviderImpl(private val remoteDataStore: RemoteDataSource) : Metri

val testName = test.toSafeTestName()
return successRateMeasurements[key]?.get(testName) ?: {
logger.warn { "No success rate found for $testName. Using 0 i.e. fails all the time" }
if (!warningSuccessRateTimeReported.contains(testName)) {
logger.warn { "No success rate found for $testName. Using 0 i.e. fails all the time" }
warningSuccessRateTimeReported.add(testName)
}
0.0
}()
}
Expand Down Expand Up @@ -77,11 +80,17 @@ class MetricsProviderImpl(private val remoteDataStore: RemoteDataSource) : Metri
}
val testName = test.toSafeTestName()
return executionTimeMeasurements[key]?.get(testName) ?: {
logger.warn { "No execution time found for $testName. Using 300_000 seconds i.e. long test" }
if (!warningExecutionTimeReported.contains(testName)) {
logger.warn { "No execution time found for $testName. Using 300_000 seconds i.e. long test" }
warningExecutionTimeReported.add(testName)
}
300_000.0
}()
}

private val warningExecutionTimeReported = hashSetOf<String>()
private val warningSuccessRateTimeReported = hashSetOf<String>()

private fun fetchExecutionTime(percentile: Double, limit: Instant) = runBlocking {
withRetry(3, RETRY_DELAY) {
remoteDataStore.requestAllExecutionTimes(percentile, limit)
Expand Down

0 comments on commit 9c797fe

Please sign in to comment.