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:
parent
75beebd31d
commit
0c19bb5c4c
|
@ -86,11 +86,11 @@ class Main : Runnable {
|
||||||
throw IllegalArgumentException()
|
throw IllegalArgumentException()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Files.isDirectory(databaseFolder)) {
|
if (Files.isRegularFile(databaseFolder)) {
|
||||||
throw IllegalArgumentException("Database folder $databaseFolder must be a directory")
|
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")
|
throw IllegalArgumentException("Cache folder $cacheFolder must be a directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,10 @@ fun getServer(
|
||||||
client: HttpHandler
|
client: HttpHandler
|
||||||
): Http4kServer {
|
): Http4kServer {
|
||||||
val circuitBreakerRegistry = CircuitBreakerRegistry.ofDefaults()
|
val circuitBreakerRegistry = CircuitBreakerRegistry.ofDefaults()
|
||||||
|
TaggedCircuitBreakerMetrics
|
||||||
|
.ofCircuitBreakerRegistry(circuitBreakerRegistry)
|
||||||
|
.bindTo(registry)
|
||||||
|
|
||||||
val circuitBreaker = circuitBreakerRegistry.circuitBreaker(
|
val circuitBreaker = circuitBreakerRegistry.circuitBreaker(
|
||||||
"upstream",
|
"upstream",
|
||||||
CircuitBreakerConfig.custom()
|
CircuitBreakerConfig.custom()
|
||||||
|
@ -77,10 +81,6 @@ fun getServer(
|
||||||
LOGGER.warn { "Circuit breaker has moved from ${it.stateTransition.fromState} to ${it.stateTransition.toState}" }
|
LOGGER.warn { "Circuit breaker has moved from ${it.stateTransition.fromState} to ${it.stateTransition.toState}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
TaggedCircuitBreakerMetrics
|
|
||||||
.ofCircuitBreakerRegistry(circuitBreakerRegistry)
|
|
||||||
.bindTo(registry)
|
|
||||||
|
|
||||||
val circuited = ResilienceFilters.CircuitBreak(
|
val circuited = ResilienceFilters.CircuitBreak(
|
||||||
circuitBreaker,
|
circuitBreaker,
|
||||||
isError = { r: Response -> !r.status.successful }
|
isError = { r: Response -> !r.status.successful }
|
||||||
|
|
Loading…
Reference in a new issue