@oneuptime/common 12.0.9 → 12.0.11

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 (262) hide show
  1. package/Models/DatabaseModels/NetworkDevice.ts +44 -0
  2. package/Models/DatabaseModels/NetworkDeviceLink.ts +116 -0
  3. package/Models/DatabaseModels/RunnerJob.ts +17 -2
  4. package/Server/API/LlmProviderAPI.ts +8 -0
  5. package/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.ts +52 -0
  6. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  7. package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +240 -0
  8. package/Server/Services/NetworkDeviceLinkService.ts +338 -2
  9. package/Server/Services/NetworkDeviceService.ts +265 -12
  10. package/Server/Services/RunnerJobService.ts +24 -1
  11. package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +19 -5
  12. package/Server/Types/Database/JSONColumnQuery.ts +42 -4
  13. package/Server/Utils/LLM/LLMService.ts +108 -19
  14. package/Server/Utils/Monitor/MonitorAlert.ts +22 -115
  15. package/Server/Utils/Monitor/MonitorIncident.ts +7 -337
  16. package/Server/Utils/Monitor/MonitorMaintenanceSuppression.ts +27 -2
  17. package/Server/Utils/Monitor/SeriesResourceLabels.ts +32 -0
  18. package/Server/Utils/Monitor/SeriesResourceLinker.ts +469 -0
  19. package/Server/Utils/SSRFProtection.ts +5 -4
  20. package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +186 -38
  21. package/Tests/App/AdminDashboard/AdminUsersBulkAddToProject.test.tsx +955 -0
  22. package/Tests/App/AdminDashboard/BulkAddUsersToProject.test.ts +778 -0
  23. package/Tests/App/AdminDashboard/BulkAddUsersToProjectModal.test.tsx +1051 -0
  24. package/Tests/App/Dashboard/AdminNotificationRulesPage.test.tsx +420 -112
  25. package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +81 -6
  26. package/Tests/App/Dashboard/PayAsYouGoConsentGate.test.tsx +543 -0
  27. package/Tests/App/Dashboard/PayAsYouGoFreePlan.test.ts +125 -0
  28. package/Tests/App/Dashboard/PayAsYouGoNotices.test.tsx +612 -0
  29. package/Tests/App/Dashboard/SloWidgetChartRendering.test.tsx +536 -0
  30. package/Tests/App/Dashboard/UserElementEmail.test.tsx +447 -0
  31. package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +284 -0
  32. package/Tests/Models/AnalyticsModels/CommonModel.test.ts +312 -0
  33. package/Tests/Server/Infrastructure/Postgres/DeviceRoleAndDeclaredLinkParentMigration.test.ts +250 -0
  34. package/Tests/Server/Infrastructure/Postgres/EpisodeMemberNotifyIndexesMigration.test.ts +46 -18
  35. package/Tests/Server/Services/NetworkDeviceLabelRuleRun.test.ts +618 -0
  36. package/Tests/Server/Services/NetworkDeviceLinkParentValidation.test.ts +1043 -0
  37. package/Tests/Server/Services/NetworkSiteAssignmentRuleRun.test.ts +706 -0
  38. package/Tests/Server/Services/RunnerJobEnqueue.test.ts +412 -0
  39. package/Tests/Server/Types/Billing/PayAsYouGoMeteredPricing.test.ts +125 -0
  40. package/Tests/Server/Types/Database/JSONColumnQuery.test.ts +508 -0
  41. package/Tests/Server/Utils/AI/LLMServiceRequestPolicy.test.ts +2 -2
  42. package/Tests/Server/Utils/AI/LLMServiceRetryPolicy.test.ts +450 -0
  43. package/Tests/Server/Utils/Monitor/MonitorAlertResourceLinking.test.ts +556 -0
  44. package/Tests/Server/Utils/Monitor/MonitorIncidentResourceLinking.test.ts +547 -0
  45. package/Tests/Server/Utils/Monitor/MonitorMaintenanceSuppression.test.ts +30 -0
  46. package/Tests/Server/Utils/Monitor/SeriesResourceLinker.test.ts +699 -0
  47. package/Tests/Server/Utils/SeriesResourceLabels.test.ts +55 -0
  48. package/Tests/Server/Utils/Telemetry/InventoryEntityRegistry.test.ts +668 -0
  49. package/Tests/Types/API/URLMalformedTolerance.test.ts +301 -0
  50. package/Tests/Types/API/URLTelScheme.test.ts +261 -0
  51. package/Tests/Types/API/URLUnsupportedScheme.test.ts +148 -0
  52. package/Tests/Types/Billing/PayAsYouGoPricing.test.ts +64 -0
  53. package/Tests/Types/CustomField/CustomFieldTypeCorrespondence.test.ts +107 -0
  54. package/Tests/Types/Monitor/MonitorType.test.ts +62 -0
  55. package/Tests/Types/NetworkAutomation/RuleRunResult.test.ts +184 -0
  56. package/Tests/Types/Runbook/RunbookStepType.test.ts +124 -0
  57. package/Tests/Types/Workflow/BaseModelComponents.test.ts +17 -0
  58. package/Tests/UI/Components/Button.test.tsx +279 -0
  59. package/Tests/UI/Components/Charts/ChartXAxisDataKey.test.tsx +256 -0
  60. package/Tests/UI/Components/Charts/DataPointUtil.test.ts +323 -0
  61. package/Tests/UI/Components/DictionaryValuePlaceholderAndSuggestions.test.tsx +595 -0
  62. package/Tests/UI/Components/Icon.test.tsx +57 -0
  63. package/Tests/UI/Components/List.test.tsx +20 -3
  64. package/Tests/UI/Components/LogsSavedViewsDropdown.test.tsx +304 -0
  65. package/Tests/UI/Components/LogsViewerClearSavedView.test.tsx +179 -0
  66. package/Tests/UI/Components/ModelTable/CustomFieldColumns.test.tsx +349 -1
  67. package/Tests/UI/Components/Pagination.test.tsx +721 -146
  68. package/Tests/UI/Components/PaginationIntegration.test.tsx +386 -0
  69. package/Tests/UI/Components/PaginationUtil.test.ts +417 -0
  70. package/Tests/UI/Components/TelemetrySavedViewsDropdown.test.tsx +343 -0
  71. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnControl.test.ts +289 -0
  72. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnOperators.test.ts +271 -0
  73. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRow.test.ts +119 -0
  74. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.test.ts +968 -0
  75. package/Tests/UI/Components/Workflow/ModelColumnEditor.render.test.tsx +766 -0
  76. package/Tests/UI/Utils/RunNetworkRule.test.ts +320 -0
  77. package/Tests/Utils/APIRetryPolicy.test.ts +823 -0
  78. package/Tests/Utils/Monitor/NetworkDeviceRoleUtil.test.ts +502 -0
  79. package/Tests/Utils/Monitor/NetworkTopologyDeclaredHierarchy.test.ts +759 -0
  80. package/Tests/Utils/NetworkAutomation/RuleRunSummary.test.ts +286 -0
  81. package/Tests/Utils/Schema/BaseSchema.test.ts +651 -0
  82. package/Types/API/Protocol.ts +9 -0
  83. package/Types/API/URL.ts +286 -20
  84. package/Types/Billing/PayAsYouGoPricing.ts +47 -0
  85. package/Types/CustomField/CustomFieldType.ts +28 -0
  86. package/Types/Monitor/MonitorType.ts +11 -0
  87. package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +13 -0
  88. package/Types/NetworkAutomation/RuleRunResult.ts +121 -0
  89. package/Types/Runbook/RunbookStepType.ts +23 -0
  90. package/UI/Components/AutocompleteTextInput/AutocompleteTextInput.tsx +7 -0
  91. package/UI/Components/Button/Button.tsx +14 -22
  92. package/UI/Components/Charts/Area/AreaChart.tsx +4 -2
  93. package/UI/Components/Charts/Bar/BarChart.tsx +4 -2
  94. package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +13 -0
  95. package/UI/Components/Charts/Line/LineChart.tsx +4 -2
  96. package/UI/Components/Charts/Types/XAxis/XAxis.ts +6 -0
  97. package/UI/Components/Charts/Utils/DataPoint.ts +15 -12
  98. package/UI/Components/Dictionary/Dictionary.tsx +4 -39
  99. package/UI/Components/Icon/Icon.tsx +1 -1
  100. package/UI/Components/LogsViewer/LogsViewer.tsx +5 -1
  101. package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +8 -0
  102. package/UI/Components/LogsViewer/components/LogsPagination.tsx +29 -91
  103. package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +2 -0
  104. package/UI/Components/LogsViewer/components/SavedViewsDropdown.tsx +66 -1
  105. package/UI/Components/ModelTable/CustomFieldColumns.tsx +55 -0
  106. package/UI/Components/Pagination/Pagination.tsx +373 -328
  107. package/UI/Components/Pagination/PaginationUtil.ts +263 -0
  108. package/UI/Components/Pagination/Screenshots/README.md +15 -0
  109. package/UI/Components/Pagination/Screenshots/pagination-before-after.png +0 -0
  110. package/UI/Components/Pagination/Screenshots/pagination-go-to-page-modal.png +0 -0
  111. package/UI/Components/Pagination/Screenshots/pagination-long-list.png +0 -0
  112. package/UI/Components/Pagination/Screenshots/pagination-mobile.png +0 -0
  113. package/UI/Components/Pagination/Screenshots/pagination-telemetry.png +0 -0
  114. package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +66 -1
  115. package/UI/Components/TelemetryViewer/components/TelemetryPagination.tsx +38 -92
  116. package/UI/Components/TextArea/TextArea.tsx +3 -0
  117. package/UI/Components/Workflow/ArgumentsForm.tsx +18 -1
  118. package/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.tsx +177 -0
  119. package/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.tsx +243 -0
  120. package/UI/Components/Workflow/ColumnEditor/ColumnControl.ts +255 -0
  121. package/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.tsx +178 -0
  122. package/UI/Components/Workflow/ColumnEditor/ColumnOperators.ts +206 -0
  123. package/UI/Components/Workflow/ColumnEditor/ColumnRow.ts +157 -0
  124. package/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.ts +517 -0
  125. package/UI/Components/Workflow/ColumnEditor/ColumnValueInput.tsx +482 -0
  126. package/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.tsx +131 -0
  127. package/UI/Components/Workflow/ColumnEditor/ModelRecordForm.tsx +163 -0
  128. package/UI/Components/Workflow/ModelColumnEditor.tsx +284 -100
  129. package/UI/Utils/NetworkAutomation/RunNetworkRule.ts +122 -0
  130. package/Utils/API.ts +243 -36
  131. package/Utils/Monitor/NetworkDeviceRoleUtil.ts +45 -0
  132. package/Utils/Monitor/NetworkTopologyUtil.ts +42 -2
  133. package/Utils/NetworkAutomation/RuleRunSummary.ts +147 -0
  134. package/build/dist/Models/DatabaseModels/NetworkDevice.js +45 -0
  135. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
  136. package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js +115 -0
  137. package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js.map +1 -1
  138. package/build/dist/Models/DatabaseModels/RunnerJob.js +17 -2
  139. package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
  140. package/build/dist/Server/API/LlmProviderAPI.js +9 -1
  141. package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
  142. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js +33 -0
  143. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js.map +1 -0
  144. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  145. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  146. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +202 -0
  147. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -1
  148. package/build/dist/Server/Services/NetworkDeviceLinkService.js +253 -1
  149. package/build/dist/Server/Services/NetworkDeviceLinkService.js.map +1 -1
  150. package/build/dist/Server/Services/NetworkDeviceService.js +223 -12
  151. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
  152. package/build/dist/Server/Services/RunnerJobService.js +20 -2
  153. package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
  154. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +12 -5
  155. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
  156. package/build/dist/Server/Types/Database/JSONColumnQuery.js +40 -4
  157. package/build/dist/Server/Types/Database/JSONColumnQuery.js.map +1 -1
  158. package/build/dist/Server/Utils/LLM/LLMService.js +78 -22
  159. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  160. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +22 -98
  161. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  162. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +7 -254
  163. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  164. package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js +14 -2
  165. package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js.map +1 -1
  166. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +27 -0
  167. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
  168. package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js +285 -0
  169. package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js.map +1 -0
  170. package/build/dist/Server/Utils/SSRFProtection.js +5 -4
  171. package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
  172. package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +128 -35
  173. package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -1
  174. package/build/dist/Types/API/Protocol.js +9 -0
  175. package/build/dist/Types/API/Protocol.js.map +1 -1
  176. package/build/dist/Types/API/URL.js +241 -18
  177. package/build/dist/Types/API/URL.js.map +1 -1
  178. package/build/dist/Types/Billing/PayAsYouGoPricing.js +41 -0
  179. package/build/dist/Types/Billing/PayAsYouGoPricing.js.map +1 -0
  180. package/build/dist/Types/CustomField/CustomFieldType.js +26 -0
  181. package/build/dist/Types/CustomField/CustomFieldType.js.map +1 -1
  182. package/build/dist/Types/Monitor/MonitorType.js +10 -0
  183. package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
  184. package/build/dist/Types/NetworkAutomation/RuleRunResult.js +39 -0
  185. package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -0
  186. package/build/dist/Types/Runbook/RunbookStepType.js +21 -0
  187. package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
  188. package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js +1 -1
  189. package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js.map +1 -1
  190. package/build/dist/UI/Components/Button/Button.js +10 -16
  191. package/build/dist/UI/Components/Button/Button.js.map +1 -1
  192. package/build/dist/UI/Components/Charts/Area/AreaChart.js +2 -1
  193. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  194. package/build/dist/UI/Components/Charts/Bar/BarChart.js +2 -1
  195. package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
  196. package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +12 -0
  197. package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -1
  198. package/build/dist/UI/Components/Charts/Line/LineChart.js +2 -1
  199. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  200. package/build/dist/UI/Components/Charts/Utils/DataPoint.js +17 -10
  201. package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
  202. package/build/dist/UI/Components/Dictionary/Dictionary.js +4 -18
  203. package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
  204. package/build/dist/UI/Components/Icon/Icon.js +1 -1
  205. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  206. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +3 -3
  207. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  208. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +5 -1
  209. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
  210. package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js +14 -44
  211. package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js.map +1 -1
  212. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +1 -1
  213. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
  214. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js +20 -2
  215. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js.map +1 -1
  216. package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js +42 -0
  217. package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js.map +1 -1
  218. package/build/dist/UI/Components/Pagination/Pagination.js +174 -199
  219. package/build/dist/UI/Components/Pagination/Pagination.js.map +1 -1
  220. package/build/dist/UI/Components/Pagination/PaginationUtil.js +160 -0
  221. package/build/dist/UI/Components/Pagination/PaginationUtil.js.map +1 -0
  222. package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +20 -2
  223. package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
  224. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js +23 -47
  225. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js.map +1 -1
  226. package/build/dist/UI/Components/TextArea/TextArea.js +1 -1
  227. package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
  228. package/build/dist/UI/Components/Workflow/ArgumentsForm.js +14 -2
  229. package/build/dist/UI/Components/Workflow/ArgumentsForm.js.map +1 -1
  230. package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js +86 -0
  231. package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js.map +1 -0
  232. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js +119 -0
  233. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js.map +1 -0
  234. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js +206 -0
  235. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js.map +1 -0
  236. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js +57 -0
  237. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js.map +1 -0
  238. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js +150 -0
  239. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js.map +1 -0
  240. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js +67 -0
  241. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js.map +1 -0
  242. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js +309 -0
  243. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js.map +1 -0
  244. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js +204 -0
  245. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js.map +1 -0
  246. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js +66 -0
  247. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js.map +1 -0
  248. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js +83 -0
  249. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js.map +1 -0
  250. package/build/dist/UI/Components/Workflow/ModelColumnEditor.js +187 -68
  251. package/build/dist/UI/Components/Workflow/ModelColumnEditor.js.map +1 -1
  252. package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js +75 -0
  253. package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js.map +1 -0
  254. package/build/dist/Utils/API.js +175 -34
  255. package/build/dist/Utils/API.js.map +1 -1
  256. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js +37 -0
  257. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js.map +1 -1
  258. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +25 -3
  259. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
  260. package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js +78 -0
  261. package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js.map +1 -0
  262. package/package.json +1 -1
@@ -1,20 +1,10 @@
1
- import CephCluster from "../../../Models/DatabaseModels/CephCluster";
2
- import DockerSwarmCluster from "../../../Models/DatabaseModels/DockerSwarmCluster";
3
- import DockerHost from "../../../Models/DatabaseModels/DockerHost";
4
- import Host from "../../../Models/DatabaseModels/Host";
5
1
  import Incident from "../../../Models/DatabaseModels/Incident";
6
2
  import IncidentSeverity from "../../../Models/DatabaseModels/IncidentSeverity";
7
3
  import IncidentStateTimeline from "../../../Models/DatabaseModels/IncidentStateTimeline";
8
4
  import IncidentMember from "../../../Models/DatabaseModels/IncidentMember";
9
- import KubernetesCluster from "../../../Models/DatabaseModels/KubernetesCluster";
10
5
  import Label from "../../../Models/DatabaseModels/Label";
11
6
  import Monitor from "../../../Models/DatabaseModels/Monitor";
12
7
  import OnCallDutyPolicy from "../../../Models/DatabaseModels/OnCallDutyPolicy";
13
- import PodmanHost from "../../../Models/DatabaseModels/PodmanHost";
14
- import ProxmoxCluster from "../../../Models/DatabaseModels/ProxmoxCluster";
15
- import IoTFleet from "../../../Models/DatabaseModels/IoTFleet";
16
- import Service from "../../../Models/DatabaseModels/Service";
17
- import Includes from "../../../Types/BaseDatabase/Includes";
18
8
  import SortOrder from "../../../Types/BaseDatabase/SortOrder";
19
9
  import { LIMIT_PER_PROJECT } from "../../../Types/Database/LimitMax";
20
10
  import Dictionary from "../../../Types/Dictionary";
@@ -25,14 +15,7 @@ import ObjectID from "../../../Types/ObjectID";
25
15
  import ProbeMonitorResponse from "../../../Types/Probe/ProbeMonitorResponse";
26
16
  import { TelemetryQuery } from "../../../Types/Telemetry/TelemetryQuery";
27
17
  import { DisableAutomaticIncidentCreation } from "../../EnvironmentConfig";
28
- import CephClusterService from "../../Services/CephClusterService";
29
- import DockerHostService from "../../Services/DockerHostService";
30
- import HostService from "../../Services/HostService";
31
18
  import IncidentService from "../../Services/IncidentService";
32
- import KubernetesClusterService from "../../Services/KubernetesClusterService";
33
- import PodmanHostService from "../../Services/PodmanHostService";
34
- import ProxmoxClusterService from "../../Services/ProxmoxClusterService";
35
- import ServiceService from "../../Services/ServiceService";
36
19
  import IncidentSeverityService from "../../Services/IncidentSeverityService";
37
20
  import ProjectScopedReferenceValidator from "../Database/ProjectScopedReferenceValidator";
38
21
  import IncidentStateTimelineService from "../../Services/IncidentStateTimelineService";
@@ -57,9 +40,7 @@ import { PerSeriesCriteriaMatch } from "../../../Types/Probe/ProbeApiIngestRespo
57
40
  import MonitorClusterContextUtil, {
58
41
  MonitorClusterContext,
59
42
  } from "./MonitorClusterContext";
60
- import SeriesResourceLabels, {
61
- SeriesResourceRefs,
62
- } from "./SeriesResourceLabels";
43
+ import SeriesResourceLinker from "./SeriesResourceLinker";
63
44
 
64
45
  export default class MonitorIncident {
65
46
  @CaptureSpan()
@@ -671,8 +652,8 @@ export default class MonitorIncident {
671
652
  if (seriesLabels && Object.keys(seriesLabels).length > 0) {
672
653
  incident.seriesLabels = seriesLabels;
673
654
 
674
- await this.linkResourceContextFromSeries({
675
- incident,
655
+ await SeriesResourceLinker.linkSeriesResourcesToModel({
656
+ model: incident,
676
657
  seriesLabels,
677
658
  projectId: input.monitor.projectId!,
678
659
  });
@@ -685,7 +666,10 @@ export default class MonitorIncident {
685
666
  * path resolved, so the per-cluster Activity tabs always see
686
667
  * monitor-created incidents.
687
668
  */
688
- this.attachClusterContext({ incident, clusterContext });
669
+ SeriesResourceLinker.attachClusterContext({
670
+ model: incident,
671
+ clusterContext,
672
+ });
689
673
 
690
674
  incident.onCallDutyPolicies =
691
675
  criteriaIncident.onCallPolicyIds?.map((id: ObjectID) => {
@@ -881,320 +865,6 @@ export default class MonitorIncident {
881
865
  return mergedIds;
882
866
  }
883
867
 
884
- /*
885
- * Pull every host / docker-host / k8s-cluster / proxmox-cluster /
886
- * ceph-cluster / service identifier out of the series labels and
887
- * attach the matching project-scoped records to the incident. The
888
- * label-key → resource-type mapping lives in SeriesResourceLabels
889
- * (shared with the scheduled-maintenance suppression path so the two
890
- * never disagree about which labels identify which resource). Lookups
891
- * are always project-scoped so a stale or hostile stamp can't pull in
892
- * a record from another tenant.
893
- */
894
- private static async linkResourceContextFromSeries(input: {
895
- incident: Incident;
896
- seriesLabels: JSONObject;
897
- projectId: ObjectID;
898
- }): Promise<void> {
899
- const refs: SeriesResourceRefs = SeriesResourceLabels.extractResourceRefs(
900
- input.seriesLabels,
901
- );
902
-
903
- const [
904
- resolvedHosts,
905
- resolvedDockerHosts,
906
- resolvedPodmanHosts,
907
- resolvedClusters,
908
- resolvedServices,
909
- resolvedProxmoxClusters,
910
- resolvedCephClusters,
911
- ] = await Promise.all([
912
- this.resolveResourceIds({
913
- ids: refs.hostIds,
914
- names: refs.hostNames,
915
- nameColumn: "hostIdentifier",
916
- projectId: input.projectId,
917
- findBy: HostService.findBy.bind(HostService),
918
- }),
919
- this.resolveResourceIds({
920
- ids: refs.dockerHostIds,
921
- names: refs.dockerHostNames,
922
- nameColumn: "hostIdentifier",
923
- projectId: input.projectId,
924
- findBy: DockerHostService.findBy.bind(DockerHostService),
925
- }),
926
- this.resolveResourceIds({
927
- ids: refs.podmanHostIds,
928
- names: refs.podmanHostNames,
929
- nameColumn: "hostIdentifier",
930
- projectId: input.projectId,
931
- findBy: PodmanHostService.findBy.bind(PodmanHostService),
932
- }),
933
- this.resolveResourceIds({
934
- ids: refs.kubernetesClusterIds,
935
- names: refs.kubernetesClusterNames,
936
- nameColumn: "clusterIdentifier",
937
- projectId: input.projectId,
938
- findBy: KubernetesClusterService.findBy.bind(KubernetesClusterService),
939
- }),
940
- this.resolveResourceIds({
941
- ids: refs.serviceIds,
942
- names: refs.serviceNames,
943
- nameColumn: "name",
944
- projectId: input.projectId,
945
- findBy: ServiceService.findBy.bind(ServiceService),
946
- }),
947
- this.resolveResourceIds({
948
- ids: [],
949
- names: refs.proxmoxClusterNames,
950
- nameColumn: "name",
951
- projectId: input.projectId,
952
- findBy: ProxmoxClusterService.findBy.bind(ProxmoxClusterService),
953
- }),
954
- this.resolveResourceIds({
955
- ids: [],
956
- names: refs.cephClusterNames,
957
- nameColumn: "name",
958
- projectId: input.projectId,
959
- findBy: CephClusterService.findBy.bind(CephClusterService),
960
- }),
961
- ]);
962
-
963
- if (resolvedHosts.length > 0) {
964
- input.incident.hosts = resolvedHosts.map((id: string): Host => {
965
- const host: Host = new Host();
966
- host._id = id;
967
- return host;
968
- });
969
- }
970
- if (resolvedDockerHosts.length > 0) {
971
- input.incident.dockerHosts = resolvedDockerHosts.map(
972
- (id: string): DockerHost => {
973
- const dockerHost: DockerHost = new DockerHost();
974
- dockerHost._id = id;
975
- return dockerHost;
976
- },
977
- );
978
- }
979
- if (resolvedPodmanHosts.length > 0) {
980
- input.incident.podmanHosts = resolvedPodmanHosts.map(
981
- (id: string): PodmanHost => {
982
- const podmanHost: PodmanHost = new PodmanHost();
983
- podmanHost._id = id;
984
- return podmanHost;
985
- },
986
- );
987
- }
988
- if (resolvedClusters.length > 0) {
989
- input.incident.kubernetesClusters = resolvedClusters.map(
990
- (id: string): KubernetesCluster => {
991
- const cluster: KubernetesCluster = new KubernetesCluster();
992
- cluster._id = id;
993
- return cluster;
994
- },
995
- );
996
- }
997
- if (resolvedServices.length > 0) {
998
- input.incident.services = resolvedServices.map((id: string): Service => {
999
- const service: Service = new Service();
1000
- service._id = id;
1001
- return service;
1002
- });
1003
- }
1004
- if (resolvedProxmoxClusters.length > 0) {
1005
- input.incident.proxmoxClusters = resolvedProxmoxClusters.map(
1006
- (id: string): ProxmoxCluster => {
1007
- const cluster: ProxmoxCluster = new ProxmoxCluster();
1008
- cluster._id = id;
1009
- return cluster;
1010
- },
1011
- );
1012
- }
1013
- if (resolvedCephClusters.length > 0) {
1014
- input.incident.cephClusters = resolvedCephClusters.map(
1015
- (id: string): CephCluster => {
1016
- const cluster: CephCluster = new CephCluster();
1017
- cluster._id = id;
1018
- return cluster;
1019
- },
1020
- );
1021
- }
1022
- }
1023
-
1024
- /*
1025
- * Attach the monitor-step-resolved Proxmox/Ceph cluster ids to the
1026
- * incident, merging with (never overwriting) anything the
1027
- * series-label path already linked. Both paths can resolve the same
1028
- * cluster, so dedupe by id.
1029
- */
1030
- private static attachClusterContext(input: {
1031
- incident: Incident;
1032
- clusterContext: MonitorClusterContext;
1033
- }): void {
1034
- if (input.clusterContext.proxmoxClusterIds.length > 0) {
1035
- const existingIds: Set<string> = new Set<string>(
1036
- (input.incident.proxmoxClusters || []).map(
1037
- (cluster: ProxmoxCluster) => {
1038
- return String(cluster._id);
1039
- },
1040
- ),
1041
- );
1042
-
1043
- const merged: Array<ProxmoxCluster> = [
1044
- ...(input.incident.proxmoxClusters || []),
1045
- ];
1046
-
1047
- for (const id of input.clusterContext.proxmoxClusterIds) {
1048
- if (existingIds.has(id)) {
1049
- continue;
1050
- }
1051
- const cluster: ProxmoxCluster = new ProxmoxCluster();
1052
- cluster._id = id;
1053
- merged.push(cluster);
1054
- }
1055
-
1056
- input.incident.proxmoxClusters = merged;
1057
- }
1058
-
1059
- if (input.clusterContext.cephClusterIds.length > 0) {
1060
- const existingIds: Set<string> = new Set<string>(
1061
- (input.incident.cephClusters || []).map((cluster: CephCluster) => {
1062
- return String(cluster._id);
1063
- }),
1064
- );
1065
-
1066
- const merged: Array<CephCluster> = [
1067
- ...(input.incident.cephClusters || []),
1068
- ];
1069
-
1070
- for (const id of input.clusterContext.cephClusterIds) {
1071
- if (existingIds.has(id)) {
1072
- continue;
1073
- }
1074
- const cluster: CephCluster = new CephCluster();
1075
- cluster._id = id;
1076
- merged.push(cluster);
1077
- }
1078
-
1079
- input.incident.cephClusters = merged;
1080
- }
1081
-
1082
- if (input.clusterContext.dockerSwarmClusterIds.length > 0) {
1083
- const existingIds: Set<string> = new Set<string>(
1084
- (input.incident.dockerSwarmClusters || []).map(
1085
- (cluster: DockerSwarmCluster) => {
1086
- return String(cluster._id);
1087
- },
1088
- ),
1089
- );
1090
-
1091
- const merged: Array<DockerSwarmCluster> = [
1092
- ...(input.incident.dockerSwarmClusters || []),
1093
- ];
1094
-
1095
- for (const id of input.clusterContext.dockerSwarmClusterIds) {
1096
- if (existingIds.has(id)) {
1097
- continue;
1098
- }
1099
- const cluster: DockerSwarmCluster = new DockerSwarmCluster();
1100
- cluster._id = id;
1101
- merged.push(cluster);
1102
- }
1103
-
1104
- input.incident.dockerSwarmClusters = merged;
1105
- }
1106
-
1107
- if (input.clusterContext.iotFleetIds.length > 0) {
1108
- const existingIds: Set<string> = new Set<string>(
1109
- (input.incident.iotFleets || []).map((fleet: IoTFleet) => {
1110
- return String(fleet._id);
1111
- }),
1112
- );
1113
-
1114
- const merged: Array<IoTFleet> = [...(input.incident.iotFleets || [])];
1115
-
1116
- for (const id of input.clusterContext.iotFleetIds) {
1117
- if (existingIds.has(id)) {
1118
- continue;
1119
- }
1120
- const fleet: IoTFleet = new IoTFleet();
1121
- fleet._id = id;
1122
- merged.push(fleet);
1123
- }
1124
-
1125
- input.incident.iotFleets = merged;
1126
- }
1127
- }
1128
-
1129
- /*
1130
- * Resolve a mix of ids and names to a deduped set of database ids
1131
- * for one resource type, project-scoped. Either or both lists may
1132
- * be empty; if both are empty the method short-circuits with no DB
1133
- * round-trip.
1134
- */
1135
- private static async resolveResourceIds(input: {
1136
- ids: Array<string>;
1137
- names: Array<string>;
1138
- nameColumn: string;
1139
- projectId: ObjectID;
1140
- /*
1141
- * Loosely typed because the three resource services (Host,
1142
- * DockerHost, KubernetesCluster) each have their own
1143
- * `Query<TBaseModel>` shape and we deliberately abstract over
1144
- * them. We only need the row's `_id` back, which every model
1145
- * exposes via `DatabaseBaseModel`.
1146
- */
1147
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1148
- findBy: (args: any) => Promise<Array<{ _id?: string | undefined }>>;
1149
- }): Promise<Array<string>> {
1150
- if (input.ids.length === 0 && input.names.length === 0) {
1151
- return [];
1152
- }
1153
-
1154
- const resolved: Set<string> = new Set<string>();
1155
-
1156
- const lookups: Array<Promise<Array<{ _id?: string | undefined }>>> = [];
1157
- if (input.ids.length > 0) {
1158
- lookups.push(
1159
- input.findBy({
1160
- query: {
1161
- projectId: input.projectId,
1162
- _id: new Includes(input.ids),
1163
- },
1164
- select: { _id: true },
1165
- skip: 0,
1166
- limit: LIMIT_PER_PROJECT,
1167
- props: { isRoot: true },
1168
- }),
1169
- );
1170
- }
1171
- if (input.names.length > 0) {
1172
- lookups.push(
1173
- input.findBy({
1174
- query: {
1175
- projectId: input.projectId,
1176
- [input.nameColumn]: new Includes(input.names),
1177
- },
1178
- select: { _id: true },
1179
- skip: 0,
1180
- limit: LIMIT_PER_PROJECT,
1181
- props: { isRoot: true },
1182
- }),
1183
- );
1184
- }
1185
-
1186
- const buckets: Array<Array<{ _id?: string | undefined }>> =
1187
- await Promise.all(lookups);
1188
- for (const bucket of buckets) {
1189
- for (const row of bucket) {
1190
- if (row._id) {
1191
- resolved.add(String(row._id));
1192
- }
1193
- }
1194
- }
1195
- return Array.from(resolved);
1196
- }
1197
-
1198
868
  private static async resolveOpenIncident(input: {
1199
869
  openIncident: Incident;
1200
870
  rootCause: string;
@@ -31,6 +31,12 @@ export interface MaintainedResourceKeys {
31
31
  */
32
32
  proxmoxClusters: ResourceKeySet;
33
33
  cephClusters: ResourceKeySet;
34
+ /*
35
+ * Docker Swarm clusters, like Proxmox/Ceph clusters, have no
36
+ * `oneuptime.*.id` label stamp, so only the name set is ever matched;
37
+ * the id set exists for shape parity.
38
+ */
39
+ dockerSwarmClusters: ResourceKeySet;
34
40
  /*
35
41
  * IoT fleets, like Proxmox/Ceph clusters, have no `oneuptime.*.id`
36
42
  * label stamp, so only the name set is ever matched; the id set
@@ -140,6 +146,10 @@ export default class MonitorMaintenanceSuppression {
140
146
  refs.cephClusterNames,
141
147
  input.maintained.cephClusters.names,
142
148
  ) ||
149
+ this.intersects(
150
+ refs.dockerSwarmClusterNames,
151
+ input.maintained.dockerSwarmClusters.names,
152
+ ) ||
143
153
  this.intersects(refs.iotFleetNames, input.maintained.iotFleets.names) ||
144
154
  this.intersects(refs.serviceIds, input.maintained.services.ids) ||
145
155
  this.intersects(refs.serviceNames, input.maintained.services.names);
@@ -177,6 +187,8 @@ export default class MonitorMaintenanceSuppression {
177
187
  maintained.proxmoxClusters.names.size > 0 ||
178
188
  maintained.cephClusters.ids.size > 0 ||
179
189
  maintained.cephClusters.names.size > 0 ||
190
+ maintained.dockerSwarmClusters.ids.size > 0 ||
191
+ maintained.dockerSwarmClusters.names.size > 0 ||
180
192
  maintained.iotFleets.ids.size > 0 ||
181
193
  maintained.iotFleets.names.size > 0 ||
182
194
  maintained.services.ids.size > 0 ||
@@ -186,8 +198,9 @@ export default class MonitorMaintenanceSuppression {
186
198
 
187
199
  /*
188
200
  * Collect the ids + identifiers of every Host / DockerHost /
189
- * KubernetesCluster / ProxmoxCluster / CephCluster / Service attached
190
- * to an ongoing maintenance event in this project. Monitors attached
201
+ * PodmanHost / KubernetesCluster / ProxmoxCluster / CephCluster /
202
+ * DockerSwarmCluster / IoTFleet / Service attached to an ongoing
203
+ * maintenance event in this project. Monitors attached
191
204
  * to the event are intentionally not collected here — those are
192
205
  * already handled upstream by the whole-monitor disable flag, which
193
206
  * short-circuits evaluation before we ever reach per-series creation.
@@ -202,6 +215,10 @@ export default class MonitorMaintenanceSuppression {
202
215
  kubernetesClusters: { ids: new Set<string>(), names: new Set<string>() },
203
216
  proxmoxClusters: { ids: new Set<string>(), names: new Set<string>() },
204
217
  cephClusters: { ids: new Set<string>(), names: new Set<string>() },
218
+ dockerSwarmClusters: {
219
+ ids: new Set<string>(),
220
+ names: new Set<string>(),
221
+ },
205
222
  iotFleets: { ids: new Set<string>(), names: new Set<string>() },
206
223
  services: { ids: new Set<string>(), names: new Set<string>() },
207
224
  };
@@ -222,6 +239,7 @@ export default class MonitorMaintenanceSuppression {
222
239
  kubernetesClusters: { _id: true, clusterIdentifier: true },
223
240
  proxmoxClusters: { _id: true, name: true },
224
241
  cephClusters: { _id: true, name: true },
242
+ dockerSwarmClusters: { _id: true, name: true },
225
243
  iotFleets: { _id: true, name: true },
226
244
  services: { _id: true, name: true },
227
245
  },
@@ -267,6 +285,13 @@ export default class MonitorMaintenanceSuppression {
267
285
  for (const cephCluster of event.cephClusters || []) {
268
286
  this.addKey(maintained.cephClusters, cephCluster._id, cephCluster.name);
269
287
  }
288
+ for (const swarmCluster of event.dockerSwarmClusters || []) {
289
+ this.addKey(
290
+ maintained.dockerSwarmClusters,
291
+ swarmCluster._id,
292
+ swarmCluster.name,
293
+ );
294
+ }
270
295
  for (const iotFleet of event.iotFleets || []) {
271
296
  this.addKey(maintained.iotFleets, iotFleet._id, iotFleet.name);
272
297
  }
@@ -64,6 +64,25 @@ export const PodmanHostNameLabelKeys: ReadonlyArray<string> = [
64
64
  "oneuptime.podman.host.name",
65
65
  ];
66
66
 
67
+ /*
68
+ * Docker Swarm cluster identity rides the agent-stamped resource
69
+ * attribute (`docker.swarm.cluster.name`) and its ClickHouse
70
+ * `resource.`-prefixed twin. The Swarm agent's collector config stamps
71
+ * it on every signal as the documented join key, and ingest keys cluster
72
+ * rows by that name only — there is no `oneuptime.*.id` stamp — so only
73
+ * name keys exist. The name maps to the cluster model's `name` column.
74
+ * Like Proxmox/Ceph, the shipped Swarm alert templates group by
75
+ * datapoint labels (`container.name`), so their series labels do NOT
76
+ * carry this key; the deterministic cluster link for those monitors
77
+ * comes from the monitor step config instead (see MonitorClusterContext).
78
+ * These keys cover user-built monitors that group by the cluster
79
+ * attribute.
80
+ */
81
+ export const DockerSwarmClusterNameLabelKeys: ReadonlyArray<string> = [
82
+ "resource.docker.swarm.cluster.name",
83
+ "docker.swarm.cluster.name",
84
+ ];
85
+
67
86
  export const KubernetesClusterIdLabelKeys: ReadonlyArray<string> = [
68
87
  "resource.oneuptime.kubernetes.cluster.id",
69
88
  "oneuptime.kubernetes.cluster.id",
@@ -129,6 +148,14 @@ export const ServiceIdLabelKeys: ReadonlyArray<string> = [
129
148
  ];
130
149
 
131
150
  export const ServiceNameLabelKeys: ReadonlyArray<string> = [
151
+ /*
152
+ * Ingest stamps `oneuptime.service.name` alongside `oneuptime.service.id`
153
+ * on every row (Telemetry.getAttributesForServiceIdAndServiceName). It
154
+ * carries the same Service row's name as the raw `service.name` resource
155
+ * attribute, so the group-by dropdown can surface either spelling.
156
+ */
157
+ "resource.oneuptime.service.name",
158
+ "oneuptime.service.name",
132
159
  "resource.service.name",
133
160
  "service.name",
134
161
  ];
@@ -149,6 +176,7 @@ export interface SeriesResourceRefs {
149
176
  podmanHostNames: Array<string>;
150
177
  kubernetesClusterIds: Array<string>;
151
178
  kubernetesClusterNames: Array<string>;
179
+ dockerSwarmClusterNames: Array<string>;
152
180
  proxmoxClusterNames: Array<string>;
153
181
  cephClusterNames: Array<string>;
154
182
  iotFleetNames: Array<string>;
@@ -218,6 +246,10 @@ export default class SeriesResourceLabels {
218
246
  seriesLabels,
219
247
  KubernetesClusterNameLabelKeys,
220
248
  ),
249
+ dockerSwarmClusterNames: this.collectLabelValues(
250
+ seriesLabels,
251
+ DockerSwarmClusterNameLabelKeys,
252
+ ),
221
253
  proxmoxClusterNames: this.collectLabelValues(
222
254
  seriesLabels,
223
255
  ProxmoxClusterNameLabelKeys,