client
This commit is contained in:
1 parent
7a01a8a8a3
commit
8b079905a3
6 files changed
+213
-92
No files matched your search
@@ -0,0 +1,95 @@
|
|||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { BaseChart } from "@/components/monitors/Chart";
|
||||||
|
import {
|
||||||
|
ResponsiveContainer,
|
||||||
|
BarChart,
|
||||||
|
Bar,
|
||||||
|
XAxis,
|
||||||
|
YAxis,
|
||||||
|
CartesianGrid,
|
||||||
|
Tooltip,
|
||||||
|
} from "recharts";
|
||||||
|
import { XTick } from "@/components/monitors/ChartResponseTime";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import { BaseBox } from "@/components/design-elements";
|
||||||
|
import { useAppSelector } from "@/hooks/AppHooks";
|
||||||
|
import { formatDateWithTz, tooltipDateFormatLookup } from "@/utils/TimeUtils";
|
||||||
|
|
||||||
|
type Datum = Record<string, unknown> & { _id: string | number };
|
||||||
|
|
||||||
|
export const BarDockerCount = ({
|
||||||
|
data,
|
||||||
|
dataKey,
|
||||||
|
range,
|
||||||
|
title,
|
||||||
|
emptyText,
|
||||||
|
}: {
|
||||||
|
data: Datum[];
|
||||||
|
dataKey: string;
|
||||||
|
range: string;
|
||||||
|
title: string;
|
||||||
|
emptyText?: string;
|
||||||
|
}) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const hasData = Array.isArray(data) && data.length > 0;
|
||||||
|
const uiTimezone = useAppSelector((state: any) => state.ui.timezone);
|
||||||
|
|
||||||
|
const CountTooltip = ({ active, payload, label }: any) => {
|
||||||
|
if (!active || !payload || !label) return null;
|
||||||
|
console.log(JSON.stringify(payload, null, 2));
|
||||||
|
const fmt = tooltipDateFormatLookup(range);
|
||||||
|
const value = payload?.[0]?.payload?.[dataKey] ?? 0;
|
||||||
|
return (
|
||||||
|
<BaseBox sx={{ py: theme.spacing(2), px: theme.spacing(4) }}>
|
||||||
|
<Typography>
|
||||||
|
{formatDateWithTz(String(label), fmt, uiTimezone)}
|
||||||
|
</Typography>
|
||||||
|
<Typography>Containers: {value}</Typography>
|
||||||
|
</BaseBox>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BaseChart title={title} icon={null}>
|
||||||
|
{!hasData ? (
|
||||||
|
<Stack height={"100%"} alignItems={"center"} justifyContent={"center"}>
|
||||||
|
<Typography variant="h2">{emptyText || "No data"}</Typography>
|
||||||
|
</Stack>
|
||||||
|
) : (
|
||||||
|
<ResponsiveContainer width="100%" height={200}>
|
||||||
|
<BarChart data={data}>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id={"gradient"} x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop
|
||||||
|
offset="0%"
|
||||||
|
stopColor={theme.palette.primary.main}
|
||||||
|
stopOpacity={0.85}
|
||||||
|
/>
|
||||||
|
<stop
|
||||||
|
offset="100%"
|
||||||
|
stopColor={theme.palette.primary.light}
|
||||||
|
stopOpacity={0}
|
||||||
|
/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<CartesianGrid
|
||||||
|
stroke={theme.palette.divider}
|
||||||
|
strokeWidth={1}
|
||||||
|
vertical={false}
|
||||||
|
/>
|
||||||
|
<XAxis
|
||||||
|
dataKey={"_id"}
|
||||||
|
tick={(props) => <XTick {...props} range={range} />}
|
||||||
|
/>
|
||||||
|
<YAxis allowDecimals={false} />
|
||||||
|
<Tooltip content={<CountTooltip />} cursor={false} />
|
||||||
|
<Bar dataKey={dataKey} fill={`url(#gradient)`} />
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
)}
|
||||||
|
</BaseChart>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BarDockerCount;
|
||||||
@@ -8,3 +8,4 @@ export { HistogramInfrastructure } from "./HistogramInfrastructure";
|
|||||||
export { CardDockerContainer } from "./CardDockerContainer";
|
export { CardDockerContainer } from "./CardDockerContainer";
|
||||||
export { HeaderFilter } from "./HeaderFilter";
|
export { HeaderFilter } from "./HeaderFilter";
|
||||||
export { HistogramDockerPercentage } from "./HistogramDockerPercentage";
|
export { HistogramDockerPercentage } from "./HistogramDockerPercentage";
|
||||||
|
export { BarDockerCount } from "./BarDockerCount";
|
||||||
+94
-86
@@ -109,47 +109,46 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"checks": {
|
"checks": {
|
||||||
|
"details": {
|
||||||
|
"common": {
|
||||||
|
"requestTime": "Total request time: {{time}}"
|
||||||
|
},
|
||||||
|
"detailsCard": {
|
||||||
|
"fields": {
|
||||||
|
"checkTime": "Check time",
|
||||||
|
"code": "HTTP Code",
|
||||||
|
"dns": "DNS",
|
||||||
|
"download": "Download",
|
||||||
|
"firstByte": "First byte",
|
||||||
|
"message": "Message",
|
||||||
|
"request": "Request",
|
||||||
|
"status": "Status",
|
||||||
|
"tcp": "TCP",
|
||||||
|
"timingPhases": "Timing phases",
|
||||||
|
"tls": "TLS",
|
||||||
|
"total": "Total",
|
||||||
|
"type": "Type",
|
||||||
|
"wait": "Wait"
|
||||||
|
},
|
||||||
|
"headers": {
|
||||||
|
"basicInfo": "Basic check info",
|
||||||
|
"timing": "Timing phases"
|
||||||
|
},
|
||||||
|
"linkText": "View monitor",
|
||||||
|
"title": "Check details"
|
||||||
|
},
|
||||||
|
"timingChart": {
|
||||||
|
"title": "Request timings"
|
||||||
|
}
|
||||||
|
},
|
||||||
"table": {
|
"table": {
|
||||||
"empty": "No checks",
|
"empty": "No checks",
|
||||||
"headers": {
|
"headers": {
|
||||||
"dateTime": "Date & Time",
|
"dateTime": "Date & Time",
|
||||||
"statusCode": "Status code"
|
"statusCode": "Status code"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"details": {
|
|
||||||
"common": {
|
|
||||||
"requestTime": "Total request time: {{time}}"
|
|
||||||
},
|
|
||||||
"detailsCard": {
|
|
||||||
"title": "Check details",
|
|
||||||
"linkText": "View monitor",
|
|
||||||
"headers": {
|
|
||||||
"basicInfo": "Basic check info",
|
|
||||||
"timing": "Timing phases"
|
|
||||||
},
|
|
||||||
"fields": {
|
|
||||||
"status": "Status",
|
|
||||||
"code": "HTTP Code",
|
|
||||||
"type": "Type",
|
|
||||||
"checkTime": "Check time",
|
|
||||||
"message": "Message",
|
|
||||||
"timingPhases": "Timing phases",
|
|
||||||
"wait": "Wait",
|
|
||||||
"dns": "DNS",
|
|
||||||
"tcp": "TCP",
|
|
||||||
"tls": "TLS",
|
|
||||||
"request": "Request",
|
|
||||||
"firstByte": "First byte",
|
|
||||||
"download": "Download",
|
|
||||||
"total": "Total"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"timingChart": {
|
|
||||||
"title": "Request timings"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"common": {
|
"common": {
|
||||||
"appName": "Checkmate",
|
"appName": "Checkmate",
|
||||||
"breadcrumbs": {
|
"breadcrumbs": {
|
||||||
@@ -158,6 +157,7 @@
|
|||||||
"configure": "Configure",
|
"configure": "Configure",
|
||||||
"create": "Create",
|
"create": "Create",
|
||||||
"diagnostics": "Diagnostics",
|
"diagnostics": "Diagnostics",
|
||||||
|
"docker": "Docker Monitors",
|
||||||
"incidents": "Incidents",
|
"incidents": "Incidents",
|
||||||
"infrastructure": "Infrastructure Monitors",
|
"infrastructure": "Infrastructure Monitors",
|
||||||
"invite": "Invite",
|
"invite": "Invite",
|
||||||
@@ -181,11 +181,11 @@
|
|||||||
"disable": "Disable",
|
"disable": "Disable",
|
||||||
"enable": "Enable",
|
"enable": "Enable",
|
||||||
"exportJson": "Export to JSON",
|
"exportJson": "Export to JSON",
|
||||||
|
"home": "Return home",
|
||||||
"importJson": "Import from JSON",
|
"importJson": "Import from JSON",
|
||||||
"incidents": "Incidents",
|
"incidents": "Incidents",
|
||||||
"limitReached": "Your plan's limit has been reached",
|
"limitReached": "Your plan's limit has been reached",
|
||||||
"no": "No",
|
"no": "No",
|
||||||
"home": "Return home",
|
|
||||||
"pause": "Pause",
|
"pause": "Pause",
|
||||||
"range": {
|
"range": {
|
||||||
"all": "All",
|
"all": "All",
|
||||||
@@ -240,12 +240,12 @@
|
|||||||
"weight": "Weight"
|
"weight": "Weight"
|
||||||
},
|
},
|
||||||
"uptime": {
|
"uptime": {
|
||||||
|
"avgResponseTime": "Avg response time",
|
||||||
"detail": "Total checks",
|
"detail": "Total checks",
|
||||||
"downTitle": "Downtime",
|
"downTitle": "Downtime",
|
||||||
"emptyDown": "Great, no downtime!",
|
"emptyDown": "Great, no downtime!",
|
||||||
"emptyUp": "No checks yet",
|
"emptyUp": "No checks yet",
|
||||||
"upTitle": "Uptime",
|
"upTitle": "Uptime"
|
||||||
"avgResponseTime": "Avg response time"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dialog": {
|
"dialog": {
|
||||||
@@ -259,11 +259,11 @@
|
|||||||
"headers": {
|
"headers": {
|
||||||
"actions": "Actions",
|
"actions": "Actions",
|
||||||
"active": "Active",
|
"active": "Active",
|
||||||
|
"message": "Message",
|
||||||
"monitor": "Monitor",
|
"monitor": "Monitor",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"type": "Type",
|
"type": "Type"
|
||||||
"message": "Message"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"toasts": {
|
"toasts": {
|
||||||
@@ -280,30 +280,20 @@
|
|||||||
},
|
},
|
||||||
"diagnostics": {
|
"diagnostics": {
|
||||||
"infoBox": {
|
"infoBox": {
|
||||||
"title": "System Diagnostics",
|
"description": "Review system logs and background job status to troubleshoot issues. Monitor the health of your monitoring infrastructure and investigate any problems.",
|
||||||
"description": "Review system logs and background job status to troubleshoot issues. Monitor the health of your monitoring infrastructure and investigate any problems."
|
"title": "System Diagnostics"
|
||||||
},
|
|
||||||
"tabs": {
|
|
||||||
"logs": "Logs",
|
|
||||||
"queue": "Queue",
|
|
||||||
"config": "Config",
|
|
||||||
"access": "Access"
|
|
||||||
},
|
},
|
||||||
"logs": {
|
"logs": {
|
||||||
"table": {
|
"table": {
|
||||||
"headers": {
|
"headers": {
|
||||||
"timestamp": "Timestamp",
|
|
||||||
"level": "Level",
|
"level": "Level",
|
||||||
"service": "Service"
|
"service": "Service",
|
||||||
|
"timestamp": "Timestamp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"queue": {
|
"queue": {
|
||||||
"stats": {
|
"stats": {
|
||||||
"monitoringJobs": {
|
|
||||||
"title": "Monitoring jobs",
|
|
||||||
"tooltip": "Total number of monitoring jobs in the queue"
|
|
||||||
},
|
|
||||||
"activeJobs": {
|
"activeJobs": {
|
||||||
"title": "Active jobs",
|
"title": "Active jobs",
|
||||||
"tooltip": "Number of jobs being processed"
|
"tooltip": "Number of jobs being processed"
|
||||||
@@ -312,27 +302,37 @@
|
|||||||
"title": "Failing jobs",
|
"title": "Failing jobs",
|
||||||
"tooltip": "Jobs that failed on their last execution"
|
"tooltip": "Jobs that failed on their last execution"
|
||||||
},
|
},
|
||||||
"totalRuns": {
|
"monitoringJobs": {
|
||||||
"title": "Total runs",
|
"title": "Monitoring jobs",
|
||||||
"tooltip": "Total number of job executions"
|
"tooltip": "Total number of monitoring jobs in the queue"
|
||||||
},
|
},
|
||||||
"totalFailures": {
|
"totalFailures": {
|
||||||
"title": "Total failures",
|
"title": "Total failures",
|
||||||
"tooltip": "Total number of failed job executions"
|
"tooltip": "Total number of failed job executions"
|
||||||
|
},
|
||||||
|
"totalRuns": {
|
||||||
|
"title": "Total runs",
|
||||||
|
"tooltip": "Total number of job executions"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"table": {
|
"table": {
|
||||||
"headers": {
|
"headers": {
|
||||||
"jobId": "Job ID",
|
|
||||||
"url": "URL",
|
|
||||||
"interval": "Interval",
|
|
||||||
"runs": "Runs",
|
|
||||||
"lastRun": "Last run",
|
|
||||||
"lockedAt": "Locked at",
|
|
||||||
"finishedAt": "Finished at",
|
"finishedAt": "Finished at",
|
||||||
"lastRunTook": "Last run took (ms)"
|
"interval": "Interval",
|
||||||
|
"jobId": "Job ID",
|
||||||
|
"lastRun": "Last run",
|
||||||
|
"lastRunTook": "Last run took (ms)",
|
||||||
|
"lockedAt": "Locked at",
|
||||||
|
"runs": "Runs",
|
||||||
|
"url": "URL"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tabs": {
|
||||||
|
"access": "Access",
|
||||||
|
"config": "Config",
|
||||||
|
"logs": "Logs",
|
||||||
|
"queue": "Queue"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"export": {
|
"export": {
|
||||||
@@ -517,6 +517,38 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"docker": {
|
"docker": {
|
||||||
|
"details": {
|
||||||
|
"dockerContainerCard": {
|
||||||
|
"fields": {
|
||||||
|
"health": "Health",
|
||||||
|
"id": "ID",
|
||||||
|
"image": "Image",
|
||||||
|
"ports": "Ports",
|
||||||
|
"status": "Status"
|
||||||
|
},
|
||||||
|
"title": "Container: {{name}}",
|
||||||
|
"values": {
|
||||||
|
"healthy": "Healthy",
|
||||||
|
"unhealthy": "Unhealthy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"healthyChart": {
|
||||||
|
"empty": "No data",
|
||||||
|
"title": "Healthy container %"
|
||||||
|
},
|
||||||
|
"healthyCountChart": {
|
||||||
|
"empty": "No data",
|
||||||
|
"title": "# of healthy containers"
|
||||||
|
},
|
||||||
|
"runningChart": {
|
||||||
|
"empty": "No data",
|
||||||
|
"title": "Running container %"
|
||||||
|
},
|
||||||
|
"runningCountChart": {
|
||||||
|
"empty": "No data",
|
||||||
|
"title": "# of running containers"
|
||||||
|
}
|
||||||
|
},
|
||||||
"fallback": {
|
"fallback": {
|
||||||
"actionButton": "Create a monitor!",
|
"actionButton": "Create a monitor!",
|
||||||
"checks": [
|
"checks": [
|
||||||
@@ -531,30 +563,6 @@
|
|||||||
"headers": {
|
"headers": {
|
||||||
"runningContainers": "Running containers"
|
"runningContainers": "Running containers"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"details": {
|
|
||||||
"dockerContainerCard": {
|
|
||||||
"title": "Container: {{name}}",
|
|
||||||
"fields": {
|
|
||||||
"status": "Status",
|
|
||||||
"health": "Health",
|
|
||||||
"id": "ID",
|
|
||||||
"image": "Image",
|
|
||||||
"ports": "Ports"
|
|
||||||
},
|
|
||||||
"values": {
|
|
||||||
"healthy": "Healthy",
|
|
||||||
"unhealthy": "Unhealthy"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"healthyChart": {
|
|
||||||
"title": "Healthy container %",
|
|
||||||
"empty": "No data"
|
|
||||||
},
|
|
||||||
"runningChart": {
|
|
||||||
"title": "Running container %",
|
|
||||||
"empty": "No data"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"infrastructure": {
|
"infrastructure": {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { BasePage, StatBox } from "@/components/design-elements";
|
|||||||
import {
|
import {
|
||||||
HeaderControls,
|
HeaderControls,
|
||||||
HeaderRange,
|
HeaderRange,
|
||||||
|
BarDockerCount,
|
||||||
HistogramDockerPercentage,
|
HistogramDockerPercentage,
|
||||||
} from "@/components/monitors";
|
} from "@/components/monitors";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
@@ -38,7 +39,7 @@ const DockerDetailsPage = () => {
|
|||||||
const monitor = response?.data?.monitor;
|
const monitor = response?.data?.monitor;
|
||||||
const stats = response?.data?.stats;
|
const stats = response?.data?.stats;
|
||||||
const checks = (response?.data?.checks || []) as any;
|
const checks = (response?.data?.checks || []) as any;
|
||||||
const snapshot = monitor?.latestChecks?.[0].containerSnapshot || [];
|
const snapshot = monitor?.latestChecks?.[0].dockerContainers || [];
|
||||||
const palette = getStatusPalette(monitor?.status || "initializing");
|
const palette = getStatusPalette(monitor?.status || "initializing");
|
||||||
|
|
||||||
const streakDuration = stats?.currentStreakStartedAt
|
const streakDuration = stats?.currentStreakStartedAt
|
||||||
@@ -85,6 +86,20 @@ const DockerDetailsPage = () => {
|
|||||||
<CardDockerContainer key={c.container_id} container={c} />
|
<CardDockerContainer key={c.container_id} container={c} />
|
||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<BarDockerCount
|
||||||
|
data={checks}
|
||||||
|
dataKey="healthyContainers"
|
||||||
|
range={range}
|
||||||
|
title={t("monitors.docker.details.healthyCountChart.title")}
|
||||||
|
emptyText={t("monitors.docker.details.healthyCountChart.empty")}
|
||||||
|
/>
|
||||||
|
<BarDockerCount
|
||||||
|
data={checks}
|
||||||
|
dataKey="runningContainers"
|
||||||
|
range={range}
|
||||||
|
title={t("monitors.docker.details.runningCountChart.title")}
|
||||||
|
emptyText={t("monitors.docker.details.runningCountChart.empty")}
|
||||||
|
/>
|
||||||
<HistogramDockerPercentage
|
<HistogramDockerPercentage
|
||||||
data={checks}
|
data={checks}
|
||||||
dataKey="healthyPercent"
|
dataKey="healthyPercent"
|
||||||
@@ -96,8 +111,8 @@ const DockerDetailsPage = () => {
|
|||||||
data={checks}
|
data={checks}
|
||||||
dataKey="runningPercent"
|
dataKey="runningPercent"
|
||||||
range={range}
|
range={range}
|
||||||
title={t("monitors.docker.details.runningChart.title")}
|
title={t("monitors.docker.details.healthyChart.title")}
|
||||||
emptyText={t("monitors.docker.details.runningChart.empty")}
|
emptyText={t("monitors.docker.details.healthyChart.empty")}
|
||||||
/>
|
/>
|
||||||
</BasePage>
|
</BasePage>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -116,8 +116,10 @@ export const DockerMonitorsTable = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
render: (row) => {
|
render: (row) => {
|
||||||
const containerCount = (row.latestChecks?.[0]?.dockerContainers || [])
|
console.log(row);
|
||||||
.length;
|
const containerCount = (
|
||||||
|
row.latestChecks?.[0]?.dockerContainers || []
|
||||||
|
).filter((c: any) => c?.running).length;
|
||||||
return containerCount;
|
return containerCount;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ export interface ICheck {
|
|||||||
lighthouse?: ICheckLighthouseFields;
|
lighthouse?: ICheckLighthouseFields;
|
||||||
system?: ISystemInfo;
|
system?: ISystemInfo;
|
||||||
// Present for docker monitor checks
|
// Present for docker monitor checks
|
||||||
containerSnapshot?: IDockerContainerSummary[];
|
dockerContainers?: IDockerContainerSummary[];
|
||||||
}
|
}
|
||||||
export interface CheckWithMonitor {
|
export interface CheckWithMonitor {
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|||||||
Reference in new issue
Block a user