Skip to content

Commit

Permalink
refactor: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Siumauricio committed Jan 3, 2025
1 parent c0c5e69 commit 0037b4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Binary file modified apps/monitoring/monitoring.db
Binary file not shown.
12 changes: 6 additions & 6 deletions apps/monitoring/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ app.get("/metrics/containers", async (c) => {
if (existsSync(logPath) === false) {
return c.json([]);
}
const metrics = await processMetricsFromFile(logPath, {
start: c.req.query("start"),
end: c.req.query("end"),
limit: Number(c.req.query("limit")) || undefined,
});
// const metrics = await processMetricsFromFile(logPath, {
// start: c.req.query("start"),
// end: c.req.query("end"),
// limit: Number(c.req.query("limit")) || undefined,
// });

return c.json(metrics);
// return c.json(metrics);
} catch (error) {
console.error("Error reading metrics:", error);
return c.json({ error: "Error reading metrics" }, 500);
Expand Down
3 changes: 3 additions & 0 deletions apps/monitoring/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const getLatestMetrics = (): Promise<ServerMetric | undefined> => {
"SELECT * FROM server_metrics ORDER BY timestamp DESC LIMIT 1",
(err, row) => {
if (err) reject(err);
// @ts-ignore
resolve(row);
},
);
Expand All @@ -178,6 +179,7 @@ export const getLastNMetrics = (limit: number): Promise<ServerMetric[]> => {
[limit],
(err, rows) => {
if (err) reject(err);
// @ts-ignore
resolve(rows);
},
);
Expand All @@ -196,6 +198,7 @@ export const getMetricsInRange = (
[startTime, endTime],
(err, rows) => {
if (err) reject(err);
// @ts-ignore
resolve(rows);
},
);
Expand Down

0 comments on commit 0037b4c

Please sign in to comment.