mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix: Clean up formatting and ensure consistent return structure in metrics endpoints
This commit is contained in:
@@ -41,24 +41,23 @@ router.get(
|
||||
HTTPMethod.POST,
|
||||
queueSizeUrl,
|
||||
requestBody,
|
||||
{}
|
||||
{},
|
||||
);
|
||||
|
||||
if (result instanceof HTTPErrorResponse) {
|
||||
logger.error("Error fetching queue size from ProbeIngest API");
|
||||
logger.error(result);
|
||||
throw result;
|
||||
throw result;
|
||||
}
|
||||
|
||||
// Extract queueSize from the response
|
||||
const queueSize = result.data["queueSize"] || 0;
|
||||
const queueSize: number = result.data["queueSize"] || 0;
|
||||
|
||||
logger.debug(`Queue size fetched: ${queueSize}`);
|
||||
|
||||
return Response.sendJsonObjectResponse(req, res, {
|
||||
queueSize: queueSize,
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
logger.error("Error in metrics queue-size endpoint");
|
||||
logger.error(err);
|
||||
|
||||
@@ -380,7 +380,7 @@ router.post(
|
||||
try {
|
||||
// This endpoint returns the number of monitors pending for the specific probe
|
||||
// to be used by Keda for autoscaling probe replicas
|
||||
|
||||
|
||||
// Get the probe ID from the authenticated request
|
||||
const data: JSONObject = req.body;
|
||||
const probeId: ObjectID = new ObjectID(data["probeId"] as string);
|
||||
@@ -413,8 +413,8 @@ router.post(
|
||||
},
|
||||
});
|
||||
|
||||
return Response.sendJsonObjectResponse(req, res, {
|
||||
queueSize: pendingCount.toNumber()
|
||||
return Response.sendJsonObjectResponse(req, res, {
|
||||
queueSize: pendingCount.toNumber(),
|
||||
});
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
|
||||
Reference in New Issue
Block a user