@oneuptime/common 10.0.71 → 10.0.73

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.
Files changed (115) hide show
  1. package/Models/DatabaseModels/Alert.ts +55 -0
  2. package/Models/DatabaseModels/Incident.ts +55 -0
  3. package/Models/DatabaseModels/Project.ts +26 -0
  4. package/Models/DatabaseModels/Service.ts +2 -2
  5. package/Models/DatabaseModels/StatusPage.ts +80 -0
  6. package/Server/API/StatusPageAPI.ts +4 -0
  7. package/Server/Infrastructure/Postgres/SchemaMigrations/1776940714709-MigrationName.ts +41 -0
  8. package/Server/Infrastructure/Postgres/SchemaMigrations/1776971364783-AddStatusPageLanguageSettings.ts +25 -0
  9. package/Server/Infrastructure/Postgres/SchemaMigrations/1777018175127-AddTelemetryRetentionSettings.ts +25 -0
  10. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
  11. package/Server/Services/AnalyticsDatabaseService.ts +17 -7
  12. package/Server/Services/OpenTelemetryIngestService.ts +36 -5
  13. package/Server/Services/ServiceService.ts +27 -1
  14. package/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.ts +175 -29
  15. package/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.ts +71 -0
  16. package/Server/Utils/Monitor/MonitorAlert.ts +91 -7
  17. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +171 -2
  18. package/Server/Utils/Monitor/MonitorIncident.ts +133 -8
  19. package/Server/Utils/Monitor/MonitorMetricUtil.ts +423 -1
  20. package/Server/Utils/Monitor/MonitorResource.ts +2 -0
  21. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +99 -0
  22. package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.ts +268 -0
  23. package/Types/AdminDashboard/AdminDashboardLanguage.ts +33 -0
  24. package/Types/Infrastructure/BasicMetrics.ts +75 -0
  25. package/Types/Metrics/MetricQueryData.ts +11 -0
  26. package/Types/Monitor/CriteriaFilter.ts +10 -0
  27. package/Types/Monitor/MetricMonitor/MetricCriteriaContext.ts +11 -0
  28. package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +10 -0
  29. package/Types/Monitor/MetricMonitor/MetricSeriesResult.ts +20 -0
  30. package/Types/Monitor/MonitorMetricType.ts +34 -0
  31. package/Types/Monitor/ServerMonitor/ServerMonitorResponse.ts +8 -0
  32. package/Types/Probe/ProbeApiIngestResponse.ts +25 -0
  33. package/Types/StatusPage/StatusPageLanguage.ts +30 -0
  34. package/UI/Components/Charts/Area/AreaChart.tsx +17 -12
  35. package/UI/Components/Charts/Bar/BarChart.tsx +16 -11
  36. package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +23 -0
  37. package/UI/Components/Charts/Line/LineChart.tsx +16 -11
  38. package/UI/Components/Filters/FiltersForm.tsx +26 -2
  39. package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +453 -0
  40. package/UI/Components/MonitorTemplateVariables/TemplateVariablesModal.tsx +229 -0
  41. package/Utils/Metrics/MetricSeriesFingerprint.ts +97 -0
  42. package/Utils/Monitor/MonitorMetricType.ts +309 -19
  43. package/build/dist/Models/DatabaseModels/Alert.js +57 -0
  44. package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
  45. package/build/dist/Models/DatabaseModels/Incident.js +57 -0
  46. package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
  47. package/build/dist/Models/DatabaseModels/Project.js +27 -0
  48. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  49. package/build/dist/Models/DatabaseModels/Service.js +1 -2
  50. package/build/dist/Models/DatabaseModels/Service.js.map +1 -1
  51. package/build/dist/Models/DatabaseModels/StatusPage.js +82 -0
  52. package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
  53. package/build/dist/Server/API/StatusPageAPI.js +4 -0
  54. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  55. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776940714709-MigrationName.js +22 -0
  56. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776940714709-MigrationName.js.map +1 -0
  57. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776971364783-AddStatusPageLanguageSettings.js +14 -0
  58. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776971364783-AddStatusPageLanguageSettings.js.map +1 -0
  59. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777018175127-AddTelemetryRetentionSettings.js +14 -0
  60. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777018175127-AddTelemetryRetentionSettings.js.map +1 -0
  61. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
  62. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  63. package/build/dist/Server/Services/AnalyticsDatabaseService.js +14 -4
  64. package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
  65. package/build/dist/Server/Services/OpenTelemetryIngestService.js +30 -4
  66. package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
  67. package/build/dist/Server/Services/ServiceService.js +22 -1
  68. package/build/dist/Server/Services/ServiceService.js.map +1 -1
  69. package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js +132 -30
  70. package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js.map +1 -1
  71. package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js +58 -7
  72. package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js.map +1 -1
  73. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +66 -12
  74. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  75. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +112 -0
  76. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  77. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +91 -15
  78. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  79. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +373 -0
  80. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
  81. package/build/dist/Server/Utils/Monitor/MonitorResource.js +2 -0
  82. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  83. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +65 -0
  84. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  85. package/build/dist/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.js +199 -0
  86. package/build/dist/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.js.map +1 -1
  87. package/build/dist/Types/AdminDashboard/AdminDashboardLanguage.js +22 -0
  88. package/build/dist/Types/AdminDashboard/AdminDashboardLanguage.js.map +1 -0
  89. package/build/dist/Types/Monitor/CriteriaFilter.js +10 -0
  90. package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
  91. package/build/dist/Types/Monitor/MetricMonitor/MetricSeriesResult.js +2 -0
  92. package/build/dist/Types/Monitor/MetricMonitor/MetricSeriesResult.js.map +1 -0
  93. package/build/dist/Types/Monitor/MonitorMetricType.js +28 -0
  94. package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
  95. package/build/dist/Types/StatusPage/StatusPageLanguage.js +22 -0
  96. package/build/dist/Types/StatusPage/StatusPageLanguage.js.map +1 -0
  97. package/build/dist/UI/Components/Charts/Area/AreaChart.js +13 -12
  98. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  99. package/build/dist/UI/Components/Charts/Bar/BarChart.js +12 -11
  100. package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
  101. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +11 -3
  102. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
  103. package/build/dist/UI/Components/Charts/Line/LineChart.js +12 -11
  104. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  105. package/build/dist/UI/Components/Filters/FiltersForm.js +6 -2
  106. package/build/dist/UI/Components/Filters/FiltersForm.js.map +1 -1
  107. package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +383 -0
  108. package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -0
  109. package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesModal.js +109 -0
  110. package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesModal.js.map +1 -0
  111. package/build/dist/Utils/Metrics/MetricSeriesFingerprint.js +81 -0
  112. package/build/dist/Utils/Metrics/MetricSeriesFingerprint.js.map +1 -0
  113. package/build/dist/Utils/Monitor/MonitorMetricType.js +287 -19
  114. package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
  115. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { AreaChart } from "../ChartLibrary/AreaChart/AreaChart";
2
+ import { AvailableChartColorsKeys } from "../ChartLibrary/Utils/ChartColors";
2
3
  import React, {
3
4
  FunctionComponent,
4
5
  ReactElement,
@@ -17,6 +18,19 @@ import ExemplarPoint from "../Types/ExemplarPoint";
17
18
  import XAxisUtil from "../Utils/XAxis";
18
19
  import NoDataMessage from "../ChartGroup/NoDataMessage";
19
20
 
21
+ export const AreaChartPalette: Array<AvailableChartColorsKeys> = [
22
+ "blue",
23
+ "emerald",
24
+ "violet",
25
+ "amber",
26
+ "cyan",
27
+ "pink",
28
+ "lime",
29
+ "fuchsia",
30
+ "indigo",
31
+ "rose",
32
+ ];
33
+
20
34
  export interface ComponentProps {
21
35
  data: Array<SeriesPoint>;
22
36
  xAxis: XAxis;
@@ -27,6 +41,7 @@ export interface ComponentProps {
27
41
  referenceLines?: Array<ChartReferenceLineProps> | undefined;
28
42
  exemplarPoints?: Array<ExemplarPoint> | undefined;
29
43
  onExemplarClick?: ((exemplar: ExemplarPoint) => void) | undefined;
44
+ showLegend?: boolean | undefined;
30
45
  }
31
46
 
32
47
  export interface AreaInternalProps extends ComponentProps {
@@ -93,20 +108,10 @@ const AreaChartElement: FunctionComponent<AreaInternalProps> = (
93
108
  tickGap={1}
94
109
  index={"Time"}
95
110
  categories={categories}
96
- colors={[
97
- "blue",
98
- "emerald",
99
- "violet",
100
- "amber",
101
- "cyan",
102
- "pink",
103
- "lime",
104
- "fuchsia",
105
- "indigo",
106
- "rose",
107
- ]}
111
+ colors={AreaChartPalette}
108
112
  valueFormatter={props.yAxis.options.formatter || undefined}
109
113
  showTooltip={true}
114
+ showLegend={props.showLegend !== false}
110
115
  connectNulls={true}
111
116
  curve={props.curve || ChartCurve.MONOTONE}
112
117
  syncid={props.sync ? props.syncid : undefined}
@@ -1,4 +1,5 @@
1
1
  import { BarChart } from "../ChartLibrary/BarChart/BarChart";
2
+ import { AvailableChartColorsKeys } from "../ChartLibrary/Utils/ChartColors";
2
3
  import React, { FunctionComponent, ReactElement, useEffect } from "react";
3
4
  import SeriesPoint from "../Types/SeriesPoints";
4
5
  import { XAxis } from "../Types/XAxis/XAxis";
@@ -8,6 +9,18 @@ import DataPointUtil from "../Utils/DataPoint";
8
9
  import ChartReferenceLineProps from "../Types/ReferenceLineProps";
9
10
  import NoDataMessage from "../ChartGroup/NoDataMessage";
10
11
 
12
+ export const BarChartPalette: Array<AvailableChartColorsKeys> = [
13
+ "indigo",
14
+ "rose",
15
+ "emerald",
16
+ "amber",
17
+ "cyan",
18
+ "gray",
19
+ "pink",
20
+ "lime",
21
+ "fuchsia",
22
+ ];
23
+
11
24
  export interface ComponentProps {
12
25
  data: Array<SeriesPoint>;
13
26
  xAxis: XAxis;
@@ -15,6 +28,7 @@ export interface ComponentProps {
15
28
  sync: boolean;
16
29
  heightInPx?: number | undefined;
17
30
  referenceLines?: Array<ChartReferenceLineProps> | undefined;
31
+ showLegend?: boolean | undefined;
18
32
  }
19
33
 
20
34
  export interface BarInternalProps extends ComponentProps {
@@ -61,19 +75,10 @@ const BarChartElement: FunctionComponent<BarInternalProps> = (
61
75
  tickGap={1}
62
76
  index={"Time"}
63
77
  categories={categories}
64
- colors={[
65
- "indigo",
66
- "rose",
67
- "emerald",
68
- "amber",
69
- "cyan",
70
- "gray",
71
- "pink",
72
- "lime",
73
- "fuchsia",
74
- ]}
78
+ colors={BarChartPalette}
75
79
  valueFormatter={props.yAxis.options.formatter || undefined}
76
80
  showTooltip={true}
81
+ showLegend={props.showLegend !== false}
77
82
  yAxisWidth={60}
78
83
  syncid={props.sync ? props.syncid : undefined}
79
84
  onValueChange={() => {}}
@@ -36,6 +36,13 @@ export interface Chart {
36
36
  metricInfo?: ChartMetricInfo | undefined;
37
37
  exemplarPoints?: Array<ExemplarPoint> | undefined;
38
38
  onExemplarClick?: ((exemplar: ExemplarPoint) => void) | undefined;
39
+ /**
40
+ * Optional control panel rendered between the chart title and the
41
+ * chart body. Used by per-series-grouped metric charts to surface a
42
+ * search box, per-series toggles, and a "show all" escape hatch so
43
+ * the chart stays usable at thousands of unique label combinations.
44
+ */
45
+ seriesControls?: ReactElement | undefined;
39
46
  }
40
47
 
41
48
  export interface ComponentProps {
@@ -58,6 +65,13 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
58
65
  chart: Chart,
59
66
  index: number,
60
67
  ): ReactElement => {
68
+ /*
69
+ * When the chart has its own seriesControls panel, that panel doubles
70
+ * as a colored, interactive legend — so we suppress the built-in
71
+ * Recharts legend to avoid showing two legends for the same series.
72
+ */
73
+ const showLegend: boolean = !chart.seriesControls;
74
+
61
75
  switch (chart.type) {
62
76
  case ChartType.LINE:
63
77
  return (
@@ -68,6 +82,7 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
68
82
  heightInPx={props.heightInPx}
69
83
  exemplarPoints={chart.exemplarPoints}
70
84
  onExemplarClick={chart.onExemplarClick}
85
+ showLegend={showLegend}
71
86
  />
72
87
  );
73
88
  case ChartType.BAR:
@@ -77,6 +92,7 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
77
92
  {...(chart.props as BarChartProps)}
78
93
  syncid={syncId}
79
94
  heightInPx={props.heightInPx}
95
+ showLegend={showLegend}
80
96
  />
81
97
  );
82
98
  case ChartType.AREA:
@@ -88,6 +104,7 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
88
104
  heightInPx={props.heightInPx}
89
105
  exemplarPoints={chart.exemplarPoints}
90
106
  onExemplarClick={chart.onExemplarClick}
107
+ showLegend={showLegend}
91
108
  />
92
109
  );
93
110
  default:
@@ -239,6 +256,9 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
239
256
  </p>
240
257
  )}
241
258
  </div>
259
+ {chart.seriesControls ? (
260
+ <div className="mb-3">{chart.seriesControls}</div>
261
+ ) : null}
242
262
  {getChartContent(chart, index)}
243
263
  </div>
244
264
  </div>
@@ -283,6 +303,9 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
283
303
  {chart.description}
284
304
  </p>
285
305
  )}
306
+ {chart.seriesControls ? (
307
+ <div className="mt-3">{chart.seriesControls}</div>
308
+ ) : null}
286
309
  {getChartContent(chart, index)}
287
310
  </div>
288
311
  );
@@ -1,4 +1,5 @@
1
1
  import { LineChart } from "../ChartLibrary/LineChart/LineChart";
2
+ import { AvailableChartColorsKeys } from "../ChartLibrary/Utils/ChartColors";
2
3
  import React, {
3
4
  FunctionComponent,
4
5
  ReactElement,
@@ -17,6 +18,18 @@ import ExemplarPoint from "../Types/ExemplarPoint";
17
18
  import XAxisUtil from "../Utils/XAxis";
18
19
  import NoDataMessage from "../ChartGroup/NoDataMessage";
19
20
 
21
+ export const LineChartPalette: Array<AvailableChartColorsKeys> = [
22
+ "indigo",
23
+ "rose",
24
+ "emerald",
25
+ "amber",
26
+ "cyan",
27
+ "gray",
28
+ "pink",
29
+ "lime",
30
+ "fuchsia",
31
+ ];
32
+
20
33
  export interface ComponentProps {
21
34
  data: Array<SeriesPoint>;
22
35
  xAxis: XAxis;
@@ -27,6 +40,7 @@ export interface ComponentProps {
27
40
  referenceLines?: Array<ChartReferenceLineProps> | undefined;
28
41
  exemplarPoints?: Array<ExemplarPoint> | undefined;
29
42
  onExemplarClick?: ((exemplar: ExemplarPoint) => void) | undefined;
43
+ showLegend?: boolean | undefined;
30
44
  }
31
45
 
32
46
  export interface LineInternalProps extends ComponentProps {
@@ -93,19 +107,10 @@ const LineChartElement: FunctionComponent<LineInternalProps> = (
93
107
  tickGap={1}
94
108
  index={"Time"}
95
109
  categories={categories}
96
- colors={[
97
- "indigo",
98
- "rose",
99
- "emerald",
100
- "amber",
101
- "cyan",
102
- "gray",
103
- "pink",
104
- "lime",
105
- "fuchsia",
106
- ]}
110
+ colors={LineChartPalette}
107
111
  valueFormatter={props.yAxis.options.formatter || undefined}
108
112
  showTooltip={true}
113
+ showLegend={props.showLegend !== false}
109
114
  connectNulls={true}
110
115
  curve={props.curve}
111
116
  syncid={props.sync ? props.syncid : undefined}
@@ -28,6 +28,22 @@ export interface ComponentProps<T extends GenericObject> {
28
28
  | undefined
29
29
  | ((showAdvancedFilters: boolean) => void);
30
30
  showAdvancedFiltersByDefault?: boolean | undefined;
31
+ /**
32
+ * Suppress the built-in "Show/Hide Advanced Filters" toggle
33
+ * button. Useful when the parent renders its own toggle further
34
+ * down the page (e.g. below other non-filter controls) and needs
35
+ * full layout control. Parent must drive visibility through
36
+ * `showAdvancedFilters` instead.
37
+ */
38
+ hideAdvancedFilterToggle?: boolean | undefined;
39
+ /**
40
+ * Controlled replacement for the internal toggle state. When
41
+ * provided, the form renders advanced filters based on this flag
42
+ * and calls `onAdvancedFiltersToggle` for changes but does not
43
+ * manage its own state. Pair with `hideAdvancedFilterToggle` when
44
+ * the parent owns the UI toggle.
45
+ */
46
+ showAdvancedFilters?: boolean | undefined;
31
47
  }
32
48
 
33
49
  type FiltersFormFunction = <T extends GenericObject>(
@@ -51,16 +67,24 @@ const FiltersForm: FiltersFormFunction = <T extends GenericObject>(
51
67
  }
52
68
  };
53
69
 
54
- const showAdvancedFilterButton: boolean = Boolean(
70
+ const hasAdvancedFilter: boolean = Boolean(
55
71
  props.filters.find((filter: Filter<T>) => {
56
72
  return filter.isAdvancedFilter;
57
73
  }),
58
74
  );
59
75
 
60
- const [showMoreFilters, setShowMoreFilters] = React.useState<boolean>(
76
+ const showAdvancedFilterButton: boolean =
77
+ hasAdvancedFilter && !props.hideAdvancedFilterToggle;
78
+
79
+ const [internalShowMoreFilters, setShowMoreFilters] = React.useState<boolean>(
61
80
  props.showAdvancedFiltersByDefault ?? false,
62
81
  );
63
82
 
83
+ const showMoreFilters: boolean =
84
+ props.showAdvancedFilters !== undefined
85
+ ? props.showAdvancedFilters
86
+ : internalShowMoreFilters;
87
+
64
88
  type ClearFilterFunction = (key: keyof T) => void;
65
89
 
66
90
  const clearFilter: ClearFilterFunction = (key: keyof T): void => {