mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: Enhance metrics endpoint to include synthetic monitor semaphore status for better scaling insights
This commit is contained in:
@@ -15,6 +15,7 @@ import API from "Common/Utils/API";
|
||||
import logger from "Common/Server/Utils/Logger";
|
||||
import ProbeAPIRequest from "../Utils/ProbeAPIRequest";
|
||||
import ProxyConfig from "../Utils/ProxyConfig";
|
||||
import SyntheticMonitorSemaphore from "../Utils/SyntheticMonitorSemaphore";
|
||||
|
||||
const router: ExpressRouter = Express.getRouter();
|
||||
|
||||
@@ -83,7 +84,20 @@ router.get(
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug(`Pending monitor count for KEDA: ${queueSize}`);
|
||||
// Include synthetic monitor semaphore pressure: monitors queued
|
||||
// waiting for a browser slot indicate the probe is at capacity and
|
||||
// Kubernetes should scale up more probe replicas.
|
||||
const semaphoreStatus: {
|
||||
running: number;
|
||||
queued: number;
|
||||
maxSlots: number;
|
||||
} = SyntheticMonitorSemaphore.getStatus();
|
||||
|
||||
queueSize += semaphoreStatus.queued;
|
||||
|
||||
logger.debug(
|
||||
`Pending monitor count for KEDA: ${queueSize} (API pending: ${queueSize - semaphoreStatus.queued}, semaphore queued: ${semaphoreStatus.queued}, semaphore running: ${semaphoreStatus.running}/${semaphoreStatus.maxSlots})`,
|
||||
);
|
||||
|
||||
return Response.sendJsonObjectResponse(req, res, {
|
||||
queueSize: queueSize,
|
||||
|
||||
Reference in New Issue
Block a user