added more metrics to the status request
This commit is contained in:
@ -24,6 +24,7 @@ package org.mosad.thecitadelofricks
|
||||
|
||||
import org.mosad.thecitadelofricks.CacheController.Companion.courseList
|
||||
import org.mosad.thecitadelofricks.CacheController.Companion.mensaMenu
|
||||
import org.mosad.thecitadelofricks.CacheController.Companion.timetableList
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
@ -33,6 +34,7 @@ import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.time.LocalDateTime
|
||||
import java.util.*
|
||||
import java.util.stream.Collectors
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashSet
|
||||
|
||||
@ -42,8 +44,8 @@ class APIController {
|
||||
private val logger: Logger = LoggerFactory.getLogger(APIController::class.java)
|
||||
private val cache = CacheController()
|
||||
|
||||
private val softwareVersion = "1.1.3"
|
||||
private val apiVersion = "1.1.1"
|
||||
private val softwareVersion = "1.1.3"
|
||||
private val startTime = System.currentTimeMillis() / 1000
|
||||
|
||||
private var requestCount = 0
|
||||
@ -141,6 +143,10 @@ class APIController {
|
||||
val minutes = (currentTime - startTime) % 3600 / 60
|
||||
val hours = (currentTime - startTime) % 86400 / 3600
|
||||
val days = (currentTime - startTime) / 86400
|
||||
|
||||
val timetableListSize = timetableList.size
|
||||
val timetableListNames = timetableList.stream().map { x -> x.meta.courseName }.collect(Collectors.toList())
|
||||
|
||||
var hsoCode = 999
|
||||
var swfrCode = 999
|
||||
logger.info("status request at ${LocalDateTime.now()}!")
|
||||
@ -168,6 +174,8 @@ class APIController {
|
||||
apiVersion,
|
||||
softwareVersion,
|
||||
requestCount,
|
||||
timetableListSize,
|
||||
HashSet(timetableListNames).toString(),
|
||||
Date(courseList.meta.updateTime * 1000),
|
||||
Date(mensaMenu.meta.updateTime * 1000),
|
||||
hsoCode,
|
||||
|
Reference in New Issue
Block a user