fix: NCS-84 More Verbose Logging (#51)
Build & Test (NowChessSystems) TeamCity build failed

Reviewed-on: #51
This commit was merged in pull request #51.
This commit is contained in:
2026-05-16 11:20:05 +02:00
parent c65a1393b9
commit 4ad92ab236
9 changed files with 18 additions and 18 deletions
@@ -79,7 +79,7 @@ class OfficialChallengeResource:
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ErrorDto(err)).build()
case Right(id) =>
try botEventPublisher.publishGameStart(bot.name, id, botColor, difficulty, bot.id.toString)
catch case ex: Exception => log.warnf(ex, "Failed to notify bot for game %s", id)
catch case ex: Exception => log.errorf(ex, "Failed to notify bot for game %s", id)
Response
.status(Response.Status.CREATED)
.entity(OfficialChallengeResponse(id, botName, difficulty))
@@ -95,7 +95,7 @@ class ChallengeService:
challenge.expiresAt = Instant.now().plus(24, ChronoUnit.HOURS)
challengeRepository.persist(challenge)
try eventPublisher.publishChallengeCreated(destUser.id.toString, challenge.id.toString, challenger.username)
catch case ex: Exception => log.warnf(ex, "Failed to notify dest user for challenge %s", challenge.id)
catch case ex: Exception => log.errorf(ex, "Failed to notify dest user for challenge %s", challenge.id)
challenge
@Transactional
@@ -116,7 +116,7 @@ class ChallengeService:
challengeRepository.merge(challenge)
notifyBotIfNeeded(challenge, gameId)
try eventPublisher.publishChallengeAccepted(challenge.challenger.id.toString, challenge.id.toString, gameId)
catch case ex: Exception => log.warnf(ex, "Failed to notify challenger for game %s", gameId)
catch case ex: Exception => log.errorf(ex, "Failed to notify challenger for game %s", gameId)
challenge
@Transactional
@@ -167,7 +167,7 @@ class AutoScaler:
catch
case ex: Exception =>
meterRegistry.counter("nowchess.coordinator.scale.failures", "direction", "up").increment()
log.warnf(ex, "Failed to scale up %s", config.k8sRolloutName)
log.errorf(ex, "Failed to scale up %s", config.k8sRolloutName)
def scaleDown(): Unit =
log.info("Scaling down Argo Rollout")
@@ -225,4 +225,4 @@ class AutoScaler:
catch
case ex: Exception =>
meterRegistry.counter("nowchess.coordinator.scale.failures", "direction", "down").increment()
log.warnf(ex, "Failed to scale down %s", config.k8sRolloutName)
log.errorf(ex, "Failed to scale down %s", config.k8sRolloutName)
@@ -80,14 +80,14 @@ class CacheEvictionManager:
count + 1
catch
case ex: Exception =>
log.warnf(ex, "Failed to evict game %s", gameId)
log.errorf(ex, "Failed to evict game %s", gameId)
count
}
else count
}
catch
case ex: Exception =>
log.warnf(ex, "Error processing game key %s", key)
log.errorf(ex, "Error processing game key %s", key)
count
}
@@ -112,7 +112,7 @@ class FailoverService:
else false
catch
case ex: Exception =>
log.warnf(ex, "Failed to migrate batch to %s, trying next", target.instanceId)
log.errorf(ex, "Failed to migrate batch to %s, trying next", target.instanceId)
false
if success then true else tryMigrateBatch(batch, batchIdx, instances, deadId, attempt + 1)
@@ -192,7 +192,7 @@ class HealthMonitor:
log.debugf("No pod found for instance %s, skipping deletion", instanceId)
catch
case ex: Exception =>
log.warnf(
log.errorf(
ex,
"Failed to delete pod for instance %s — removing from registry to prevent blocking scale-down",
instanceId,
@@ -99,7 +99,7 @@ class InstanceRegistry:
}
catch
case ex: Exception =>
log.warnf(ex, "Failed to parse instance metadata for %s — removing from registry", instanceId)
log.errorf(ex, "Failed to parse instance metadata for %s — removing from registry", instanceId)
instances.remove(instanceId)
meterRegistry.counter("nowchess.coordinator.instances.removed").increment()
Uni.createFrom().item(())
@@ -96,14 +96,14 @@ class LoadBalancer:
log.infof("Moved %d games from %s to %s", subscribed, over.instanceId, target.instanceId)
catch
case ex: Exception =>
log.warnf(ex, "Failed to move games from %s to %s", over.instanceId, target.instanceId)
log.errorf(ex, "Failed to move games from %s to %s", over.instanceId, target.instanceId)
}
val elapsed = System.currentTimeMillis() - startTime
log.infof("Rebalance completed in %dms", elapsed)
catch
case ex: Exception =>
log.warnf(ex, "Rebalance failed")
log.errorf(ex, "Rebalance failed")
private def getGamesToMove(instanceId: String, count: Int): List[String] =
try
@@ -125,7 +125,7 @@ class LoadBalancer:
}
catch
case ex: Exception =>
log.warnf(ex, "Failed to update Redis game sets")
log.errorf(ex, "Failed to update Redis game sets")
@Scheduled(every = "30s")
def periodicRebalanceCheck(): Unit =
@@ -25,7 +25,7 @@ class IoGrpcClientWrapper:
CombinedExportResponse(combined.getFen, combined.getPgn)
catch
case ex: Exception =>
log.warnf(ex, "IO gRPC exportCombined failed")
log.errorf(ex, "IO gRPC exportCombined failed")
// scalafix:off DisableSyntax.throw
throw ex
// scalafix:on DisableSyntax.throw
@@ -34,7 +34,7 @@ class IoGrpcClientWrapper:
try CoreProtoMapper.fromProtoGameContext(stub.importFen(ProtoImportFenRequest.newBuilder().setFen(fen).build()))
catch
case ex: Exception =>
log.warnf(ex, "IO gRPC importFen failed for fen %s", fen)
log.errorf(ex, "IO gRPC importFen failed for fen %s", fen)
// scalafix:off DisableSyntax.throw
throw ex
// scalafix:on DisableSyntax.throw
@@ -43,7 +43,7 @@ class IoGrpcClientWrapper:
try CoreProtoMapper.fromProtoGameContext(stub.importPgn(ProtoImportPgnRequest.newBuilder().setPgn(pgn).build()))
catch
case ex: Exception =>
log.warnf(ex, "IO gRPC importPgn failed")
log.errorf(ex, "IO gRPC importPgn failed")
// scalafix:off DisableSyntax.throw
throw ex
// scalafix:on DisableSyntax.throw
@@ -52,7 +52,7 @@ class IoGrpcClientWrapper:
try stub.exportFen(CoreProtoMapper.toProtoGameContext(ctx)).getValue
catch
case ex: Exception =>
log.warnf(ex, "IO gRPC exportFen failed")
log.errorf(ex, "IO gRPC exportFen failed")
// scalafix:off DisableSyntax.throw
throw ex
// scalafix:on DisableSyntax.throw
@@ -61,7 +61,7 @@ class IoGrpcClientWrapper:
try stub.exportPgn(CoreProtoMapper.toProtoGameContext(ctx)).getValue
catch
case ex: Exception =>
log.warnf(ex, "IO gRPC exportPgn failed")
log.errorf(ex, "IO gRPC exportPgn failed")
// scalafix:off DisableSyntax.throw
throw ex
// scalafix:on DisableSyntax.throw