Skip to content

Commit

Permalink
Add monitoring to obproxy (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1666204 authored Jun 18, 2024
1 parent 5e9bbc5 commit f31ae6a
Show file tree
Hide file tree
Showing 24 changed files with 307 additions and 106 deletions.
1 change: 1 addition & 0 deletions ui/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"postinstall": "max setup",
"lint": "eslint src",
"oic:clear": "oic --configPath ./must.cjs --clear",
"oic:extract": "oic --configPath ./must.cjs --extract --translate",
"oic:extract": "oic --configPath ./must.cjs --extract",
"prepare": "cd .. && husky ui/.husky",
"setup": "max setup",
"start": "npm run dev"
Expand Down
28 changes: 11 additions & 17 deletions ui/src/components/MonitorDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import dayjs from 'dayjs';
import { useEffect, useRef, useState } from 'react';

import MonitorComp from '@/components/MonitorComp';
import { REFRESH_FREQUENCY } from '@/constants';
import { DEFAULT_QUERY_RANGE, REFRESH_FREQUENCY } from '@/constants';
import DataFilter from './DataFilter';

interface MonitorDetailProps {
filterData: Monitor.FilterDataType;
setFilterData:React.Dispatch<React.SetStateAction<Monitor.FilterDataType>>;
basicInfo:JSX.Element | null | undefined;
filterLabel:Monitor.LabelType[];
setFilterLabel:React.Dispatch<React.SetStateAction<Monitor.LabelType[]>>;
groupLabels:API.LableKeys[];
queryScope:API.EventObjectType;
setFilterData: React.Dispatch<React.SetStateAction<Monitor.FilterDataType>>;
basicInfo: JSX.Element | null | undefined;
filterLabel: Monitor.LabelType[];
setFilterLabel: React.Dispatch<React.SetStateAction<Monitor.LabelType[]>>;
groupLabels: API.LableKeys[];
queryScope: API.EventObjectType;
}

const getDate = () => {
Expand All @@ -22,12 +22,6 @@ const getDate = () => {
.format('YYYY-MM-DD HH:mm:ss');
};

const defaultQueryRange = {
step: 20,
endTimestamp: Math.floor(new Date().valueOf() / 1000),
startTimestamp: Math.floor(new Date().valueOf() / 1000) - 60 * 30,
};

//Query is somewhat similar to sql statement, label is equivalent to filter condition,for example: where label1=xxx and label2 = xxx
export default function MonitorDetail({
filterData,
Expand All @@ -36,14 +30,14 @@ export default function MonitorDetail({
setFilterLabel,
basicInfo,
groupLabels,
queryScope
}:MonitorDetailProps) {
queryScope,
}: MonitorDetailProps) {
const [isRefresh, setIsRefresh] = useState<boolean>(false);
const [realTime, setRealTime] = useState<string>(getDate());
const timerRef = useRef<NodeJS.Timeout>();
const updateTimer = useRef<NodeJS.Timer>();
const [queryRange, setQueryRange] =
useState<Monitor.QueryRangeType>(defaultQueryRange);
useState<Monitor.QueryRangeType>(DEFAULT_QUERY_RANGE);
const newQueryRangeRef = useRef<Monitor.QueryRangeType>(); //Only used to solve the problem of not getting the latest value in interval

useUpdateEffect(() => {
Expand Down Expand Up @@ -84,7 +78,7 @@ export default function MonitorDetail({

return (
<div style={{ marginTop: 12 }}>
{ basicInfo }
{basicInfo}
<DataFilter
realTime={realTime}
isRefresh={isRefresh}
Expand Down
15 changes: 15 additions & 0 deletions ui/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const COLOR_MAP = new Map([
['creating', 'blue'],
['failed', 'red'],
]);
const OBPROXY_COLOR_MAP = new Map([
['Running', 'geekblue'],
['Pending', 'gold'],
]);
const CLUSTER_IMG_MAP = new Map([
['running', clusterRunning],
['deleting', clusterOperating],
Expand All @@ -45,6 +49,8 @@ const BADGE_IMG_MAP = new Map([

const REFRESH_TENANT_TIME = 5000;

const REFRESH_OBPROXY_TIME = 3000;

const REFRESH_CLUSTER_TIME = 10000;
// Monitor automatic refresh interval 15s
const REFRESH_FREQUENCY = 15;
Expand Down Expand Up @@ -327,6 +333,12 @@ const SERVICE_TYPE = [
},
];

const DEFAULT_QUERY_RANGE: Monitor.QueryRangeType = {
step: 20,
endTimestamp: Math.floor(new Date().valueOf() / 1000),
startTimestamp: Math.floor(new Date().valueOf() / 1000) - 60 * 30,
};

export {
ALERT_STATE_MAP,
BACKUP_RESULT_STATUS,
Expand All @@ -336,14 +348,17 @@ export {
CLUSTER_IMG_MAP,
CLUSTER_INFO_CONFIG,
COLOR_MAP,
DEFAULT_QUERY_RANGE,
LEVER_OPTIONS_ALARM,
MINIMAL_CONFIG,
MIN_RESOURCE_CONFIG,
MODE_MAP,
OBJECT_OPTIONS_ALARM,
OBPROXY_COLOR_MAP,
POINT_NUMBER,
REFRESH_CLUSTER_TIME,
REFRESH_FREQUENCY,
REFRESH_OBPROXY_TIME,
REFRESH_TENANT_TIME,
RESULT_STATUS,
SERVER_IMG_MAP,
Expand Down
42 changes: 42 additions & 0 deletions ui/src/i18n/strings/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,17 @@
"Dashboard.Cluster.Detail.AbnormalOperation": "Tenant is not functioning properly",
"src.pages.Alert.AlarmFilter.95B30216": "Object Type",
"src.constants.041D1159": "Expired",
"src.pages.OBProxy.New.D6D90ACC": "Name of the resource in k8s",
"src.pages.OBProxy.New.37FA27BA": "Resource names cannot use pure numbers",
"src.pages.Alert.Subscriptions.44ED2092": "It cannot be restored after deletion, please operate with caution.",
"src.pages.OBProxy.Detail.Overview.DF444F52": "Node Information",
"src.pages.Alert.Rules.363B4BDE": "summary Information",
"src.pages.OBProxy.Detail.Overview.9D704A15": "Deployment image:",
"src.pages.OBProxy.Detail.Overview.8A75D872": "Please Select",
"src.pages.OBProxy.Detail.Overview.3CF533BE": "Pod name",
"src.pages.Alert.Channel.9091A7E9": "Operation successful!",
"src.pages.Alert.Event.0358EEE4": "Event List",
"src.pages.OBProxy.New.7C04AD55": "Please enter",
"src.constants.53A94A0E": "Reminder",
"src.pages.Alert.Channel.6B0B7626": "Please enter",
"src.pages.Alert.Rules.5D79276F": "Operation successful!",
Expand All @@ -727,6 +731,7 @@
"src.pages.Alert.Subscriptions.F8964AD2": "Please enter",
"src.pages.Alert.Rules.72206E63": "Alarm Rule Configuration",
"src.constants.661BB167": "Reminder",
"src.pages.OBProxy.New.9B4BA02B": "Please enter",
"src.pages.Alert.Rules.DA9CF3DF": "After deletion, the rule Group and alarm template that reference the alarm rule will simultaneously delete the configuration of the alarm rule, please operate with caution.",
"src.pages.Alert.Rules.1E26B90F": "Labels added to alert event",
"src.pages.Alert.6261133D": "Alarm Rules",
Expand All @@ -738,24 +743,29 @@
"src.pages.Alert.Event.EDED9514": "Alarm object",
"src.pages.Alert.Subscriptions.7CCE86F7": "Repeat interval for alert messages",
"src.pages.Alert.Rules.7789B7EF": "Default",
"src.pages.OBProxy.Detail.Overview.52C1F09A": "Please enter",
"src.constants.7BCA3313": "Active",
"src.pages.OBProxy.New.D41C48E1": "Resource Name",
"src.pages.Alert.Event.90B9AC55": "Generation time",
"src.pages.Layouts.DetailLayout.BC23B91F": "Alarm",
"src.pages.Alert.Shield.460BD8D2": "Are you sure to remove this alarm mask condition?",
"src.pages.OBProxy.Detail.Overview.5DDD1A0A": "Memory size:",
"src.pages.OBProxy.Detail.Overview.680A1826": "Detailed Configuration",
"src.pages.Alert.Shield.04F03990": "Operation successful!",
"src.pages.Alert.Channel.DBCB373E": "New alarm Channel",
"src.pages.OBProxy.New.49694AC5": "Successfully created!",
"src.pages.Alert.Rules.0EAD0426": "Please check whether the label is completely entered",
"src.pages.Alert.Shield.7EDD5A25": "Mask End Time",
"src.pages.Alert.Subscriptions.7C1E1B2A": "Please Select",
"src.components.InputTimeComp.5C00F6E6": "Seconds",
"src.pages.Alert.Rules.0FF3431E": "Please enter",
"src.pages.OBProxy.New.F602E292": "Please enter k8s resource name",
"src.pages.Alert.AlarmFilter.0FEF961B": "Please Select",
"src.pages.OBProxy.Detail.Overview.00DC8B97": "OB cluster",
"src.components.InputLabelComp.DC297030": "Please enter a tag value",
"src.constants.FB06E464": "Tenant",
"src.pages.Alert.Event.929C9905": "End Time",
"src.pages.OBProxy.Detail.Overview.2DA6A0A7": "Number of copies",
"src.pages.OBProxy.New.B2851499": "Please enter",
"src.pages.Alert.Event.3EAC0543": "Object:",
"src.pages.Alert.Rules.C8C937C1": "Object Type",
Expand All @@ -778,9 +788,11 @@
"src.pages.OBProxy.Detail.Overview.2F1969E2": "Creation time",
"src.pages.Alert.Shield.FDAD010D": "Permanent",
"src.pages.Alert.Shield.0A4B5A6C": "Please Select",
"src.pages.OBProxy.Detail.Overview.DBE1B6C0": "Service Type",
"src.pages.Alert.Rules.E336DF4E": "Please enter",
"src.pages.Alert.Rules.F333E1DF": "Operation",
"src.pages.Alert.Subscriptions.898A358F": "Alarm Channel",
"src.pages.OBProxy.New.94339826": "Please select OB cluster",
"src.pages.Alert.Rules.B943644E": "Rule List",
"src.pages.Alert.Shield.3B8541B0": "Tenant",
"src.pages.Alert.Subscriptions.D2F05048": "Aggregation Configuration",
Expand All @@ -795,21 +807,26 @@
"src.pages.OBProxy.Detail.Overview.B42C8F94": "Namespace",
"src.pages.OBProxy.Detail.Overview.D21304DA": "SQL Port",
"src.constants.CA3D7CB8": "Warning",
"src.pages.OBProxy.Detail.Overview.A4448DF2": "Number of CPU cores",
"src.pages.Alert.Rules.C6233D40": "Trigger rule",
"src.pages.OBProxy.614C7DA9": "Status",
"src.pages.Alert.5ECB5E4A": "{duration} seconds",
"src.pages.Alert.Channel.02ABEE1E": "Channel Configuration",
"src.pages.Alert.AlarmFilter.8C7CB828": "Please Select",
"src.pages.OBProxy.New.D4645164": "Please enter",
"src.pages.Alert.Rules.50003344": "Please enter",
"src.pages.OBProxy.New.F830C6B7": "Basic Settings",
"src.pages.Alert.Subscriptions.DD88FE8C": "Label",
"src.pages.OBProxy.Detail.Overview.2FA13720": "Please enter",
"src.pages.Alert.Subscriptions.9FAEA249": "Please Select",
"src.pages.OBProxy.Detail.Overview.E0E978D2": "OBProxy root password",
"src.pages.Alert.Event.BD73F875": "Operation",
"src.pages.Alert.Shield.5F7B1190": "Please Select",
"src.pages.Alert.Subscriptions.9CB5A5C8": "Time interval for aggregrate alert messages",
"src.pages.Alert.Shield.42A3A94B": "1 day",
"src.pages.OBProxy.New.7CAF48E9": "Detailed Configuration",
"src.pages.Alert.Shield.F061005B": "Edit",
"src.pages.OBProxy.Detail.Overview.4AB0B6DC": "Basic information",
"src.pages.Alert.Rules.224DA83F": "Custom",
"src.pages.Alert.Shield.1EFE1B33": "Please Select",
"src.pages.Alert.Rules.B46056EE": "Alarm rule already exists, please re-enter",
Expand All @@ -823,6 +840,7 @@
"src.pages.Alert.Subscriptions.B477E130": "Match Configuration",
"src.pages.Alert.Subscriptions.971D4038": "Please check whether the label is completely entered",
"src.pages.OBProxy.807D961E": "OBProxy cluster name",
"src.pages.OBProxy.New.BB6BC872": "OBProxy cluster name",
"src.pages.Alert.Shield.639D1A8C": "Please Select",
"src.pages.Alert.Subscriptions.73FA804B": "Push Configuration",
"src.pages.OBProxy.New.DEF127D3": "Please enter",
Expand All @@ -831,17 +849,20 @@
"src.pages.Alert.Event.19D28466": "Alarm event",
"src.pages.Alert.Rules.528ED58D": "Please Select",
"src.pages.Alert.Shield.00AF8CB8": "12 hours",
"src.pages.OBProxy.New.2C466A93": "Basic information",
"src.pages.Alert.Channel.5A64A44C": "Config receiver in yaml format. For more information, see",
"src.pages.Alert.Shield.8F7F01F0": "Status",
"src.pages.OBProxy.Detail.Overview.1CA5DF47": "Details of OBProxy",
"src.pages.Alert.Channel.A3D31BA5": "Please Select",
"src.pages.OBProxy.0608BC29": "Cluster List",
"src.pages.Alert.Channel.7965888F": "Alarm channel already exists, please re-enter",
"src.pages.Alert.Subscriptions.7237B7FE": "(Optional)",
"src.pages.OBProxy.New.A3E900B4": "Number of copies",
"src.constants.D7C4C6F1": "Active",
"src.pages.Alert.Shield.0EEFD182": "Host",
"src.constants.9076A376": "Warning",
"src.pages.Alert.Shield.65BD013B": "New Shield",
"src.pages.OBProxy.New.803427AF": "Resource Name",
"src.pages.Alert.Rules.B7B764AE": "Please enter",
"src.pages.OBProxy.New.7D1609DD": "Connect to the OB cluster",
"src.constants.5D9B444A": "Cluster",
Expand All @@ -862,6 +883,7 @@
"src.pages.Layouts.BasicLayout.EDA4D7D9": "Alarm",
"src.constants.BA2DCE55": "Serious",
"src.pages.Alert.Event.AB6EB56A": "Type:",
"src.pages.OBProxy.Detail.Overview.3F3066D5": "Please enter",
"src.components.InputLabelComp.36DDAD02": "Please enter a tag name",
"src.pages.Alert.AlarmFilter.55C14EBD": "Please Select",
"src.pages.OBProxy.Detail.Overview.E31DF8FD": "OBProxy cluster name",
Expand All @@ -874,8 +896,10 @@
"src.pages.Tenant.Detail.Overview.56424605": "Full backup: Weekly",
"src.pages.Alert.Subscriptions.CBA8D190": "Aggregation interval",
"src.pages.Alert.Rules.EF19C6D7": "Delete",
"src.pages.OBProxy.Detail.Overview.A6701513": "Please enter",
"src.pages.Alert.5208FED8": "Alarm Channel",
"src.pages.Alert.Shield.2E5B9DD9": "Please select a cluster",
"src.pages.OBProxy.New.0AE478F2": "Please Select",
"src.pages.Alert.Event.8BDBE511": "Alarm level",
"src.pages.Alert.Shield.3D1B719E": "Please Select",
"src.pages.Alert.Channel.152DCAE7": "Delete",
Expand All @@ -889,14 +913,17 @@
"src.pages.Alert.AlarmFilter.D5B81118": "Please Select",
"src.pages.Alert.Channel.BD932A40": "Please enter",
"src.pages.Alert.Channel.B1B680BD": "Channel Type",
"src.pages.OBProxy.New.0C4EFBB0": "Resource Settings",
"src.components.AlertDrawer.95C6A631": "Submission",
"src.pages.Alert.Shield.90D196D5": "Mask List",
"src.pages.OBProxy.New.2D601471": "OBProxy cluster name",
"src.pages.OBProxy.New.67DC144A": "Please enter OBProxy root password",
"src.pages.Alert.Shield.DC28F74E": "All tenants",
"src.pages.OBProxy.New.80C781AA": "Please Select",
"src.pages.OBProxy.Detail.Overview.80FE51DD": "Status",
"src.components.InputLabelComp.D089EBDE": "Cancel",
"src.pages.Alert.Subscriptions.A797D56B": "Match Configuration",
"src.pages.OBProxy.New.134CD1CE": "Parameter setting",
"src.pages.OBProxy.New.6B7B9E9A": "Please enter",
"src.pages.OBProxy.B8BB1499": "Corresponding OB cluster",
"src.pages.Alert.Shield.1AC4B3C9": "Please enter",
Expand All @@ -908,8 +935,10 @@
"src.pages.Alert.AlarmFilter.6AF2BC90": "Reset",
"src.pages.Alert.Rules.873B1514": "Edit",
"src.pages.OBProxy.Detail.Overview.6137B053": "Number of CPU cores:",
"src.pages.OBProxy.New.88D0BC94": "Service Type",
"src.pages.Alert.Subscriptions.19CF4790": "Push Cycle",
"src.pages.Alert.Shield.4AE1863A": "Please select {nextFormName! [1] === 'observer '? 'Host': 'Tenant'}",
"src.pages.OBProxy.Detail.Overview.F9D66FC0": "Resource Settings",
"src.pages.OBProxy.Detail.Overview.6AE22B46": "Resource Settings",
"src.pages.Alert.Shield.A519C403": "Please Select",
"src.pages.Alert.Rules.C7EBBB92": "Tenant",
Expand All @@ -920,6 +949,7 @@
"src.pages.OBProxy.New.E9A192AB": "Please enter",
"src.pages.Alert.542DC103": "Alarm event",
"src.pages.Alert.Shield.B0133BD9": "Please select a cluster",
"src.pages.OBProxy.New.2F497A97": "Please Select",
"src.pages.Alert.Subscriptions.E6F8DAA7": "Aggregate Wait Time",
"src.pages.Alert.Rules.412594B9": "Please enter",
"src.pages.Alert.Shield.74A00B6E": "Tenant",
Expand All @@ -928,20 +958,26 @@
"src.pages.Alert.Subscriptions.73CAD042": "Delete",
"src.pages.Alert.Rules.18FF1D51": "Alarm level",
"src.components.InputLabelComp.6C88A39D": "Add",
"src.pages.OBProxy.Detail.Overview.0075C2B3": "Memory size",
"src.pages.Alert.Shield.248B977C": "Please Select",
"src.pages.OBProxy.Detail.Overview.8E87D135": "Add",
"src.pages.Alert.Shield.68A6FF3F": "Mask Object",
"src.pages.Alert.Channel.44150BAB": "Channel Type",
"src.pages.Alert.Shield.07F07EAE": "Disarm",
"src.components.InputTimeComp.7D0C8989": "Minutes",
"src.pages.Alert.Shield.0CCBF1B7": "6 hours",
"src.pages.Alert.Subscriptions.3988FFB5": "Channel Name",
"src.pages.OBProxy.New.AEDDBA86": "Please enter",
"src.pages.OBProxy.Detail.Overview.D537DD35": "Parameter setting",
"src.pages.Alert.Subscriptions.3DB73ECC": "Push Configuration",
"src.pages.Alert.Subscriptions.BA84E413": "{isEdit? 'Modify': 'Create'} Success!",
"src.pages.OBProxy.9928287A": "Version",
"src.pages.Alert.Rules.8DE8BA49": "Summary message templates of alert event, use {{ }} to mark values to be replaced",
"src.pages.Alert.AlarmFilter.E48EC601": "Please enter a keyword",
"src.pages.Alert.Rules.63C9E8E6": "Please enter",
"src.pages.Alert.Channel.217A737A": "Channel Configuration",
"src.pages.OBProxy.Detail.Overview.A9BB34D6": "Operation successful!",
"src.pages.OBProxy.New.CE387455": "Memory size",
"src.pages.Alert.Rules.E04B7BC2": "Please enter",
"src.pages.OBProxy.New.3A4BDC5D": "Cancel",
"src.pages.Alert.Event.26E65D10": "Alarm status",
Expand All @@ -951,9 +987,12 @@
"src.pages.Alert.Rules.821C3FA7": "Alarm level",
"src.pages.OBProxy.EFFF5E84": "Create an OBProxy cluster",
"src.pages.Alert.Channel.FDBFEACE": "Cancel",
"src.components.CustomFormItem.2C6315A1": "Please enter",
"src.pages.OBProxy.Detail.Overview.6258C614": "Edit",
"src.components.InputTimeComp.C34DD7B4": "Hours",
"src.pages.OBProxy.New.CCD9785D": "Please select a service type",
"src.pages.Alert.Subscriptions.22115027": "Please enter",
"src.pages.OBProxy.Detail.Overview.FEBB24FF": "Deleting a parameter in the list does not restore the previously set parameter. If you want the parameter to take effect immediately, overwrite the parameter to the original value or restart the cluster.",
"src.constants.D953F862": "Not treated",
"src.pages.Alert.Shield.376304F5": "Masking alarm rules",
"src.pages.OBProxy.C2D80635": "Creation time",
Expand All @@ -964,6 +1003,8 @@
"src.pages.OBProxy.Detail.Overview.CE7D4E98": "Status",
"src.pages.Alert.Rules.3FB7D236": "Are you sure you want to delete the {recordName} alert rule?",
"src.pages.Alert.Shield.E49D589A": "Please enter",
"src.pages.OBProxy.Detail.Overview.E7B1B575": "Please Select",
"src.pages.OBProxy.New.CA42FD5D": "Please enter a cluster name",
"src.constants.F77CCEC3": "Inhibit",
"src.pages.OBProxy.New.00532253": "Create an OBProxy cluster",
"src.pages.Alert.AlarmFilter.A578D30E": "Expand",
Expand All @@ -973,6 +1014,7 @@
"src.pages.Alert.Rules.179A6ACF": "Please enter",
"src.pages.Alert.Rules.14235DA8": "Alarm rule name",
"src.pages.OBProxy.Detail.Overview.6E321376": "Basic Settings",
"src.pages.OBProxy.New.6A1E93D2": "Number of CPU cores",
"src.pages.Alert.Subscriptions.15BFC65C": "Push Cycle",
"src.pages.Alert.Rules.77E702BB": "Alarm rule name",
"src.pages.Alert.Shield.13E125D2": "Operation",
Expand Down
8 changes: 7 additions & 1 deletion ui/src/i18n/strings/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1021,5 +1021,11 @@
"src.pages.OBProxy.Detail.Overview.D537DD35": "参数设置",
"src.pages.OBProxy.Detail.Overview.8A75D872": "请选择",
"src.pages.OBProxy.Detail.Overview.8E87D135": "添加",
"src.components.CustomFormItem.2C6315A1": "请输入"
"src.components.CustomFormItem.2C6315A1": "请输入",
"src.pages.OBProxy.New.2C466A93": "基本信息",
"src.pages.OBProxy.New.0AE478F2": "请选择",
"src.pages.OBProxy.Detail.Overview.A9BB34D6": "操作成功!",
"src.pages.OBProxy.Detail.Overview.FEBB24FF": "删除列表中的参数并不会将原来已经设置的参数复原,如果需要参数立即生效,请覆盖参数为原值或者重启集群",
"src.pages.OBProxy.Detail.Overview.A6701513": "请输入",
"src.pages.OBProxy.Detail.Overview.4AB0B6DC": "基本信息"
}
Loading

0 comments on commit f31ae6a

Please sign in to comment.