1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Move metrics up a bit

This commit is contained in:
carbotaniuman 2021-02-12 21:07:36 -06:00
parent 75beebd31d
commit 0c19bb5c4c
2 changed files with 6 additions and 6 deletions

View file

@ -86,11 +86,11 @@ class Main : Runnable {
throw IllegalArgumentException()
}
if (!Files.isDirectory(databaseFolder)) {
if (Files.isRegularFile(databaseFolder)) {
throw IllegalArgumentException("Database folder $databaseFolder must be a directory")
}
if (!Files.isDirectory(cacheFolder)) {
if (Files.isRegularFile(cacheFolder)) {
throw IllegalArgumentException("Cache folder $cacheFolder must be a directory")
}

View file

@ -51,6 +51,10 @@ fun getServer(
client: HttpHandler
): Http4kServer {
val circuitBreakerRegistry = CircuitBreakerRegistry.ofDefaults()
TaggedCircuitBreakerMetrics
.ofCircuitBreakerRegistry(circuitBreakerRegistry)
.bindTo(registry)
val circuitBreaker = circuitBreakerRegistry.circuitBreaker(
"upstream",
CircuitBreakerConfig.custom()
@ -77,10 +81,6 @@ fun getServer(
LOGGER.warn { "Circuit breaker has moved from ${it.stateTransition.fromState} to ${it.stateTransition.toState}" }
}
TaggedCircuitBreakerMetrics
.ofCircuitBreakerRegistry(circuitBreakerRegistry)
.bindTo(registry)
val circuited = ResilienceFilters.CircuitBreak(
circuitBreaker,
isError = { r: Response -> !r.status.successful }