Extract webserver metrics into a separate class to avoid passing it into every API call. Change the display to requests per hour rather than just last request time. Add SSE and telnet client connected count.

This commit is contained in:
Ian Renton
2026-09-11 22:32:04 +01:00
parent 4a09e46fe0
commit 7c458a8c5b
25 changed files with 161 additions and 230 deletions
+22 -9
View File
@@ -25,7 +25,9 @@ info:
* Added `contests_skip_max_duration_check` to alert query parameters
* SIG reference types (e.g. "Park") are now capitalised to match other enums
* Added the ability to get only certain fields of spots and alerts from the API by using the `fields` query parameter.
* Replace `last_page_access` with `page_requests_per_hour` and `last_api_access` with `api_requests_per_hour` in the web server stats.
* Added `sse_client_count` to the `webserver` stats, and a new `telnet` object with `client_count`.
### 2.0
* **Breaking change:** The "add spot" API has changed to enable future support for upstream submission to the spotting services associated with various SIGs. Instead of just posting the spot object itself as the JSON content of the POST, this has moved into a `spot` object within the structure. A new `handling` object alongside it contains the `submit_upstream`, `upstream_provider`, `upstream_credentials`, and `captcha_token` fields which control the server handling of the spot.
@@ -2100,14 +2102,25 @@ components:
type: string
description: The status of the web server
example: OK
last_page_access:
type: number
description: The last time a page was accessed on the web server, UTC seconds since UNIX epoch.
example: 1759579508
last_api_access:
type: number
description: The last time an API endpoint was accessed on the web server, UTC seconds since UNIX epoch.
example: 1759579508
page_requests_per_hour:
type: integer
description: The number of page requests handled by the web server in the last hour
example: 123
api_requests_per_hour:
type: integer
description: The number of API requests handled by the web server in the last hour
example: 123
sse_client_count:
type: integer
description: The number of clients currently connected to SSE streams
example: 5
"telnet":
type: object
properties:
client_count:
type: integer
description: The number of clients currently connected to the telnet server
example: 2
spot_providers:
type: array
description: An array of all the spot providers.
+4 -2
View File
@@ -9,8 +9,10 @@ function loadStatus() {
$("#total-alerts").text(jsonData["num_alerts"]);
$("#web-server-status").text(jsonData["webserver"]["status"]);
$("#web-server-last-api").text(moment.unix(jsonData["webserver"]["last_api_access"]).utc().fromNow());
$("#web-server-last-page").text(moment.unix(jsonData["webserver"]["last_page_access"]).utc().fromNow());
$("#web-server-api-rate").text(jsonData["webserver"]["api_requests_per_hour"] + " / hour");
$("#web-server-page-rate").text(jsonData["webserver"]["page_requests_per_hour"] + " / hour");
$("#web-server-sse-clients").text(jsonData["webserver"]["sse_client_count"]);
$("#telnet-server-clients").text(jsonData["telnet"]["client_count"]);
$("#cleanup-status").text(jsonData["cleanup"]["status"]);
$("#cleanup-last-ran").text((jsonData["cleanup"]["last_ran"] > 0) ? moment.unix(jsonData["cleanup"]["last_ran"]).utc().fromNow() : "N/A");