implemented 09-system-metrics.md: added system metrics: introduced system monitoring with a metrics collector, REST API endpoint, Thymeleaf UI rendering, and lifecycle management

This commit is contained in:
Michael Hoennig
2026-07-07 12:55:11 +02:00
parent 67c9f0ade9
commit a6a2c9de0b
21 changed files with 1069 additions and 6 deletions
@@ -0,0 +1,28 @@
package de.hoennig.gittally.server
import de.hoennig.gittally.metrics.SystemMetricsCollector
import jakarta.annotation.PreDestroy
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.annotation.Profile
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Component
/**
* Starts the system-metrics sampling loop once the server context is ready and
* stops it on shutdown. Only in the `server` profile, like [ServerWatcherLifecycle].
*/
@Component
@Profile("server")
class ServerMetricsLifecycle(
private val collector: SystemMetricsCollector,
) {
@EventListener(ApplicationReadyEvent::class)
fun onApplicationReady() {
collector.start()
}
@PreDestroy
fun onShutdown() {
collector.stop()
}
}