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:
@@ -0,0 +1,18 @@
|
||||
package de.hoennig.gittally.server
|
||||
|
||||
import de.hoennig.gittally.metrics.SystemMetrics
|
||||
import de.hoennig.gittally.metrics.SystemMetricsCollector
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class SystemApiController(
|
||||
private val collector: SystemMetricsCollector,
|
||||
) {
|
||||
/**
|
||||
* The current system snapshot plus min/max/avg aggregates (the legacy
|
||||
* `system.json`). Unavailable metrics are null, never an error.
|
||||
*/
|
||||
@GetMapping("/api/system")
|
||||
fun system(): SystemMetrics = collector.snapshot()
|
||||
}
|
||||
Reference in New Issue
Block a user