mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
53 lines
2.1 KiB
Kotlin
53 lines
2.1 KiB
Kotlin
/*
|
|
Mangadex@Home
|
|
Copyright (c) 2020, MangaDex Network
|
|
This file is part of MangaDex@Home.
|
|
|
|
MangaDex@Home is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
MangaDex@Home is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this MangaDex@Home. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package mdnet.metrics
|
|
|
|
import io.micrometer.core.instrument.Tag
|
|
import io.micrometer.core.instrument.binder.jvm.DiskSpaceMetrics
|
|
import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics
|
|
import io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics
|
|
import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics
|
|
import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics
|
|
import io.micrometer.core.instrument.binder.logging.LogbackMetrics
|
|
import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics
|
|
import io.micrometer.core.instrument.binder.system.ProcessorMetrics
|
|
import io.micrometer.core.instrument.binder.system.UptimeMetrics
|
|
import io.micrometer.prometheus.PrometheusMeterRegistry
|
|
import mdnet.BuildInfo
|
|
import java.nio.file.Path
|
|
|
|
class DefaultMicrometerMetrics(registry: PrometheusMeterRegistry, cacheDirectory: Path) {
|
|
init {
|
|
UptimeMetrics(
|
|
mutableListOf(
|
|
Tag.of("version", BuildInfo.VERSION)
|
|
)
|
|
).bindTo(registry)
|
|
|
|
JvmMemoryMetrics().bindTo(registry)
|
|
JvmGcMetrics().bindTo(registry)
|
|
ProcessorMetrics().bindTo(registry)
|
|
JvmThreadMetrics().bindTo(registry)
|
|
JvmHeapPressureMetrics().bindTo(registry)
|
|
FileDescriptorMetrics().bindTo(registry)
|
|
LogbackMetrics().bindTo(registry)
|
|
DiskSpaceMetrics(cacheDirectory.toFile()).bindTo(registry)
|
|
}
|
|
}
|