@oneuptime/common 7.0.3212 → 7.0.3227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/Index.ts +0 -2
- package/Models/AnalyticsModels/Metric.ts +39 -1
- package/Server/API/BaseAnalyticsAPI.ts +11 -0
- package/Server/Services/AnalyticsDatabaseService.ts +17 -7
- package/Server/Services/DatabaseService.ts +11 -3
- package/Server/Services/Index.ts +0 -2
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +18 -4
- package/Server/Utils/Monitor/Criteria/EvaluateOverTime.ts +21 -21
- package/Server/Utils/Monitor/MonitorResource.ts +186 -127
- package/Server/Utils/Telemetry/Telemetry.ts +154 -0
- package/Types/BaseDatabase/AggregateBy.ts +2 -0
- package/Types/BaseDatabase/AggregatedModel.ts +3 -0
- package/Types/Dashboard/DashboardComponents/DashboardTextComponent.ts +3 -0
- package/Types/Dashboard/DashboardSize.ts +108 -4
- package/Types/Icon/IconProp.ts +5 -0
- package/Types/Metrics/MetricsQuery.ts +8 -0
- package/Types/Monitor/CriteriaFilter.ts +0 -36
- package/Types/Monitor/MonitorMetricType.ts +11 -0
- package/Types/Monitor/MonitorType.ts +18 -0
- package/UI/Components/Button/Button.tsx +48 -37
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +1 -1
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +2 -2
- package/UI/Components/Charts/Line/LineChart.tsx +2 -2
- package/UI/Components/Icon/Icon.tsx +39 -0
- package/Utils/Dashboard/Components/DashboardChartComponent.ts +1 -1
- package/Utils/Dashboard/Components/DashboardTextComponent.ts +4 -1
- package/Utils/Dashboard/DashboardViewConfig.ts +8 -8
- package/Utils/Monitor/MonitorMetricType.ts +142 -0
- package/build/dist/Models/AnalyticsModels/Index.js +0 -2
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Metric.js +36 -1
- package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
- package/build/dist/Server/API/BaseAnalyticsAPI.js +7 -0
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +7 -0
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +6 -1
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +0 -2
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +13 -4
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js +9 -8
- package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +164 -98
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/Telemetry.js +100 -0
- package/build/dist/Server/Utils/Telemetry/Telemetry.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardSize.js +41 -3
- package/build/dist/Types/Dashboard/DashboardSize.js.map +1 -1
- package/build/dist/Types/Icon/IconProp.js +5 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +0 -29
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorMetricType.js +12 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +14 -0
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/UI/Components/Button/Button.js +18 -11
- package/build/dist/UI/Components/Button/Button.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +15 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js +4 -1
- package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/DashboardViewConfig.js +8 -7
- package/build/dist/Utils/Dashboard/DashboardViewConfig.js.map +1 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js +118 -0
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -0
- package/package.json +2 -2
- package/Models/AnalyticsModels/MonitorMetricsByMinute.ts +0 -177
- package/Server/Services/MonitorMetricsByMinuteService.ts +0 -14
- package/build/dist/Models/AnalyticsModels/MonitorMetricsByMinute.js +0 -149
- package/build/dist/Models/AnalyticsModels/MonitorMetricsByMinute.js.map +0 -1
- package/build/dist/Server/Services/MonitorMetricsByMinuteService.js +0 -12
- package/build/dist/Server/Services/MonitorMetricsByMinuteService.js.map +0 -1
|
@@ -7,11 +7,115 @@ const DefaultDashboardSize: DashboardSize = {
|
|
|
7
7
|
widthInDashboardUnits: 12,
|
|
8
8
|
heightInDashboardUnits: 60,
|
|
9
9
|
};
|
|
10
|
-
// 5 rem is the dashboard unit width, and 0.94 is margin between those units.
|
|
11
10
|
|
|
12
|
-
export const
|
|
11
|
+
export const SpaceBetweenUnitsInPx: number = 10;
|
|
12
|
+
export const MarginForEachUnitInPx: number = 10 / 2;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type GetDashboardUnitWidthInPxFunction = (
|
|
15
|
+
currentTotalDashboardWidthInPx: number,
|
|
16
|
+
) => number;
|
|
17
|
+
|
|
18
|
+
export const GetDashboardUnitWidthInPx: GetDashboardUnitWidthInPxFunction = (
|
|
19
|
+
currentTotalDashboardWidthInPx: number,
|
|
20
|
+
): number => {
|
|
21
|
+
return (
|
|
22
|
+
(currentTotalDashboardWidthInPx -
|
|
23
|
+
(DefaultDashboardSize.widthInDashboardUnits - 1) *
|
|
24
|
+
SpaceBetweenUnitsInPx) /
|
|
25
|
+
DefaultDashboardSize.widthInDashboardUnits
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type GetDashboardUnitHeightInPxFunction = (
|
|
30
|
+
currentTotalDashboardWidthInPx: number,
|
|
31
|
+
) => number;
|
|
32
|
+
|
|
33
|
+
export const GetDashboardUnitHeightInPx: GetDashboardUnitHeightInPxFunction = (
|
|
34
|
+
currentTotalDashboardWidthInPx: number,
|
|
35
|
+
): number => {
|
|
36
|
+
return GetDashboardUnitWidthInPx(currentTotalDashboardWidthInPx); // its a square, so height is the same as width
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type GetHeightOfDashboardComponentFunction = (
|
|
40
|
+
heightInDashboardUnits: number,
|
|
41
|
+
totalCurrentDashboardWidthInPx: number,
|
|
42
|
+
) => number;
|
|
43
|
+
|
|
44
|
+
export const GetHeightOfDashboardComponent: GetHeightOfDashboardComponentFunction =
|
|
45
|
+
(
|
|
46
|
+
heightInDashboardUnits: number,
|
|
47
|
+
totalCurrentDashboardWidthInPx: number,
|
|
48
|
+
): number => {
|
|
49
|
+
return (
|
|
50
|
+
heightInDashboardUnits *
|
|
51
|
+
GetDashboardUnitHeightInPx(totalCurrentDashboardWidthInPx) +
|
|
52
|
+
(heightInDashboardUnits - 1) * SpaceBetweenUnitsInPx
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type GetWidthOfDashboardComponentFunction = (
|
|
57
|
+
widthInDashboardUnits: number,
|
|
58
|
+
totalCurrentDashboardWidthInPx: number,
|
|
59
|
+
) => number;
|
|
60
|
+
|
|
61
|
+
export const GetWidthOfDashboardComponent: GetWidthOfDashboardComponentFunction =
|
|
62
|
+
(
|
|
63
|
+
widthInDashboardUnits: number,
|
|
64
|
+
totalCurrentDashboardWidthInPx: number,
|
|
65
|
+
): number => {
|
|
66
|
+
return (
|
|
67
|
+
widthInDashboardUnits *
|
|
68
|
+
GetDashboardUnitWidthInPx(totalCurrentDashboardWidthInPx) +
|
|
69
|
+
(widthInDashboardUnits - 1) * SpaceBetweenUnitsInPx
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
type GetDashboardComponentWidthInDashboardUnitsFunction = (
|
|
74
|
+
currentTotalDashboardWidthInPx: number,
|
|
75
|
+
componentWidthInPx: number,
|
|
76
|
+
) => number;
|
|
77
|
+
|
|
78
|
+
export const GetDashboardComponentWidthInDashboardUnits: GetDashboardComponentWidthInDashboardUnitsFunction =
|
|
79
|
+
(
|
|
80
|
+
currentTotalDashboardWidthInPx: number,
|
|
81
|
+
componentWidthInPx: number,
|
|
82
|
+
): number => {
|
|
83
|
+
const eachUnitSizeInPx: number =
|
|
84
|
+
currentTotalDashboardWidthInPx /
|
|
85
|
+
DefaultDashboardSize.widthInDashboardUnits; // each square is these many pixels
|
|
86
|
+
|
|
87
|
+
// now check how many squares can fit in the component width
|
|
88
|
+
const units: number = Math.ceil(componentWidthInPx / eachUnitSizeInPx);
|
|
89
|
+
|
|
90
|
+
if (units < 1) {
|
|
91
|
+
return 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return units;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
type GetDashboardComponentHeightInDashboardUnitsFunction = (
|
|
98
|
+
currentTotalDashboardWidthInPx: number,
|
|
99
|
+
componentHeightInPx: number,
|
|
100
|
+
) => number;
|
|
101
|
+
|
|
102
|
+
export const GetDashboardComponentHeightInDashboardUnits: GetDashboardComponentHeightInDashboardUnitsFunction =
|
|
103
|
+
(
|
|
104
|
+
currentTotalDashboardWidthInPx: number,
|
|
105
|
+
componentHeightInPx: number,
|
|
106
|
+
): number => {
|
|
107
|
+
const eachUnitSizeInPx: number =
|
|
108
|
+
currentTotalDashboardWidthInPx /
|
|
109
|
+
DefaultDashboardSize.widthInDashboardUnits; // each square is these many pixels
|
|
110
|
+
|
|
111
|
+
// now check how many squares can fit in the component height
|
|
112
|
+
const units: number = Math.ceil(componentHeightInPx / eachUnitSizeInPx);
|
|
113
|
+
|
|
114
|
+
if (units < 1) {
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return units;
|
|
119
|
+
};
|
|
16
120
|
|
|
17
121
|
export default DefaultDashboardSize;
|
package/Types/Icon/IconProp.ts
CHANGED
|
@@ -15,7 +15,12 @@ enum IconProp {
|
|
|
15
15
|
Notification = "Notification",
|
|
16
16
|
CursorArrowRays = "CursorArrowRays",
|
|
17
17
|
ArrowUpDown = "ArrowUpDown",
|
|
18
|
+
Bold = "Bold",
|
|
19
|
+
Italic = "Italic",
|
|
20
|
+
Underline = "Underline",
|
|
18
21
|
Cube = "Cube",
|
|
22
|
+
Expand = "Expand",
|
|
23
|
+
Collapse = "Collapse",
|
|
19
24
|
Unarchive = "Unarchive",
|
|
20
25
|
CPUChip = "CPUChip",
|
|
21
26
|
Swatch = "Swatch",
|
|
@@ -6,4 +6,12 @@ export default interface MetricsQuery {
|
|
|
6
6
|
attributes: Dictionary<string | boolean | number>;
|
|
7
7
|
aggegationType: MetricsAggregationType;
|
|
8
8
|
aggregateBy: Dictionary<boolean>;
|
|
9
|
+
|
|
10
|
+
// This is used for example for probes.
|
|
11
|
+
// To display US probe and EU probe in chart for example.
|
|
12
|
+
// In this case groupByAttribute is "probeId"
|
|
13
|
+
// and attributeValueToLegendMap is { "xx-xx-xx-xx": "US Probe", "yy-yyy-yyy-yy-yy": "EU Probe" }
|
|
14
|
+
|
|
15
|
+
groupByAttribute?: string | undefined;
|
|
16
|
+
attributeValueToLegendMap?: Dictionary<string>;
|
|
9
17
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import MonitorType from "./MonitorType";
|
|
2
|
-
|
|
3
1
|
export enum CheckOn {
|
|
4
2
|
ResponseTime = "Response Time (in ms)",
|
|
5
3
|
ResponseStatusCode = "Response Status Code",
|
|
@@ -140,38 +138,4 @@ export class CriteriaFilterUtil {
|
|
|
140
138
|
checkOn === CheckOn.IsOnline
|
|
141
139
|
);
|
|
142
140
|
}
|
|
143
|
-
|
|
144
|
-
public static getTimeFiltersByMonitorType(
|
|
145
|
-
monitorType: MonitorType,
|
|
146
|
-
): Array<CheckOn> {
|
|
147
|
-
if (
|
|
148
|
-
monitorType === MonitorType.API ||
|
|
149
|
-
monitorType === MonitorType.Website
|
|
150
|
-
) {
|
|
151
|
-
return [
|
|
152
|
-
CheckOn.IsOnline,
|
|
153
|
-
CheckOn.ResponseStatusCode,
|
|
154
|
-
CheckOn.ResponseTime,
|
|
155
|
-
];
|
|
156
|
-
} else if (
|
|
157
|
-
monitorType === MonitorType.Ping ||
|
|
158
|
-
monitorType === MonitorType.IP ||
|
|
159
|
-
monitorType === MonitorType.Port
|
|
160
|
-
) {
|
|
161
|
-
return [CheckOn.IsOnline, CheckOn.ResponseTime];
|
|
162
|
-
} else if (monitorType === MonitorType.Server) {
|
|
163
|
-
return [
|
|
164
|
-
CheckOn.IsOnline,
|
|
165
|
-
CheckOn.DiskUsagePercent,
|
|
166
|
-
CheckOn.CPUUsagePercent,
|
|
167
|
-
CheckOn.MemoryUsagePercent,
|
|
168
|
-
];
|
|
169
|
-
} else if (
|
|
170
|
-
monitorType === MonitorType.CustomJavaScriptCode ||
|
|
171
|
-
monitorType === MonitorType.SyntheticMonitor
|
|
172
|
-
) {
|
|
173
|
-
return [CheckOn.ExecutionTime];
|
|
174
|
-
}
|
|
175
|
-
return [];
|
|
176
|
-
}
|
|
177
141
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
enum MonitorMetricType {
|
|
2
|
+
ResponseTime = "oneuptime.monitor.response.time",
|
|
3
|
+
ResponseStatusCode = "oneuptime.monitor.response.status.code",
|
|
4
|
+
DiskUsagePercent = "oneuptime.monitor.disk.usage.percent",
|
|
5
|
+
CPUUsagePercent = "oneuptime.monitor.cpu.usage.percent",
|
|
6
|
+
MemoryUsagePercent = "oneuptime.monitor.memory.usage.percent",
|
|
7
|
+
IsOnline = "oneuptime.monitor.online",
|
|
8
|
+
ExecutionTime = "oneuptime.monitor.execution.time",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default MonitorMetricType;
|
|
@@ -204,4 +204,22 @@ export class MonitorTypeHelper {
|
|
|
204
204
|
public static doesMonitorTypeHaveCriteria(monitorType: MonitorType): boolean {
|
|
205
205
|
return monitorType !== MonitorType.Manual;
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
public static doesMonitorTypeHaveMetrics(monitorType: MonitorType): boolean {
|
|
209
|
+
if (
|
|
210
|
+
monitorType === MonitorType.Website ||
|
|
211
|
+
monitorType === MonitorType.API ||
|
|
212
|
+
monitorType === MonitorType.IP ||
|
|
213
|
+
monitorType === MonitorType.Ping ||
|
|
214
|
+
monitorType === MonitorType.Port ||
|
|
215
|
+
monitorType === MonitorType.Server ||
|
|
216
|
+
monitorType === MonitorType.SSLCertificate ||
|
|
217
|
+
monitorType === MonitorType.SyntheticMonitor ||
|
|
218
|
+
monitorType === MonitorType.CustomJavaScriptCode
|
|
219
|
+
) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
207
225
|
}
|
|
@@ -4,6 +4,8 @@ import ShortcutKey from "../ShortcutKey/ShortcutKey";
|
|
|
4
4
|
import ButtonType from "./ButtonTypes";
|
|
5
5
|
import IconProp from "Common/Types/Icon/IconProp";
|
|
6
6
|
import React, { FunctionComponent, ReactElement, useEffect } from "react";
|
|
7
|
+
import Tooltip from "../Tooltip/Tooltip";
|
|
8
|
+
import { GetReactElementFunction } from "../../Types/FunctionTypes";
|
|
7
9
|
|
|
8
10
|
export enum ButtonStyleType {
|
|
9
11
|
PRIMARY,
|
|
@@ -48,6 +50,7 @@ export interface ComponentProps {
|
|
|
48
50
|
buttonSize?: ButtonSize | undefined;
|
|
49
51
|
dataTestId?: string;
|
|
50
52
|
className?: string | undefined;
|
|
53
|
+
tooltip?: string | undefined;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
const Button: FunctionComponent<ComponentProps> = ({
|
|
@@ -65,6 +68,7 @@ const Button: FunctionComponent<ComponentProps> = ({
|
|
|
65
68
|
buttonSize = ButtonSize.Normal,
|
|
66
69
|
dataTestId,
|
|
67
70
|
className,
|
|
71
|
+
tooltip,
|
|
68
72
|
}: ComponentProps): ReactElement => {
|
|
69
73
|
useEffect(() => {
|
|
70
74
|
// componentDidMount
|
|
@@ -227,43 +231,50 @@ const Button: FunctionComponent<ComponentProps> = ({
|
|
|
227
231
|
buttonStyleCssClass += ` ` + className;
|
|
228
232
|
}
|
|
229
233
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
onClick
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
<
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
234
|
+
const getButton: GetReactElementFunction = (): ReactElement => {
|
|
235
|
+
return (
|
|
236
|
+
<button
|
|
237
|
+
style={style}
|
|
238
|
+
id={id}
|
|
239
|
+
onClick={() => {
|
|
240
|
+
if (onClick) {
|
|
241
|
+
onClick();
|
|
242
|
+
}
|
|
243
|
+
}}
|
|
244
|
+
data-testid={dataTestId}
|
|
245
|
+
type={type}
|
|
246
|
+
disabled={disabled || isLoading}
|
|
247
|
+
className={buttonStyleCssClass}
|
|
248
|
+
>
|
|
249
|
+
{isLoading && buttonStyle !== ButtonStyleType.ICON && (
|
|
250
|
+
<Icon icon={IconProp.Spinner} className={loadingIconClassName} />
|
|
251
|
+
)}
|
|
252
|
+
|
|
253
|
+
{!isLoading && icon && (
|
|
254
|
+
<Icon
|
|
255
|
+
icon={icon}
|
|
256
|
+
className={iconClassName}
|
|
257
|
+
size={iconSize || undefined}
|
|
258
|
+
/>
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{title && buttonStyle !== ButtonStyleType.ICON ? title : ``}
|
|
262
|
+
|
|
263
|
+
{shortcutKey && (
|
|
264
|
+
<div className="ml-2">
|
|
265
|
+
<kbd className="inline-flex items-center rounded border border-gray-200 px-2 font-sans text-sm font-medium text-gray-400">
|
|
266
|
+
{shortcutKey}
|
|
267
|
+
</kbd>
|
|
268
|
+
</div>
|
|
269
|
+
)}
|
|
270
|
+
</button>
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
if (tooltip) {
|
|
275
|
+
return <Tooltip text={tooltip}>{getButton()}</Tooltip>;
|
|
276
|
+
}
|
|
277
|
+
return getButton();
|
|
267
278
|
};
|
|
268
279
|
|
|
269
280
|
export default Button;
|
|
@@ -571,7 +571,7 @@ interface LineChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
571
571
|
legendPosition?: "left" | "center" | "right";
|
|
572
572
|
tooltipCallback?: (tooltipCallbackContent: TooltipProps) => void;
|
|
573
573
|
customTooltip?: React.ComponentType<TooltipProps>;
|
|
574
|
-
|
|
574
|
+
syncid?: string | undefined;
|
|
575
575
|
}
|
|
576
576
|
|
|
577
577
|
const LineChart: React.ForwardRefExoticComponent<
|
|
@@ -692,7 +692,7 @@ const LineChart: React.ForwardRefExoticComponent<
|
|
|
692
692
|
<ResponsiveContainer>
|
|
693
693
|
<RechartsLineChart
|
|
694
694
|
data={data}
|
|
695
|
-
syncId={props.
|
|
695
|
+
syncId={props.syncid?.toString() || ""}
|
|
696
696
|
onClick={
|
|
697
697
|
hasOnValueChange && (activeLegend || activeDot)
|
|
698
698
|
? () => {
|
|
@@ -16,7 +16,7 @@ export interface ComponentProps {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface LineInternalProps extends ComponentProps {
|
|
19
|
-
|
|
19
|
+
syncid: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const LineChartElement: FunctionComponent<LineInternalProps> = (
|
|
@@ -64,7 +64,7 @@ const LineChartElement: FunctionComponent<LineInternalProps> = (
|
|
|
64
64
|
showTooltip={true}
|
|
65
65
|
connectNulls={true}
|
|
66
66
|
curve={props.curve}
|
|
67
|
-
|
|
67
|
+
syncid={props.sync ? props.syncid : undefined}
|
|
68
68
|
yAxisWidth={60}
|
|
69
69
|
/>
|
|
70
70
|
);
|
|
@@ -162,6 +162,45 @@ const Icon: FunctionComponent<ComponentProps> = ({
|
|
|
162
162
|
d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"
|
|
163
163
|
/>,
|
|
164
164
|
);
|
|
165
|
+
} else if (icon === IconProp.Expand) {
|
|
166
|
+
return getSvgWrapper(
|
|
167
|
+
<path
|
|
168
|
+
strokeLinecap="round"
|
|
169
|
+
strokeLinejoin="round"
|
|
170
|
+
d="M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"
|
|
171
|
+
/>,
|
|
172
|
+
);
|
|
173
|
+
} else if (icon === IconProp.Bold) {
|
|
174
|
+
return getSvgWrapper(
|
|
175
|
+
<path
|
|
176
|
+
strokeLinejoin="round"
|
|
177
|
+
d="M6.75 3.744h-.753v8.25h7.125a4.125 4.125 0 0 0 0-8.25H6.75Zm0 0v.38m0 16.122h6.747a4.5 4.5 0 0 0 0-9.001h-7.5v9h.753Zm0 0v-.37m0-15.751h6a3.75 3.75 0 1 1 0 7.5h-6m0-7.5v7.5m0 0v8.25m0-8.25h6.375a4.125 4.125 0 0 1 0 8.25H6.75m.747-15.38h4.875a3.375 3.375 0 0 1 0 6.75H7.497v-6.75Zm0 7.5h5.25a3.75 3.75 0 0 1 0 7.5h-5.25v-7.5Z"
|
|
178
|
+
/>,
|
|
179
|
+
);
|
|
180
|
+
} else if (icon === IconProp.Italic) {
|
|
181
|
+
return getSvgWrapper(
|
|
182
|
+
<path
|
|
183
|
+
strokeLinecap="round"
|
|
184
|
+
strokeLinejoin="round"
|
|
185
|
+
d="M5.248 20.246H9.05m0 0h3.696m-3.696 0 5.893-16.502m0 0h-3.697m3.697 0h3.803"
|
|
186
|
+
/>,
|
|
187
|
+
);
|
|
188
|
+
} else if (icon === IconProp.Underline) {
|
|
189
|
+
return getSvgWrapper(
|
|
190
|
+
<path
|
|
191
|
+
strokeLinecap="round"
|
|
192
|
+
strokeLinejoin="round"
|
|
193
|
+
d="M17.995 3.744v7.5a6 6 0 1 1-12 0v-7.5m-2.25 16.502h16.5"
|
|
194
|
+
/>,
|
|
195
|
+
);
|
|
196
|
+
} else if (icon === IconProp.Collapse) {
|
|
197
|
+
return getSvgWrapper(
|
|
198
|
+
<path
|
|
199
|
+
strokeLinecap="round"
|
|
200
|
+
strokeLinejoin="round"
|
|
201
|
+
d="M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"
|
|
202
|
+
/>,
|
|
203
|
+
);
|
|
165
204
|
} else if (icon === IconProp.Logs) {
|
|
166
205
|
return getSvgWrapper(
|
|
167
206
|
<path
|
|
@@ -8,7 +8,7 @@ export default class DashboardChartComponentUtil extends DashboardBaseComponentU
|
|
|
8
8
|
public static override getDefaultComponent(): DashboardChartComponent {
|
|
9
9
|
return {
|
|
10
10
|
_type: ObjectType.DashboardChartComponent,
|
|
11
|
-
widthInDashboardUnits:
|
|
11
|
+
widthInDashboardUnits: 12,
|
|
12
12
|
heightInDashboardUnits: 6,
|
|
13
13
|
topInDashboardUnits: 0,
|
|
14
14
|
leftInDashboardUnits: 0,
|
|
@@ -7,12 +7,15 @@ export default class DashboardTextComponentUtil extends DashboardBaseComponentUt
|
|
|
7
7
|
public static override getDefaultComponent(): DashboardTextComponent {
|
|
8
8
|
return {
|
|
9
9
|
_type: ObjectType.DashboardTextComponent,
|
|
10
|
-
widthInDashboardUnits:
|
|
10
|
+
widthInDashboardUnits: 6,
|
|
11
11
|
heightInDashboardUnits: 1,
|
|
12
12
|
topInDashboardUnits: 0,
|
|
13
13
|
leftInDashboardUnits: 0,
|
|
14
14
|
text: "Hello, World!",
|
|
15
15
|
componentId: ObjectID.generate(),
|
|
16
|
+
isBold: false,
|
|
17
|
+
isItalic: false,
|
|
18
|
+
isUnderline: false,
|
|
16
19
|
};
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -23,7 +23,6 @@ export default class DashboardViewConfigUtil {
|
|
|
23
23
|
data.dashboardViewConfig.components;
|
|
24
24
|
|
|
25
25
|
let componentTopPosition: number = 0;
|
|
26
|
-
let componentLeftPosition: number = 0;
|
|
27
26
|
|
|
28
27
|
// find the last row that has the component.
|
|
29
28
|
|
|
@@ -31,11 +30,15 @@ export default class DashboardViewConfigUtil {
|
|
|
31
30
|
|
|
32
31
|
for (const dashboardComponent of allComponentsFromDashboard) {
|
|
33
32
|
if (
|
|
34
|
-
|
|
33
|
+
lastRowThatHasComponent <
|
|
35
34
|
dashboardComponent.topInDashboardUnits +
|
|
36
|
-
dashboardComponent.heightInDashboardUnits
|
|
35
|
+
dashboardComponent.heightInDashboardUnits -
|
|
36
|
+
1
|
|
37
37
|
) {
|
|
38
|
-
lastRowThatHasComponent =
|
|
38
|
+
lastRowThatHasComponent =
|
|
39
|
+
dashboardComponent.topInDashboardUnits +
|
|
40
|
+
dashboardComponent.heightInDashboardUnits -
|
|
41
|
+
1;
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -51,13 +54,10 @@ export default class DashboardViewConfigUtil {
|
|
|
51
54
|
componentTopPosition + heightOfComponent;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
// left position of the component is always 0.
|
|
55
|
-
componentLeftPosition = 0;
|
|
56
|
-
|
|
57
57
|
const newComponent: DashboardBaseComponent = {
|
|
58
58
|
...data.component,
|
|
59
59
|
topInDashboardUnits: componentTopPosition,
|
|
60
|
-
leftInDashboardUnits:
|
|
60
|
+
leftInDashboardUnits: 0,
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
// Add the new component to the dashboard configuration
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import AggregationType from "../../Types/BaseDatabase/AggregationType";
|
|
2
|
+
import { CheckOn } from "../../Types/Monitor/CriteriaFilter";
|
|
3
|
+
import MonitorMetricType from "../../Types/Monitor/MonitorMetricType";
|
|
4
|
+
import MonitorType from "../../Types/Monitor/MonitorType";
|
|
5
|
+
|
|
6
|
+
class MonitorMetricTypeUtil {
|
|
7
|
+
public static getAggregationTypeByMonitorMetricType(
|
|
8
|
+
monitorMetricType: MonitorMetricType,
|
|
9
|
+
): AggregationType {
|
|
10
|
+
switch (monitorMetricType) {
|
|
11
|
+
case MonitorMetricType.ResponseTime:
|
|
12
|
+
return AggregationType.Avg;
|
|
13
|
+
case MonitorMetricType.ResponseStatusCode:
|
|
14
|
+
return AggregationType.Max;
|
|
15
|
+
case MonitorMetricType.IsOnline:
|
|
16
|
+
return AggregationType.Min;
|
|
17
|
+
case MonitorMetricType.DiskUsagePercent:
|
|
18
|
+
return AggregationType.Max;
|
|
19
|
+
case MonitorMetricType.CPUUsagePercent:
|
|
20
|
+
return AggregationType.Avg;
|
|
21
|
+
case MonitorMetricType.MemoryUsagePercent:
|
|
22
|
+
return AggregationType.Avg;
|
|
23
|
+
case MonitorMetricType.ExecutionTime:
|
|
24
|
+
return AggregationType.Avg;
|
|
25
|
+
default:
|
|
26
|
+
throw new Error("Invalid MonitorMetricType value");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public static getMonitorMeticTypeByCheckOn(
|
|
31
|
+
checkOn: CheckOn,
|
|
32
|
+
): MonitorMetricType {
|
|
33
|
+
switch (checkOn) {
|
|
34
|
+
case CheckOn.ResponseTime:
|
|
35
|
+
return MonitorMetricType.ResponseTime;
|
|
36
|
+
case CheckOn.ResponseStatusCode:
|
|
37
|
+
return MonitorMetricType.ResponseStatusCode;
|
|
38
|
+
case CheckOn.IsOnline:
|
|
39
|
+
return MonitorMetricType.IsOnline;
|
|
40
|
+
case CheckOn.DiskUsagePercent:
|
|
41
|
+
return MonitorMetricType.DiskUsagePercent;
|
|
42
|
+
case CheckOn.CPUUsagePercent:
|
|
43
|
+
return MonitorMetricType.CPUUsagePercent;
|
|
44
|
+
case CheckOn.MemoryUsagePercent:
|
|
45
|
+
return MonitorMetricType.MemoryUsagePercent;
|
|
46
|
+
case CheckOn.ExecutionTime:
|
|
47
|
+
return MonitorMetricType.ExecutionTime;
|
|
48
|
+
default:
|
|
49
|
+
throw new Error("Invalid CheckOn value");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public static getMonitorMetricTypesByMonitorType(
|
|
54
|
+
monitorType: MonitorType,
|
|
55
|
+
): Array<MonitorMetricType> {
|
|
56
|
+
if (
|
|
57
|
+
monitorType === MonitorType.API ||
|
|
58
|
+
monitorType === MonitorType.Website
|
|
59
|
+
) {
|
|
60
|
+
return [
|
|
61
|
+
MonitorMetricType.IsOnline,
|
|
62
|
+
MonitorMetricType.ResponseTime,
|
|
63
|
+
MonitorMetricType.ResponseStatusCode,
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (monitorType === MonitorType.Server) {
|
|
68
|
+
return [
|
|
69
|
+
MonitorMetricType.IsOnline,
|
|
70
|
+
MonitorMetricType.DiskUsagePercent,
|
|
71
|
+
MonitorMetricType.CPUUsagePercent,
|
|
72
|
+
MonitorMetricType.MemoryUsagePercent,
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (monitorType === MonitorType.CustomJavaScriptCode) {
|
|
77
|
+
return [MonitorMetricType.ExecutionTime];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (monitorType === MonitorType.SyntheticMonitor) {
|
|
81
|
+
return [MonitorMetricType.ExecutionTime];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (
|
|
85
|
+
monitorType === MonitorType.Ping ||
|
|
86
|
+
monitorType === MonitorType.IP ||
|
|
87
|
+
monitorType === MonitorType.Port
|
|
88
|
+
) {
|
|
89
|
+
return [MonitorMetricType.IsOnline, MonitorMetricType.ResponseTime];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public static getTitleByMonitorMetricType(
|
|
96
|
+
monitorMetricType: MonitorMetricType,
|
|
97
|
+
): string {
|
|
98
|
+
switch (monitorMetricType) {
|
|
99
|
+
case MonitorMetricType.ResponseTime:
|
|
100
|
+
return "Response Time";
|
|
101
|
+
case MonitorMetricType.ResponseStatusCode:
|
|
102
|
+
return "Response Status Code";
|
|
103
|
+
case MonitorMetricType.IsOnline:
|
|
104
|
+
return "Is Online";
|
|
105
|
+
case MonitorMetricType.DiskUsagePercent:
|
|
106
|
+
return "Disk Usage Percent";
|
|
107
|
+
case MonitorMetricType.CPUUsagePercent:
|
|
108
|
+
return "CPU Usage Percent";
|
|
109
|
+
case MonitorMetricType.MemoryUsagePercent:
|
|
110
|
+
return "Memory Usage Percent";
|
|
111
|
+
case MonitorMetricType.ExecutionTime:
|
|
112
|
+
return "Execution Time";
|
|
113
|
+
default:
|
|
114
|
+
return "";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public static getDescriptionByMonitorMetricType(
|
|
119
|
+
monitorMetricType: MonitorMetricType,
|
|
120
|
+
): string {
|
|
121
|
+
switch (monitorMetricType) {
|
|
122
|
+
case MonitorMetricType.ResponseTime:
|
|
123
|
+
return "Response time is the time taken for a server to respond to a request. It is the sum of the time spent waiting to establish the connection, the time spent waiting for the request to be processed, and the time spent waiting for the response to be sent.";
|
|
124
|
+
case MonitorMetricType.ResponseStatusCode:
|
|
125
|
+
return "Response status code is a server response code that indicates the status of the server's response to a client's request. It is a three-digit code that is returned by a server in response to a client's request.";
|
|
126
|
+
case MonitorMetricType.IsOnline:
|
|
127
|
+
return "Is online is a metric that indicates whether a server is online or offline. It is a boolean value that is returned by a server in response to a client's request.";
|
|
128
|
+
case MonitorMetricType.DiskUsagePercent:
|
|
129
|
+
return "Disk usage percent is the percentage of disk space that is currently being used on a server. It is a measure of how much disk space is being used by the server's files and data.";
|
|
130
|
+
case MonitorMetricType.CPUUsagePercent:
|
|
131
|
+
return "CPU usage percent is the percentage of CPU capacity that is currently being used on a server. It is a measure of how much of the server's processing power is being used.";
|
|
132
|
+
case MonitorMetricType.MemoryUsagePercent:
|
|
133
|
+
return "Memory usage percent is the percentage of memory that is currently being used on a server. It is a measure of how much of the server's memory is being used.";
|
|
134
|
+
case MonitorMetricType.ExecutionTime:
|
|
135
|
+
return "Execution time is the time taken for a custom JavaScript code or a synthetic monitor to execute.";
|
|
136
|
+
default:
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export default MonitorMetricTypeUtil;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Log from "./Log";
|
|
2
2
|
import Metric from "./Metric";
|
|
3
|
-
import MonitorMetricsByMinute from "./MonitorMetricsByMinute";
|
|
4
3
|
import Span from "./Span";
|
|
5
4
|
import TelemetryAttribute from "./TelemetryAttribute";
|
|
6
5
|
import ExceptionInstance from "./ExceptionInstance";
|
|
@@ -8,7 +7,6 @@ const AnalyticsModels = [
|
|
|
8
7
|
Log,
|
|
9
8
|
Span,
|
|
10
9
|
Metric,
|
|
11
|
-
MonitorMetricsByMinute,
|
|
12
10
|
TelemetryAttribute,
|
|
13
11
|
ExceptionInstance,
|
|
14
12
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Index.js","sourceRoot":"","sources":["../../../../Models/AnalyticsModels/Index.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"Index.js","sourceRoot":"","sources":["../../../../Models/AnalyticsModels/Index.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,MAAM,eAAe,GAA0C;IAC7D,GAAG;IACH,IAAI;IACJ,MAAM;IACN,kBAAkB;IAClB,iBAAiB;CAClB,CAAC;AAEF,MAAM,YAAY,GAAsD,EAAE,CAAC;AAM3E,MAAM,CAAC,MAAM,kBAAkB,GAAuB,CACpD,SAAiB,EACsB,EAAE;IACzC,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,YAAY,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;IACzC,CAAC;IAED,MAAM,SAAS,GACb,eAAe,CAAC,IAAI,CAAC,CAAC,SAAyC,EAAE,EAAE;QACjE,OAAO,IAAI,SAAS,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC;IACjD,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAEpC,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|