fix: NCS-84 More Verbose Logging #51
+1
-1
@@ -79,7 +79,7 @@ class OfficialChallengeResource:
|
|||||||
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ErrorDto(err)).build()
|
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ErrorDto(err)).build()
|
||||||
case Right(id) =>
|
case Right(id) =>
|
||||||
try botEventPublisher.publishGameStart(bot.name, id, botColor, difficulty, bot.id.toString)
|
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
|
Response
|
||||||
.status(Response.Status.CREATED)
|
.status(Response.Status.CREATED)
|
||||||
.entity(OfficialChallengeResponse(id, botName, difficulty))
|
.entity(OfficialChallengeResponse(id, botName, difficulty))
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class ChallengeService:
|
|||||||
challenge.expiresAt = Instant.now().plus(24, ChronoUnit.HOURS)
|
challenge.expiresAt = Instant.now().plus(24, ChronoUnit.HOURS)
|
||||||
challengeRepository.persist(challenge)
|
challengeRepository.persist(challenge)
|
||||||
try eventPublisher.publishChallengeCreated(destUser.id.toString, challenge.id.toString, challenger.username)
|
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
|
challenge
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -116,7 +116,7 @@ class ChallengeService:
|
|||||||
challengeRepository.merge(challenge)
|
challengeRepository.merge(challenge)
|
||||||
notifyBotIfNeeded(challenge, gameId)
|
notifyBotIfNeeded(challenge, gameId)
|
||||||
try eventPublisher.publishChallengeAccepted(challenge.challenger.id.toString, challenge.id.toString, 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
|
challenge
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class AutoScaler:
|
|||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
meterRegistry.counter("nowchess.coordinator.scale.failures", "direction", "up").increment()
|
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 =
|
def scaleDown(): Unit =
|
||||||
log.info("Scaling down Argo Rollout")
|
log.info("Scaling down Argo Rollout")
|
||||||
@@ -225,4 +225,4 @@ class AutoScaler:
|
|||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
meterRegistry.counter("nowchess.coordinator.scale.failures", "direction", "down").increment()
|
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)
|
||||||
|
|||||||
+2
-2
@@ -80,14 +80,14 @@ class CacheEvictionManager:
|
|||||||
count + 1
|
count + 1
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "Failed to evict game %s", gameId)
|
log.errorf(ex, "Failed to evict game %s", gameId)
|
||||||
count
|
count
|
||||||
}
|
}
|
||||||
else count
|
else count
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "Error processing game key %s", key)
|
log.errorf(ex, "Error processing game key %s", key)
|
||||||
count
|
count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -112,7 +112,7 @@ class FailoverService:
|
|||||||
else false
|
else false
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
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
|
false
|
||||||
if success then true else tryMigrateBatch(batch, batchIdx, instances, deadId, attempt + 1)
|
if success then true else tryMigrateBatch(batch, batchIdx, instances, deadId, attempt + 1)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -192,7 +192,7 @@ class HealthMonitor:
|
|||||||
log.debugf("No pod found for instance %s, skipping deletion", instanceId)
|
log.debugf("No pod found for instance %s, skipping deletion", instanceId)
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(
|
log.errorf(
|
||||||
ex,
|
ex,
|
||||||
"Failed to delete pod for instance %s — removing from registry to prevent blocking scale-down",
|
"Failed to delete pod for instance %s — removing from registry to prevent blocking scale-down",
|
||||||
instanceId,
|
instanceId,
|
||||||
|
|||||||
+1
-1
@@ -99,7 +99,7 @@ class InstanceRegistry:
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
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)
|
instances.remove(instanceId)
|
||||||
meterRegistry.counter("nowchess.coordinator.instances.removed").increment()
|
meterRegistry.counter("nowchess.coordinator.instances.removed").increment()
|
||||||
Uni.createFrom().item(())
|
Uni.createFrom().item(())
|
||||||
|
|||||||
+3
-3
@@ -96,14 +96,14 @@ class LoadBalancer:
|
|||||||
log.infof("Moved %d games from %s to %s", subscribed, over.instanceId, target.instanceId)
|
log.infof("Moved %d games from %s to %s", subscribed, over.instanceId, target.instanceId)
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
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
|
val elapsed = System.currentTimeMillis() - startTime
|
||||||
log.infof("Rebalance completed in %dms", elapsed)
|
log.infof("Rebalance completed in %dms", elapsed)
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "Rebalance failed")
|
log.errorf(ex, "Rebalance failed")
|
||||||
|
|
||||||
private def getGamesToMove(instanceId: String, count: Int): List[String] =
|
private def getGamesToMove(instanceId: String, count: Int): List[String] =
|
||||||
try
|
try
|
||||||
@@ -125,7 +125,7 @@ class LoadBalancer:
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "Failed to update Redis game sets")
|
log.errorf(ex, "Failed to update Redis game sets")
|
||||||
|
|
||||||
@Scheduled(every = "30s")
|
@Scheduled(every = "30s")
|
||||||
def periodicRebalanceCheck(): Unit =
|
def periodicRebalanceCheck(): Unit =
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class IoGrpcClientWrapper:
|
|||||||
CombinedExportResponse(combined.getFen, combined.getPgn)
|
CombinedExportResponse(combined.getFen, combined.getPgn)
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "IO gRPC exportCombined failed")
|
log.errorf(ex, "IO gRPC exportCombined failed")
|
||||||
// scalafix:off DisableSyntax.throw
|
// scalafix:off DisableSyntax.throw
|
||||||
throw ex
|
throw ex
|
||||||
// scalafix:on DisableSyntax.throw
|
// scalafix:on DisableSyntax.throw
|
||||||
@@ -34,7 +34,7 @@ class IoGrpcClientWrapper:
|
|||||||
try CoreProtoMapper.fromProtoGameContext(stub.importFen(ProtoImportFenRequest.newBuilder().setFen(fen).build()))
|
try CoreProtoMapper.fromProtoGameContext(stub.importFen(ProtoImportFenRequest.newBuilder().setFen(fen).build()))
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
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
|
// scalafix:off DisableSyntax.throw
|
||||||
throw ex
|
throw ex
|
||||||
// scalafix:on DisableSyntax.throw
|
// scalafix:on DisableSyntax.throw
|
||||||
@@ -43,7 +43,7 @@ class IoGrpcClientWrapper:
|
|||||||
try CoreProtoMapper.fromProtoGameContext(stub.importPgn(ProtoImportPgnRequest.newBuilder().setPgn(pgn).build()))
|
try CoreProtoMapper.fromProtoGameContext(stub.importPgn(ProtoImportPgnRequest.newBuilder().setPgn(pgn).build()))
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "IO gRPC importPgn failed")
|
log.errorf(ex, "IO gRPC importPgn failed")
|
||||||
// scalafix:off DisableSyntax.throw
|
// scalafix:off DisableSyntax.throw
|
||||||
throw ex
|
throw ex
|
||||||
// scalafix:on DisableSyntax.throw
|
// scalafix:on DisableSyntax.throw
|
||||||
@@ -52,7 +52,7 @@ class IoGrpcClientWrapper:
|
|||||||
try stub.exportFen(CoreProtoMapper.toProtoGameContext(ctx)).getValue
|
try stub.exportFen(CoreProtoMapper.toProtoGameContext(ctx)).getValue
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "IO gRPC exportFen failed")
|
log.errorf(ex, "IO gRPC exportFen failed")
|
||||||
// scalafix:off DisableSyntax.throw
|
// scalafix:off DisableSyntax.throw
|
||||||
throw ex
|
throw ex
|
||||||
// scalafix:on DisableSyntax.throw
|
// scalafix:on DisableSyntax.throw
|
||||||
@@ -61,7 +61,7 @@ class IoGrpcClientWrapper:
|
|||||||
try stub.exportPgn(CoreProtoMapper.toProtoGameContext(ctx)).getValue
|
try stub.exportPgn(CoreProtoMapper.toProtoGameContext(ctx)).getValue
|
||||||
catch
|
catch
|
||||||
case ex: Exception =>
|
case ex: Exception =>
|
||||||
log.warnf(ex, "IO gRPC exportPgn failed")
|
log.errorf(ex, "IO gRPC exportPgn failed")
|
||||||
// scalafix:off DisableSyntax.throw
|
// scalafix:off DisableSyntax.throw
|
||||||
throw ex
|
throw ex
|
||||||
// scalafix:on DisableSyntax.throw
|
// scalafix:on DisableSyntax.throw
|
||||||
|
|||||||
Reference in New Issue
Block a user