mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
Add egress metrics
This commit is contained in:
parent
85db7f81c2
commit
191eaed364
|
@ -63,8 +63,8 @@ class GeoIpMetricsFilter(
|
|||
|
||||
return {
|
||||
val sourceIp =
|
||||
it.headerValues("Forwarded")[0] // try Forwarded (rare but standard)
|
||||
?: it.headerValues("X-Forwarded-For")[0] // X-Forwarded-For (common but technically wrong)
|
||||
it.headerValues("Forwarded").firstOrNull() // try Forwarded (rare but standard)
|
||||
?: it.headerValues("X-Forwarded-For").firstOrNull() // X-Forwarded-For (common but technically wrong)
|
||||
?: it.source?.address // source (in case of no proxying, or with proxy-protocol)
|
||||
|
||||
sourceIp.apply {
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
|
|||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import io.micrometer.core.instrument.FunctionCounter
|
||||
import io.micrometer.prometheus.PrometheusMeterRegistry
|
||||
import mdnet.Constants
|
||||
import mdnet.cache.CachingInputStream
|
||||
|
@ -286,6 +287,12 @@ fun getServer(
|
|||
client = client
|
||||
)
|
||||
|
||||
FunctionCounter.builder(
|
||||
"client_sent_bytes",
|
||||
statistics,
|
||||
{ it.get().bytesSent.toDouble() }
|
||||
).register(registry)
|
||||
|
||||
val verifier = tokenVerifier(
|
||||
tokenKey = remoteSettings.tokenKey,
|
||||
shouldVerify = { chapter, _ ->
|
||||
|
|
Loading…
Reference in a new issue