hardware details pipeline refactor
This commit is contained in:
1 parent
705475e971
commit
f8e88623a8
2 files changed
+188
-657
No files matched your search
@@ -1,11 +1,13 @@
|
||||
import {
|
||||
buildUptimeDetailsPipeline,
|
||||
buildHardwareDetailsPipeline,
|
||||
buildMonitorSummaryByTeamIdPipeline,
|
||||
buildMonitorsByTeamIdPipeline,
|
||||
buildMonitorsAndSummaryByTeamIdPipeline,
|
||||
buildMonitorsWithChecksByTeamIdPipeline,
|
||||
buildFilteredMonitorsByTeamIdPipeline,
|
||||
getHardwareStats,
|
||||
getUpChecks,
|
||||
getAggregateData,
|
||||
} from "./monitorModuleQueries.js";
|
||||
|
||||
import { CheckModel } from "@/db/models/index.js";
|
||||
@@ -317,9 +319,17 @@ class MonitorModule {
|
||||
};
|
||||
const dateString = formatLookup[dateRange];
|
||||
|
||||
const hardwareStats = await CheckModel.aggregate(buildHardwareDetailsPipeline(monitor, dates, dateString));
|
||||
const [aggregateData, upChecksCount, metrics] = await Promise.all([
|
||||
getAggregateData(monitorId, dates),
|
||||
getUpChecks(monitorId, dates),
|
||||
getHardwareStats(monitorId, dates, dateString),
|
||||
]);
|
||||
|
||||
const stats = hardwareStats[0];
|
||||
const stats = {
|
||||
aggregateData: aggregateData,
|
||||
upChecks: upChecksCount,
|
||||
checks: metrics,
|
||||
};
|
||||
|
||||
return {
|
||||
...monitor.toObject(),
|
||||
|
||||
Reference in new issue
Block a user