mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
- Integrated profiling initialization in Probe, Telemetry, TestServer, and Worker services. - Added environment variables for enabling profiling in various services. - Created Profiling utility to handle CPU profiling and send data to OTLP endpoint. - Introduced new metric types for exceptions, spans, and dashboards. - Developed utility classes for handling alert and incident metrics. - Added new React components for displaying alert and incident metrics in the dashboard.
245 lines
5.9 KiB
TypeScript
245 lines
5.9 KiB
TypeScript
import PageMap from "../../../Utils/PageMap";
|
|
import RouteMap, { RouteUtil } from "../../../Utils/RouteMap";
|
|
import Route from "Common/Types/API/Route";
|
|
import IconProp from "Common/Types/Icon/IconProp";
|
|
import MonitorType, {
|
|
MonitorTypeHelper,
|
|
} from "Common/Types/Monitor/MonitorType";
|
|
import ObjectID from "Common/Types/ObjectID";
|
|
import SideMenu, {
|
|
SideMenuSectionProps,
|
|
SideMenuItemProps,
|
|
} from "Common/UI/Components/SideMenu/SideMenu";
|
|
import React, { FunctionComponent, ReactElement } from "react";
|
|
|
|
export interface ComponentProps {
|
|
modelId: ObjectID;
|
|
monitorType: MonitorType;
|
|
}
|
|
|
|
const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
|
props: ComponentProps,
|
|
): ReactElement => {
|
|
const isProbeableMonitor: boolean = MonitorTypeHelper.isProbableMonitor(
|
|
props.monitorType,
|
|
);
|
|
|
|
const isManualMonitor: boolean = MonitorTypeHelper.isManualMonitor(
|
|
props.monitorType,
|
|
);
|
|
|
|
const isTelemetryMonitor: boolean = MonitorTypeHelper.isTelemetryMonitor(
|
|
props.monitorType,
|
|
);
|
|
|
|
// Overview section items
|
|
const overviewItems: SideMenuItemProps[] = [
|
|
{
|
|
link: {
|
|
title: "Overview",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Info,
|
|
},
|
|
];
|
|
|
|
overviewItems.push({
|
|
link: {
|
|
title: "Metrics",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_METRICS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Graph,
|
|
});
|
|
|
|
overviewItems.push({
|
|
link: {
|
|
title: "Status Timeline",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_STATUS_TIMELINE] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.List,
|
|
});
|
|
|
|
// Activity section items
|
|
const activityItems: SideMenuItemProps[] = [
|
|
{
|
|
link: {
|
|
title: "Incidents",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_INCIDENTS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Alert,
|
|
},
|
|
{
|
|
link: {
|
|
title: "Alerts",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_ALERTS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.ExclaimationCircle,
|
|
},
|
|
{
|
|
link: {
|
|
title: "Notification Logs",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_NOTIFICATION_LOGS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Bell,
|
|
},
|
|
];
|
|
|
|
if (!isManualMonitor && !isTelemetryMonitor) {
|
|
activityItems.push({
|
|
link: {
|
|
title: "Monitoring Logs",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_LOGS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Logs,
|
|
});
|
|
}
|
|
|
|
// Configuration section items
|
|
const configurationItems: SideMenuItemProps[] = [];
|
|
|
|
if (MonitorTypeHelper.doesMonitorTypeHaveCriteria(props.monitorType)) {
|
|
configurationItems.push({
|
|
link: {
|
|
title: "Criteria",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_CRITERIA] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Criteria,
|
|
});
|
|
}
|
|
|
|
if (isProbeableMonitor) {
|
|
configurationItems.push({
|
|
link: {
|
|
title: "Interval",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_INTERVAL] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Clock,
|
|
});
|
|
|
|
configurationItems.push({
|
|
link: {
|
|
title: "Probes",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_PROBES] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Signal,
|
|
});
|
|
}
|
|
|
|
if (MonitorTypeHelper.doesMonitorTypeHaveDocumentation(props.monitorType)) {
|
|
configurationItems.push({
|
|
link: {
|
|
title: "Documentation",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_DOCUMENTATION] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Book,
|
|
});
|
|
}
|
|
|
|
// Settings section items
|
|
const settingsItems: SideMenuItemProps[] = [
|
|
{
|
|
link: {
|
|
title: "Owners",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_OWNERS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Team,
|
|
},
|
|
{
|
|
link: {
|
|
title: "Custom Fields",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_CUSTOM_FIELDS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.TableCells,
|
|
},
|
|
{
|
|
link: {
|
|
title: "Settings",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_SETTINGS] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Settings,
|
|
},
|
|
{
|
|
link: {
|
|
title: "Delete Monitor",
|
|
to: RouteUtil.populateRouteParams(
|
|
RouteMap[PageMap.MONITOR_VIEW_DELETE] as Route,
|
|
{ modelId: props.modelId },
|
|
),
|
|
},
|
|
icon: IconProp.Trash,
|
|
className: "danger-on-hover",
|
|
},
|
|
];
|
|
|
|
// Build sections array
|
|
const sections: SideMenuSectionProps[] = [
|
|
{
|
|
title: "Overview",
|
|
items: overviewItems,
|
|
},
|
|
{
|
|
title: "Activity",
|
|
items: activityItems,
|
|
},
|
|
];
|
|
|
|
// Only add Configuration section if there are items
|
|
if (configurationItems.length > 0) {
|
|
sections.push({
|
|
title: "Configuration",
|
|
items: configurationItems,
|
|
});
|
|
}
|
|
|
|
sections.push({
|
|
title: "Settings",
|
|
items: settingsItems,
|
|
});
|
|
|
|
return <SideMenu sections={sections} />;
|
|
};
|
|
|
|
export default DashboardSideMenu;
|