@oneuptime/common 12.0.30 → 12.0.31

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 (489) hide show
  1. package/Models/AnalyticsModels/SecurityEvent.ts +48 -16
  2. package/Models/AnalyticsModels/ThreatIntelIndicator.ts +10 -5
  3. package/Models/DatabaseModels/AlertSeverity.ts +44 -0
  4. package/Models/DatabaseModels/DetectionRule.ts +16 -5
  5. package/Models/DatabaseModels/GoogleSecOpsConnection.ts +14 -5
  6. package/Models/DatabaseModels/IncidentSeverity.ts +44 -0
  7. package/Models/DatabaseModels/Index.ts +2 -0
  8. package/Models/DatabaseModels/NetworkDevice.ts +113 -3
  9. package/Models/DatabaseModels/NetworkDeviceAutoImportRule.ts +88 -0
  10. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +22 -0
  11. package/Models/DatabaseModels/NetworkDeviceOidTemplate.ts +499 -0
  12. package/Models/DatabaseModels/ThreatIntelFeed.ts +16 -5
  13. package/Server/API/GlobalConfigAPI.ts +362 -183
  14. package/Server/API/TelemetryAPI.ts +42 -4
  15. package/Server/EnvironmentConfig.ts +112 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.ts +59 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.ts +25 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  19. package/Server/Middleware/MultipartFormData.ts +118 -32
  20. package/Server/Services/AlertEpisodeLabelRuleEngineService.ts +9 -1
  21. package/Server/Services/AlertEpisodeOnCallRuleEngineService.ts +9 -1
  22. package/Server/Services/AlertEpisodeOwnerRuleEngineService.ts +9 -1
  23. package/Server/Services/AlertEpisodePrivacyRuleEngineService.ts +9 -1
  24. package/Server/Services/AlertGroupingEngineService.ts +9 -1
  25. package/Server/Services/AlertLabelRuleEngineService.ts +9 -1
  26. package/Server/Services/AlertOnCallRuleEngineService.ts +9 -1
  27. package/Server/Services/AlertOwnerRuleEngineService.ts +9 -1
  28. package/Server/Services/AlertPrivacyRuleEngineService.ts +9 -1
  29. package/Server/Services/AlertReminderRuleService.ts +9 -1
  30. package/Server/Services/AutoRemediationRuleEngineService.ts +9 -1
  31. package/Server/Services/CephClusterLabelRuleEngineService.ts +9 -1
  32. package/Server/Services/CephClusterOwnerRuleEngineService.ts +9 -1
  33. package/Server/Services/CloudResourceLabelRuleEngineService.ts +9 -1
  34. package/Server/Services/CloudResourceOwnerRuleEngineService.ts +9 -1
  35. package/Server/Services/DashboardLabelRuleEngineService.ts +9 -1
  36. package/Server/Services/DashboardOwnerRuleEngineService.ts +9 -1
  37. package/Server/Services/DockerHostLabelRuleEngineService.ts +9 -1
  38. package/Server/Services/DockerHostOwnerRuleEngineService.ts +9 -1
  39. package/Server/Services/DockerSwarmClusterLabelRuleEngineService.ts +9 -1
  40. package/Server/Services/DockerSwarmClusterOwnerRuleEngineService.ts +9 -1
  41. package/Server/Services/HostLabelRuleEngineService.ts +9 -1
  42. package/Server/Services/HostOwnerRuleEngineService.ts +9 -1
  43. package/Server/Services/IncidentEpisodeLabelRuleEngineService.ts +9 -1
  44. package/Server/Services/IncidentEpisodeOnCallRuleEngineService.ts +9 -1
  45. package/Server/Services/IncidentEpisodeOwnerRuleEngineService.ts +9 -1
  46. package/Server/Services/IncidentEpisodePrivacyRuleEngineService.ts +9 -1
  47. package/Server/Services/IncidentGroupingEngineService.ts +9 -1
  48. package/Server/Services/IncidentLabelRuleEngineService.ts +9 -1
  49. package/Server/Services/IncidentOnCallRuleEngineService.ts +9 -1
  50. package/Server/Services/IncidentOwnerRuleEngineService.ts +9 -1
  51. package/Server/Services/IncidentPrivacyRuleEngineService.ts +9 -1
  52. package/Server/Services/IncidentReminderRuleService.ts +9 -1
  53. package/Server/Services/IncidentSlaRuleService.ts +9 -1
  54. package/Server/Services/IncomingCallPolicyLabelRuleEngineService.ts +9 -1
  55. package/Server/Services/IncomingCallPolicyOwnerRuleEngineService.ts +9 -1
  56. package/Server/Services/Index.ts +2 -0
  57. package/Server/Services/IoTFleetLabelRuleEngineService.ts +9 -1
  58. package/Server/Services/IoTFleetOwnerRuleEngineService.ts +9 -1
  59. package/Server/Services/KubernetesClusterLabelRuleEngineService.ts +9 -1
  60. package/Server/Services/KubernetesClusterOwnerRuleEngineService.ts +9 -1
  61. package/Server/Services/KubernetesResourceService.ts +5 -1
  62. package/Server/Services/MonitorLabelRuleEngineService.ts +9 -1
  63. package/Server/Services/MonitorOwnerRuleEngineService.ts +9 -1
  64. package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +35 -0
  65. package/Server/Services/NetworkDeviceAutoImportRuleService.ts +96 -0
  66. package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +9 -1
  67. package/Server/Services/NetworkDeviceOidTemplateService.ts +201 -0
  68. package/Server/Services/NetworkDeviceOwnerRuleEngineService.ts +9 -1
  69. package/Server/Services/NetworkDeviceService.ts +209 -1
  70. package/Server/Services/OnCallDutyPolicyLabelRuleEngineService.ts +9 -1
  71. package/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.ts +9 -1
  72. package/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.ts +9 -1
  73. package/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.ts +9 -1
  74. package/Server/Services/PodmanHostLabelRuleEngineService.ts +9 -1
  75. package/Server/Services/PodmanHostOwnerRuleEngineService.ts +9 -1
  76. package/Server/Services/ProxmoxClusterLabelRuleEngineService.ts +9 -1
  77. package/Server/Services/ProxmoxClusterOwnerRuleEngineService.ts +9 -1
  78. package/Server/Services/RumApplicationLabelRuleEngineService.ts +9 -1
  79. package/Server/Services/RumApplicationOwnerRuleEngineService.ts +9 -1
  80. package/Server/Services/RunbookLabelRuleEngineService.ts +9 -1
  81. package/Server/Services/RunbookOwnerRuleEngineService.ts +9 -1
  82. package/Server/Services/RunbookRuleEngineService.ts +9 -1
  83. package/Server/Services/ScheduledMaintenanceLabelRuleEngineService.ts +9 -1
  84. package/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.ts +9 -1
  85. package/Server/Services/ScheduledMaintenanceReminderRuleService.ts +9 -1
  86. package/Server/Services/ServerlessFunctionLabelRuleEngineService.ts +9 -1
  87. package/Server/Services/ServerlessFunctionOwnerRuleEngineService.ts +9 -1
  88. package/Server/Services/ServiceLabelRuleEngineService.ts +9 -1
  89. package/Server/Services/ServiceOwnerRuleEngineService.ts +9 -1
  90. package/Server/Services/StatusPageLabelRuleEngineService.ts +9 -1
  91. package/Server/Services/StatusPageMonitorRuleEngineService.ts +7 -0
  92. package/Server/Services/StatusPageOwnerRuleEngineService.ts +9 -1
  93. package/Server/Services/TelemetrySourceMapService.ts +266 -23
  94. package/Server/Services/UserService.ts +27 -0
  95. package/Server/Services/WorkflowLabelRuleEngineService.ts +9 -1
  96. package/Server/Services/WorkflowOwnerRuleEngineService.ts +9 -1
  97. package/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.ts +186 -0
  98. package/Server/Utils/Monitor/CapturedMetricAttributeUtil.ts +245 -0
  99. package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +21 -2
  100. package/Server/Utils/Monitor/MonitorMetricUtil.ts +55 -21
  101. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +32 -0
  102. package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +15 -2
  103. package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +18 -1
  104. package/Server/Utils/Monitor/NetworkInventoryUtil.ts +10 -0
  105. package/Server/Utils/Monitor/SeriesResourceLabels.ts +34 -0
  106. package/Server/Utils/Rules/RuleEngineRuleRead.ts +48 -0
  107. package/Server/Utils/Telemetry/ExceptionSanitizer.ts +14 -1
  108. package/Server/Utils/Telemetry/LogExceptionExtractor.ts +14 -2
  109. package/Server/Utils/Telemetry/SourceMapResolver.ts +16 -5
  110. package/Server/Utils/Telemetry/StackTraceParser.ts +399 -0
  111. package/Tests/App/Dashboard/EventOverlayHook.test.tsx +125 -0
  112. package/Tests/App/Dashboard/HeaderImageAssets.test.tsx +93 -0
  113. package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +3 -3
  114. package/Tests/App/Dashboard/UserElementEmail.test.tsx +12 -4
  115. package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +1 -1
  116. package/Tests/Models/DatabaseModels/DomainRoleTierCoverage.test.ts +14 -0
  117. package/Tests/Models/DatabaseModels/ModelRegistryInvariants.test.ts +469 -0
  118. package/Tests/Models/SecurityDomainAccessControl.test.ts +429 -0
  119. package/Tests/Server/API/GlobalConfigLicense.test.ts +657 -0
  120. package/Tests/Server/API/SecurityEventAttributesAPI.test.ts +84 -6
  121. package/Tests/Server/API/TelemetryResolveStackTraceAPI.test.ts +805 -0
  122. package/Tests/Server/Infrastructure/Postgres/AddOnCallCalendarFeedsMigration.test.ts +32 -7
  123. package/Tests/Server/Middleware/IdentityRateLimit.test.ts +1144 -0
  124. package/Tests/Server/Middleware/MultipartFormData.test.ts +618 -3
  125. package/Tests/Server/Services/MonitorLabelRuleEngineScale.test.ts +520 -0
  126. package/Tests/Server/Services/NetworkDeviceOidTemplateService.test.ts +332 -0
  127. package/Tests/Server/Services/NetworkDeviceOidTemplateWriteGuards.test.ts +409 -0
  128. package/Tests/Server/Services/RuleEngineRuleFetchLimit.test.ts +239 -0
  129. package/Tests/Server/Services/TelemetrySourceMapService.test.ts +1210 -2
  130. package/Tests/Server/Services/UserServiceSeatLimit.test.ts +182 -0
  131. package/Tests/Server/Types/AnalyticsDatabase/SecurityEventModelPermission.test.ts +255 -0
  132. package/Tests/Server/Types/Database/Permissions/ReadBlockPermission.test.ts +212 -0
  133. package/Tests/Server/Types/Database/Permissions/SecurityRoleAccess.test.ts +413 -0
  134. package/Tests/Server/Utils/CodeRepository.test.ts +689 -0
  135. package/Tests/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.test.ts +495 -0
  136. package/Tests/Server/Utils/ExceptionSanitizer.test.ts +77 -0
  137. package/Tests/Server/Utils/Monitor/CapturedMetricAttributeUtil.test.ts +284 -0
  138. package/Tests/Server/Utils/Monitor/MonitorCustomMetricAttributes.test.ts +503 -0
  139. package/Tests/Server/Utils/Monitor/MonitorTemplatePrototypePollution.test.ts +106 -0
  140. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkLogWritePath.test.ts +33 -4
  141. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +14 -4
  142. package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +44 -0
  143. package/Tests/Server/Utils/OpenAPISpec.test.ts +536 -0
  144. package/Tests/Server/Utils/Rules/RuleEngineRuleRead.test.ts +115 -0
  145. package/Tests/Server/Utils/StackTraceParser.test.ts +610 -0
  146. package/Tests/Server/Utils/Telemetry/LogExceptionExtractor.test.ts +0 -0
  147. package/Tests/Server/Utils/Telemetry/SourceMapLimits.test.ts +656 -0
  148. package/Tests/Server/Utils/Telemetry/SourceMapResolver.test.ts +100 -0
  149. package/Tests/Types/Monitor/SnmpMonitor/SnmpOidListUtil.test.ts +454 -0
  150. package/Tests/Types/SecurityRolePermissions.test.ts +193 -0
  151. package/Tests/UI/Components/Charts/AnnotationLayout.test.ts +773 -0
  152. package/Tests/UI/Components/Charts/ChartAnnotationRail.test.tsx +789 -0
  153. package/Tests/UI/Components/Charts/ChartBucketIdentity.test.ts +254 -0
  154. package/Tests/UI/Components/Charts/TimeAnnotation.test.ts +471 -0
  155. package/Tests/UI/Components/EditionLabelLicenseRefresh.test.tsx +405 -0
  156. package/Tests/UI/Components/ErrorMessageRefreshControl.test.tsx +83 -0
  157. package/Tests/UI/Components/MarkdownConverters.test.ts +686 -0
  158. package/Tests/UI/Components/ModelTable/BaseModelTableDeleteAndEmptyStates.test.tsx +341 -0
  159. package/Tests/UI/Components/OrderedStatesList.test.tsx +5 -5
  160. package/Tests/UI/Components/PendingProjectInvitations.test.tsx +1 -1
  161. package/Tests/UI/Components/TableSortAndMobileColumns.test.tsx +195 -0
  162. package/Tests/UI/Components/XAxis.test.ts +270 -5
  163. package/Tests/UI/Components/XAxisDaylightSaving.test.ts +113 -0
  164. package/Tests/UI/Styles/ChartFocusRing.test.ts +153 -0
  165. package/Tests/UI/Styles/ChartFocusRingCoverage.test.tsx +377 -0
  166. package/Tests/UI/Styles/ThemeStylesheet.ts +162 -0
  167. package/Tests/Utils/EnterpriseLicenseSeats.test.ts +507 -0
  168. package/Tests/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.test.ts +951 -1
  169. package/Tests/Utils/NetworkDiscovery/DiscoveredHostUtil.test.ts +238 -0
  170. package/Tests/Utils/NetworkDiscovery/DiscoveryReverseDnsChain.test.ts +1056 -0
  171. package/Tests/Utils/NetworkDiscovery/ReverseDnsNameUtil.test.ts +882 -0
  172. package/Types/Date.ts +39 -0
  173. package/Types/Monitor/SnmpMonitor/SnmpOidListUtil.ts +333 -0
  174. package/Types/Permission.ts +96 -0
  175. package/Types/Rum/SessionReplay.ts +21 -0
  176. package/Types/Telemetry/SourceMap.ts +8 -0
  177. package/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.tsx +176 -0
  178. package/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.ts +745 -0
  179. package/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.tsx +576 -0
  180. package/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.tsx +204 -0
  181. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +491 -544
  182. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +324 -372
  183. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +487 -540
  184. package/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.ts +7 -3
  185. package/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.ts +14 -3
  186. package/UI/Components/Charts/Types/ChartEventKind.ts +13 -0
  187. package/UI/Components/Charts/Types/ReferenceRegionProps.ts +6 -0
  188. package/UI/Components/Charts/Types/TimeReferenceLineProps.ts +20 -3
  189. package/UI/Components/Charts/Utils/TimeAnnotation.ts +69 -35
  190. package/UI/Components/Charts/Utils/XAxis.ts +125 -18
  191. package/UI/Components/EditionLabel/EditionLabel.tsx +280 -26
  192. package/UI/Components/ErrorMessage/ErrorMessage.tsx +21 -10
  193. package/UI/Components/Feed/FeedItem.tsx +4 -5
  194. package/UI/Components/Header/HeaderIconDropdownButton.tsx +1 -2
  195. package/UI/Components/Header/UserProfile/UserProfile.tsx +1 -2
  196. package/UI/Components/Image/Image.tsx +20 -3
  197. package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
  198. package/UI/Components/MemberRoleAssignment/MemberRoleAssignment.tsx +1 -2
  199. package/UI/Components/ModelTable/BaseModelTable.tsx +150 -24
  200. package/UI/Components/Table/TableHeader.tsx +64 -48
  201. package/UI/Components/Table/TableRow.tsx +13 -3
  202. package/UI/Styles/Theme.css +38 -0
  203. package/Utils/EnterpriseLicense/EnterpriseLicenseSeats.ts +271 -0
  204. package/Utils/NetworkDiscovery/AutoImportRuleMatcher.ts +6 -0
  205. package/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts +141 -10
  206. package/Utils/NetworkDiscovery/DiscoveredHostUtil.ts +55 -3
  207. package/Utils/NetworkDiscovery/ReverseDnsNameUtil.ts +151 -0
  208. package/Utils/Rules/RuleEngineLimits.ts +32 -0
  209. package/build/dist/Models/AnalyticsModels/SecurityEvent.js +48 -16
  210. package/build/dist/Models/AnalyticsModels/SecurityEvent.js.map +1 -1
  211. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js +10 -5
  212. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js.map +1 -1
  213. package/build/dist/Models/DatabaseModels/AlertSeverity.js +46 -1
  214. package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
  215. package/build/dist/Models/DatabaseModels/DetectionRule.js +16 -5
  216. package/build/dist/Models/DatabaseModels/DetectionRule.js.map +1 -1
  217. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js +14 -5
  218. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js.map +1 -1
  219. package/build/dist/Models/DatabaseModels/IncidentSeverity.js +46 -1
  220. package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
  221. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  222. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  223. package/build/dist/Models/DatabaseModels/NetworkDevice.js +115 -3
  224. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
  225. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js +88 -0
  226. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js.map +1 -1
  227. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
  228. package/build/dist/Models/DatabaseModels/NetworkDeviceOidTemplate.js +519 -0
  229. package/build/dist/Models/DatabaseModels/NetworkDeviceOidTemplate.js.map +1 -0
  230. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js +16 -5
  231. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js.map +1 -1
  232. package/build/dist/Server/API/GlobalConfigAPI.js +293 -176
  233. package/build/dist/Server/API/GlobalConfigAPI.js.map +1 -1
  234. package/build/dist/Server/API/TelemetryAPI.js +31 -3
  235. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  236. package/build/dist/Server/EnvironmentConfig.js +83 -0
  237. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  238. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.js +26 -0
  239. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.js.map +1 -0
  240. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.js +14 -0
  241. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.js.map +1 -0
  242. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  243. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  244. package/build/dist/Server/Middleware/MultipartFormData.js +93 -28
  245. package/build/dist/Server/Middleware/MultipartFormData.js.map +1 -1
  246. package/build/dist/Server/Services/AlertEpisodeLabelRuleEngineService.js +8 -1
  247. package/build/dist/Server/Services/AlertEpisodeLabelRuleEngineService.js.map +1 -1
  248. package/build/dist/Server/Services/AlertEpisodeOnCallRuleEngineService.js +8 -1
  249. package/build/dist/Server/Services/AlertEpisodeOnCallRuleEngineService.js.map +1 -1
  250. package/build/dist/Server/Services/AlertEpisodeOwnerRuleEngineService.js +8 -1
  251. package/build/dist/Server/Services/AlertEpisodeOwnerRuleEngineService.js.map +1 -1
  252. package/build/dist/Server/Services/AlertEpisodePrivacyRuleEngineService.js +8 -1
  253. package/build/dist/Server/Services/AlertEpisodePrivacyRuleEngineService.js.map +1 -1
  254. package/build/dist/Server/Services/AlertGroupingEngineService.js +8 -1
  255. package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -1
  256. package/build/dist/Server/Services/AlertLabelRuleEngineService.js +8 -1
  257. package/build/dist/Server/Services/AlertLabelRuleEngineService.js.map +1 -1
  258. package/build/dist/Server/Services/AlertOnCallRuleEngineService.js +8 -1
  259. package/build/dist/Server/Services/AlertOnCallRuleEngineService.js.map +1 -1
  260. package/build/dist/Server/Services/AlertOwnerRuleEngineService.js +8 -1
  261. package/build/dist/Server/Services/AlertOwnerRuleEngineService.js.map +1 -1
  262. package/build/dist/Server/Services/AlertPrivacyRuleEngineService.js +8 -1
  263. package/build/dist/Server/Services/AlertPrivacyRuleEngineService.js.map +1 -1
  264. package/build/dist/Server/Services/AlertReminderRuleService.js +8 -1
  265. package/build/dist/Server/Services/AlertReminderRuleService.js.map +1 -1
  266. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +8 -1
  267. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
  268. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js +8 -1
  269. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js.map +1 -1
  270. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js +8 -1
  271. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js.map +1 -1
  272. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js +8 -1
  273. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js.map +1 -1
  274. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js +8 -1
  275. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js.map +1 -1
  276. package/build/dist/Server/Services/DashboardLabelRuleEngineService.js +8 -1
  277. package/build/dist/Server/Services/DashboardLabelRuleEngineService.js.map +1 -1
  278. package/build/dist/Server/Services/DashboardOwnerRuleEngineService.js +8 -1
  279. package/build/dist/Server/Services/DashboardOwnerRuleEngineService.js.map +1 -1
  280. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js +8 -1
  281. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js.map +1 -1
  282. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js +8 -1
  283. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js.map +1 -1
  284. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js +8 -1
  285. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js.map +1 -1
  286. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js +8 -1
  287. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js.map +1 -1
  288. package/build/dist/Server/Services/HostLabelRuleEngineService.js +8 -1
  289. package/build/dist/Server/Services/HostLabelRuleEngineService.js.map +1 -1
  290. package/build/dist/Server/Services/HostOwnerRuleEngineService.js +8 -1
  291. package/build/dist/Server/Services/HostOwnerRuleEngineService.js.map +1 -1
  292. package/build/dist/Server/Services/IncidentEpisodeLabelRuleEngineService.js +8 -1
  293. package/build/dist/Server/Services/IncidentEpisodeLabelRuleEngineService.js.map +1 -1
  294. package/build/dist/Server/Services/IncidentEpisodeOnCallRuleEngineService.js +8 -1
  295. package/build/dist/Server/Services/IncidentEpisodeOnCallRuleEngineService.js.map +1 -1
  296. package/build/dist/Server/Services/IncidentEpisodeOwnerRuleEngineService.js +8 -1
  297. package/build/dist/Server/Services/IncidentEpisodeOwnerRuleEngineService.js.map +1 -1
  298. package/build/dist/Server/Services/IncidentEpisodePrivacyRuleEngineService.js +8 -1
  299. package/build/dist/Server/Services/IncidentEpisodePrivacyRuleEngineService.js.map +1 -1
  300. package/build/dist/Server/Services/IncidentGroupingEngineService.js +8 -1
  301. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  302. package/build/dist/Server/Services/IncidentLabelRuleEngineService.js +8 -1
  303. package/build/dist/Server/Services/IncidentLabelRuleEngineService.js.map +1 -1
  304. package/build/dist/Server/Services/IncidentOnCallRuleEngineService.js +8 -1
  305. package/build/dist/Server/Services/IncidentOnCallRuleEngineService.js.map +1 -1
  306. package/build/dist/Server/Services/IncidentOwnerRuleEngineService.js +8 -1
  307. package/build/dist/Server/Services/IncidentOwnerRuleEngineService.js.map +1 -1
  308. package/build/dist/Server/Services/IncidentPrivacyRuleEngineService.js +8 -1
  309. package/build/dist/Server/Services/IncidentPrivacyRuleEngineService.js.map +1 -1
  310. package/build/dist/Server/Services/IncidentReminderRuleService.js +8 -1
  311. package/build/dist/Server/Services/IncidentReminderRuleService.js.map +1 -1
  312. package/build/dist/Server/Services/IncidentSlaRuleService.js +8 -1
  313. package/build/dist/Server/Services/IncidentSlaRuleService.js.map +1 -1
  314. package/build/dist/Server/Services/IncomingCallPolicyLabelRuleEngineService.js +8 -1
  315. package/build/dist/Server/Services/IncomingCallPolicyLabelRuleEngineService.js.map +1 -1
  316. package/build/dist/Server/Services/IncomingCallPolicyOwnerRuleEngineService.js +8 -1
  317. package/build/dist/Server/Services/IncomingCallPolicyOwnerRuleEngineService.js.map +1 -1
  318. package/build/dist/Server/Services/Index.js +2 -0
  319. package/build/dist/Server/Services/Index.js.map +1 -1
  320. package/build/dist/Server/Services/IoTFleetLabelRuleEngineService.js +8 -1
  321. package/build/dist/Server/Services/IoTFleetLabelRuleEngineService.js.map +1 -1
  322. package/build/dist/Server/Services/IoTFleetOwnerRuleEngineService.js +8 -1
  323. package/build/dist/Server/Services/IoTFleetOwnerRuleEngineService.js.map +1 -1
  324. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js +8 -1
  325. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js.map +1 -1
  326. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js +8 -1
  327. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js.map +1 -1
  328. package/build/dist/Server/Services/KubernetesResourceService.js +5 -1
  329. package/build/dist/Server/Services/KubernetesResourceService.js.map +1 -1
  330. package/build/dist/Server/Services/MonitorLabelRuleEngineService.js +8 -1
  331. package/build/dist/Server/Services/MonitorLabelRuleEngineService.js.map +1 -1
  332. package/build/dist/Server/Services/MonitorOwnerRuleEngineService.js +8 -1
  333. package/build/dist/Server/Services/MonitorOwnerRuleEngineService.js.map +1 -1
  334. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +30 -21
  335. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
  336. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js +64 -0
  337. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js.map +1 -1
  338. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +8 -1
  339. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -1
  340. package/build/dist/Server/Services/NetworkDeviceOidTemplateService.js +180 -0
  341. package/build/dist/Server/Services/NetworkDeviceOidTemplateService.js.map +1 -0
  342. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js +8 -1
  343. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js.map +1 -1
  344. package/build/dist/Server/Services/NetworkDeviceService.js +154 -1
  345. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
  346. package/build/dist/Server/Services/OnCallDutyPolicyLabelRuleEngineService.js +8 -1
  347. package/build/dist/Server/Services/OnCallDutyPolicyLabelRuleEngineService.js.map +1 -1
  348. package/build/dist/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.js +8 -1
  349. package/build/dist/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.js.map +1 -1
  350. package/build/dist/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.js +8 -1
  351. package/build/dist/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.js.map +1 -1
  352. package/build/dist/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.js +8 -1
  353. package/build/dist/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.js.map +1 -1
  354. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js +8 -1
  355. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js.map +1 -1
  356. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js +8 -1
  357. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js.map +1 -1
  358. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js +8 -1
  359. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js.map +1 -1
  360. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js +8 -1
  361. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js.map +1 -1
  362. package/build/dist/Server/Services/RumApplicationLabelRuleEngineService.js +8 -1
  363. package/build/dist/Server/Services/RumApplicationLabelRuleEngineService.js.map +1 -1
  364. package/build/dist/Server/Services/RumApplicationOwnerRuleEngineService.js +8 -1
  365. package/build/dist/Server/Services/RumApplicationOwnerRuleEngineService.js.map +1 -1
  366. package/build/dist/Server/Services/RunbookLabelRuleEngineService.js +8 -1
  367. package/build/dist/Server/Services/RunbookLabelRuleEngineService.js.map +1 -1
  368. package/build/dist/Server/Services/RunbookOwnerRuleEngineService.js +8 -1
  369. package/build/dist/Server/Services/RunbookOwnerRuleEngineService.js.map +1 -1
  370. package/build/dist/Server/Services/RunbookRuleEngineService.js +8 -1
  371. package/build/dist/Server/Services/RunbookRuleEngineService.js.map +1 -1
  372. package/build/dist/Server/Services/ScheduledMaintenanceLabelRuleEngineService.js +8 -1
  373. package/build/dist/Server/Services/ScheduledMaintenanceLabelRuleEngineService.js.map +1 -1
  374. package/build/dist/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.js +8 -1
  375. package/build/dist/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.js.map +1 -1
  376. package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js +8 -1
  377. package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js.map +1 -1
  378. package/build/dist/Server/Services/ServerlessFunctionLabelRuleEngineService.js +8 -1
  379. package/build/dist/Server/Services/ServerlessFunctionLabelRuleEngineService.js.map +1 -1
  380. package/build/dist/Server/Services/ServerlessFunctionOwnerRuleEngineService.js +8 -1
  381. package/build/dist/Server/Services/ServerlessFunctionOwnerRuleEngineService.js.map +1 -1
  382. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js +8 -1
  383. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js.map +1 -1
  384. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js +8 -1
  385. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js.map +1 -1
  386. package/build/dist/Server/Services/StatusPageLabelRuleEngineService.js +8 -1
  387. package/build/dist/Server/Services/StatusPageLabelRuleEngineService.js.map +1 -1
  388. package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js +6 -0
  389. package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js.map +1 -1
  390. package/build/dist/Server/Services/StatusPageOwnerRuleEngineService.js +8 -1
  391. package/build/dist/Server/Services/StatusPageOwnerRuleEngineService.js.map +1 -1
  392. package/build/dist/Server/Services/TelemetrySourceMapService.js +213 -19
  393. package/build/dist/Server/Services/TelemetrySourceMapService.js.map +1 -1
  394. package/build/dist/Server/Services/UserService.js +25 -0
  395. package/build/dist/Server/Services/UserService.js.map +1 -1
  396. package/build/dist/Server/Services/WorkflowLabelRuleEngineService.js +8 -1
  397. package/build/dist/Server/Services/WorkflowLabelRuleEngineService.js.map +1 -1
  398. package/build/dist/Server/Services/WorkflowOwnerRuleEngineService.js +8 -1
  399. package/build/dist/Server/Services/WorkflowOwnerRuleEngineService.js.map +1 -1
  400. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js +145 -0
  401. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js.map +1 -0
  402. package/build/dist/Server/Utils/Monitor/CapturedMetricAttributeUtil.js +201 -0
  403. package/build/dist/Server/Utils/Monitor/CapturedMetricAttributeUtil.js.map +1 -0
  404. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +19 -2
  405. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
  406. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +42 -23
  407. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
  408. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +29 -0
  409. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  410. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +11 -2
  411. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -1
  412. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +16 -1
  413. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -1
  414. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +10 -0
  415. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
  416. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +33 -0
  417. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
  418. package/build/dist/Server/Utils/Rules/RuleEngineRuleRead.js +37 -0
  419. package/build/dist/Server/Utils/Rules/RuleEngineRuleRead.js.map +1 -0
  420. package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js +12 -1
  421. package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js.map +1 -1
  422. package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js +14 -2
  423. package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js.map +1 -1
  424. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js +15 -5
  425. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js.map +1 -1
  426. package/build/dist/Server/Utils/Telemetry/StackTraceParser.js +307 -0
  427. package/build/dist/Server/Utils/Telemetry/StackTraceParser.js.map +1 -1
  428. package/build/dist/Types/Date.js +27 -0
  429. package/build/dist/Types/Date.js.map +1 -1
  430. package/build/dist/Types/Monitor/SnmpMonitor/SnmpOidListUtil.js +253 -0
  431. package/build/dist/Types/Monitor/SnmpMonitor/SnmpOidListUtil.js.map +1 -0
  432. package/build/dist/Types/Permission.js +86 -0
  433. package/build/dist/Types/Permission.js.map +1 -1
  434. package/build/dist/Types/Rum/SessionReplay.js +19 -0
  435. package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
  436. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.js +83 -0
  437. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.js.map +1 -0
  438. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.js +531 -0
  439. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.js.map +1 -0
  440. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.js +264 -0
  441. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.js.map +1 -0
  442. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.js +122 -0
  443. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.js.map +1 -0
  444. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +213 -233
  445. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  446. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +139 -152
  447. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  448. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +212 -232
  449. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  450. package/build/dist/UI/Components/Charts/Types/ChartEventKind.js +14 -0
  451. package/build/dist/UI/Components/Charts/Types/ChartEventKind.js.map +1 -0
  452. package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js +57 -28
  453. package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js.map +1 -1
  454. package/build/dist/UI/Components/Charts/Utils/XAxis.js +103 -17
  455. package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
  456. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +198 -23
  457. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  458. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js +15 -5
  459. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js.map +1 -1
  460. package/build/dist/UI/Components/Feed/FeedItem.js +4 -5
  461. package/build/dist/UI/Components/Feed/FeedItem.js.map +1 -1
  462. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -2
  463. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  464. package/build/dist/UI/Components/Header/UserProfile/UserProfile.js.map +1 -1
  465. package/build/dist/UI/Components/Image/Image.js +6 -1
  466. package/build/dist/UI/Components/Image/Image.js.map +1 -1
  467. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
  468. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
  469. package/build/dist/UI/Components/MemberRoleAssignment/MemberRoleAssignment.js +1 -2
  470. package/build/dist/UI/Components/MemberRoleAssignment/MemberRoleAssignment.js.map +1 -1
  471. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +104 -23
  472. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  473. package/build/dist/UI/Components/Table/TableHeader.js +20 -22
  474. package/build/dist/UI/Components/Table/TableHeader.js.map +1 -1
  475. package/build/dist/UI/Components/Table/TableRow.js +13 -4
  476. package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
  477. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js +153 -0
  478. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js.map +1 -0
  479. package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js.map +1 -1
  480. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js +127 -7
  481. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js.map +1 -1
  482. package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js +50 -3
  483. package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js.map +1 -1
  484. package/build/dist/Utils/NetworkDiscovery/ReverseDnsNameUtil.js +132 -0
  485. package/build/dist/Utils/NetworkDiscovery/ReverseDnsNameUtil.js.map +1 -0
  486. package/build/dist/Utils/Rules/RuleEngineLimits.js +31 -0
  487. package/build/dist/Utils/Rules/RuleEngineLimits.js.map +1 -0
  488. package/jest.config.json +1 -0
  489. package/package.json +2 -2
@@ -0,0 +1,245 @@
1
+ import { JSONObject, JSONValue } from "../../../Types/JSON";
2
+ import { AllResourceIdentityLabelKeys } from "./SeriesResourceLabels";
3
+
4
+ /*
5
+ * ---------------------------------------------------------------------------
6
+ * Attributes a monitor SCRIPT chose, on their way into ClickHouse
7
+ * ---------------------------------------------------------------------------
8
+ *
9
+ * Custom code and synthetic monitors let a user's script name its own metric
10
+ * dimensions:
11
+ *
12
+ * oneuptime.captureMetric("api.queue.depth", 12, { region: "us-east-1" })
13
+ *
14
+ * Everything else that writes a metric row picks its own attribute keys from a
15
+ * fixed vocabulary. This is the one writer where the KEY is user input, so it
16
+ * is the one writer that needs a guard, and this module is it.
17
+ *
18
+ * Two classes of key are refused.
19
+ *
20
+ * 1. RESOURCE IDENTITY. A metric row is not just a datapoint — it is a claim
21
+ * about which resource the datapoint describes. `SeriesResourceLabels`
22
+ * lists the attribute names that carry that claim (`service.name`,
23
+ * `oneuptime.host.id`, `k8s.cluster.name`, ...), and the consumers take
24
+ * them at face value.
25
+ *
26
+ * Two consequences, one immediate and one a step removed. Immediately, the
27
+ * resource detail pages scope their charts by the raw attribute rather
28
+ * than by the owning entity's id — Service > Metrics pins
29
+ * `resource.service.name = <the service's name>` — so a script stamping
30
+ * that key files its monitor's datapoints onto an unrelated Service's
31
+ * page. A step removed, ANY metric monitor grouped by one of these keys
32
+ * turns it into a series label, and from there `SeriesResourceLinker`
33
+ * attaches the named resource to every alert and incident that series
34
+ * opens, `AlertOwnerRuleEngineService` pages that resource's owners
35
+ * through owner inheritance, and `MonitorMaintenanceSuppression` silences
36
+ * the series for the duration of a maintenance window on it. (A custom
37
+ * code monitor's OWN alerts carry no series labels, so that second chain
38
+ * needs a metric monitor over the `custom.monitor.*` series — which is an
39
+ * ordinary thing for the same user to build.)
40
+ *
41
+ * The blocklist is DERIVED from `AllResourceIdentityLabelKeys` so a key
42
+ * added to the read side cannot be forgotten here.
43
+ *
44
+ * The whole `oneuptime.` and `resource.` namespaces go with them.
45
+ * `oneuptime.*` is what ingest stamps (ids, names, labels, custom fields);
46
+ * `resource.*` is the ClickHouse spelling of an OTel resource attribute,
47
+ * and a monitor metric has no OTel resource — so a script writing there is
48
+ * always impersonating something. Blocking the namespaces rather than the
49
+ * individual keys is what makes this hold for stamps added later.
50
+ *
51
+ * 2. PROTOTYPE-WALKING SEGMENTS. Dotted keys are read back as nested paths
52
+ * (`{{host.name}}` in an alert template walks `host` then `name`), so a
53
+ * segment of `__proto__` / `constructor` / `prototype` aims that walk at
54
+ * `Object.prototype`. `MonitorTemplateUtil` refuses to walk them, and this
55
+ * keeps them out of the store in the first place.
56
+ *
57
+ * Values are coerced rather than filtered. The sandbox hands over whatever
58
+ * JSON the script passed, and the ClickHouse column is Map(String, String), so
59
+ * a number or a boolean is a perfectly good dimension once stringified — which
60
+ * is what the synthetic runtime already does in-sandbox. The custom code path
61
+ * used to drop them on the floor server-side instead, so
62
+ * `captureMetric("queue.depth", n, { shard: 3 })` silently recorded no `shard`
63
+ * at all. Anything with no useful string form (objects, arrays, null, NaN,
64
+ * Infinity) is still dropped.
65
+ *
66
+ * The caps match the synthetic runtime's in-sandbox caps exactly. They are
67
+ * re-applied here because a probe is a separately deployed process: the server
68
+ * must not take the probe's word for how much a script was allowed to write.
69
+ */
70
+
71
+ /** Most attributes kept on one captured metric. Matches the synthetic runtime. */
72
+ export const MaxCapturedMetricAttributes: number = 50;
73
+
74
+ /** Longest attribute key kept. Matches the synthetic runtime. */
75
+ export const MaxCapturedMetricAttributeKeyLength: number = 200;
76
+
77
+ /** Longest attribute value kept. Matches the synthetic runtime. */
78
+ export const MaxCapturedMetricAttributeValueLength: number = 1000;
79
+
80
+ /*
81
+ * The monitor's own identity, stamped by `buildMonitorMetricAttributes` and by
82
+ * the custom-metric block itself. A script that could overwrite these would be
83
+ * able to file its datapoints under a different monitor, or hide them from the
84
+ * Custom Metrics tab.
85
+ */
86
+ const MonitorIdentityAttributeKeys: ReadonlyArray<string> = [
87
+ "monitorId",
88
+ "projectId",
89
+ "monitorName",
90
+ "probeName",
91
+ "probeId",
92
+ "isCustomMetric",
93
+ ];
94
+
95
+ /*
96
+ * Namespace prefixes reserved for OneUptime's own stamps. `oneuptime.` covers
97
+ * every id / name / label / customField stamp; `resource.` covers the
98
+ * ClickHouse spelling of OTel resource attributes.
99
+ */
100
+ const ReservedAttributeKeyPrefixes: ReadonlyArray<string> = [
101
+ "oneuptime.",
102
+ "resource.",
103
+ ];
104
+
105
+ /*
106
+ * Path segments that make a dotted key resolve to the object prototype when a
107
+ * consumer walks it as a nested property path.
108
+ */
109
+ const PrototypeWalkingKeySegments: ReadonlySet<string> = new Set<string>([
110
+ "__proto__",
111
+ "constructor",
112
+ "prototype",
113
+ ]);
114
+
115
+ const ReservedAttributeKeys: ReadonlySet<string> = new Set<string>([
116
+ ...MonitorIdentityAttributeKeys,
117
+ ...AllResourceIdentityLabelKeys,
118
+ ]);
119
+
120
+ /** One captured metric's attributes after the guard has run. */
121
+ export interface SanitizedCapturedMetricAttributes {
122
+ /** The attributes that survived, ready to merge into the metric row. */
123
+ attributes: JSONObject;
124
+ /**
125
+ * Keys refused because they are reserved. Surfaced so the caller can tell
126
+ * the user why an attribute they wrote is not on their chart — a silent drop
127
+ * is indistinguishable from a bug in their script.
128
+ */
129
+ droppedReservedKeys: Array<string>;
130
+ }
131
+
132
+ export default class CapturedMetricAttributeUtil {
133
+ /**
134
+ * True when a monitor script must not be allowed to write this attribute
135
+ * key, either because OneUptime owns its meaning or because reading it back
136
+ * as a nested path would walk the object prototype.
137
+ *
138
+ * Compared case-sensitively, exactly as the read side compares
139
+ * (`SeriesResourceLabels.collectLabelValues` does a plain lookup), so this
140
+ * refuses precisely the spellings that would actually be honoured.
141
+ */
142
+ public static isReservedAttributeKey(key: string): boolean {
143
+ if (ReservedAttributeKeys.has(key)) {
144
+ return true;
145
+ }
146
+
147
+ for (const prefix of ReservedAttributeKeyPrefixes) {
148
+ if (key.startsWith(prefix)) {
149
+ return true;
150
+ }
151
+ }
152
+
153
+ for (const segment of key.split(".")) {
154
+ if (PrototypeWalkingKeySegments.has(segment)) {
155
+ return true;
156
+ }
157
+ }
158
+
159
+ return false;
160
+ }
161
+
162
+ /**
163
+ * The attributes of one captured metric, filtered, coerced and capped.
164
+ *
165
+ * First key wins on a post-trim collision, so the result does not depend on
166
+ * how the script happened to order two keys that differ only in whitespace.
167
+ */
168
+ public static sanitize(
169
+ attributes: JSONObject | undefined | null,
170
+ ): SanitizedCapturedMetricAttributes {
171
+ const sanitized: JSONObject = {};
172
+ const droppedReservedKeys: Array<string> = [];
173
+
174
+ if (!attributes || typeof attributes !== "object") {
175
+ return { attributes: sanitized, droppedReservedKeys };
176
+ }
177
+
178
+ let kept: number = 0;
179
+
180
+ for (const rawKey of Object.keys(attributes)) {
181
+ if (kept >= MaxCapturedMetricAttributes) {
182
+ break;
183
+ }
184
+
185
+ /*
186
+ * An empty or whitespace-only key would store as an attribute no filter
187
+ * could ever select — the same thing MetricResourceAttributeUtil refuses
188
+ * to form for labels and custom fields.
189
+ */
190
+ const key: string = rawKey
191
+ .trim()
192
+ .substring(0, MaxCapturedMetricAttributeKeyLength);
193
+
194
+ if (key.length === 0) {
195
+ continue;
196
+ }
197
+
198
+ if (this.isReservedAttributeKey(key)) {
199
+ if (!droppedReservedKeys.includes(key)) {
200
+ droppedReservedKeys.push(key);
201
+ }
202
+ continue;
203
+ }
204
+
205
+ if (sanitized[key] !== undefined) {
206
+ continue;
207
+ }
208
+
209
+ const value: string | null = this.toAttributeValue(
210
+ attributes[rawKey] as JSONValue,
211
+ );
212
+
213
+ if (value === null) {
214
+ continue;
215
+ }
216
+
217
+ sanitized[key] = value;
218
+ kept++;
219
+ }
220
+
221
+ return { attributes: sanitized, droppedReservedKeys };
222
+ }
223
+
224
+ /*
225
+ * One attribute value as the string the Map(String, String) column stores.
226
+ * Returns null for anything that carries no usable dimension — an object, an
227
+ * array, null/undefined, or a non-finite number, which would record as the
228
+ * text "NaN" and chart as a category.
229
+ */
230
+ private static toAttributeValue(value: JSONValue | undefined): string | null {
231
+ if (typeof value === "string") {
232
+ return value.substring(0, MaxCapturedMetricAttributeValueLength);
233
+ }
234
+
235
+ if (typeof value === "number") {
236
+ return isFinite(value) ? String(value) : null;
237
+ }
238
+
239
+ if (typeof value === "boolean") {
240
+ return value ? "true" : "false";
241
+ }
242
+
243
+ return null;
244
+ }
245
+ }
@@ -15,6 +15,7 @@ import SnmpInterface from "../../../../Types/Monitor/SnmpMonitor/SnmpInterface";
15
15
  import SnmpMonitorResponse, {
16
16
  SnmpOidResponse,
17
17
  } from "../../../../Types/Monitor/SnmpMonitor/SnmpMonitorResponse";
18
+ import SnmpOidListUtil from "../../../../Types/Monitor/SnmpMonitor/SnmpOidListUtil";
18
19
  import SnmpTrap from "../../../../Types/Monitor/SnmpMonitor/SnmpTrap";
19
20
  import ProbeMonitorResponse from "../../../../Types/Probe/ProbeMonitorResponse";
20
21
  import EvaluateOverTime, { OverTimeCriteriaValue } from "./EvaluateOverTime";
@@ -453,9 +454,18 @@ export default class SnmpMonitorCriteria {
453
454
  return null;
454
455
  }
455
456
 
457
+ /*
458
+ * Compare canonical forms. ".1.3.6.1" and "1.3.6.1" are the same
459
+ * object, operators type both, and net-snmp always answers with the
460
+ * dotless form — so a stored leading dot used to make the criterion
461
+ * silently un-matchable forever. Newly reachable now that the OID
462
+ * picker actually writes a value.
463
+ */
464
+ const normalizedOid: string = SnmpOidListUtil.normalizeOid(oid);
465
+
456
466
  const oidResponse: SnmpOidResponse | undefined =
457
467
  snmpResponse?.oidResponses?.find((response: SnmpOidResponse) => {
458
- return response.oid === oid;
468
+ return SnmpOidListUtil.normalizeOid(response.oid) === normalizedOid;
459
469
  });
460
470
 
461
471
  const exists: boolean = Boolean(
@@ -487,9 +497,18 @@ export default class SnmpMonitorCriteria {
487
497
  return null;
488
498
  }
489
499
 
500
+ /*
501
+ * Compare canonical forms. ".1.3.6.1" and "1.3.6.1" are the same
502
+ * object, operators type both, and net-snmp always answers with the
503
+ * dotless form — so a stored leading dot used to make the criterion
504
+ * silently un-matchable forever. Newly reachable now that the OID
505
+ * picker actually writes a value.
506
+ */
507
+ const normalizedOid: string = SnmpOidListUtil.normalizeOid(oid);
508
+
490
509
  const oidResponse: SnmpOidResponse | undefined =
491
510
  snmpResponse?.oidResponses?.find((response: SnmpOidResponse) => {
492
- return response.oid === oid;
511
+ return SnmpOidListUtil.normalizeOid(response.oid) === normalizedOid;
493
512
  });
494
513
 
495
514
  if (!oidResponse || oidResponse.value === null) {
@@ -2,6 +2,9 @@ import logger from "../Logger";
2
2
  import CaptureSpan from "../Telemetry/CaptureSpan";
3
3
  import TelemetryUtil from "../Telemetry/Telemetry";
4
4
  import MetricResourceAttributeUtil from "../../../Utils/Metrics/MetricResourceAttributeUtil";
5
+ import CapturedMetricAttributeUtil, {
6
+ SanitizedCapturedMetricAttributes,
7
+ } from "./CapturedMetricAttributeUtil";
5
8
  import MetricService from "../../Services/MetricService";
6
9
  import GlobalConfigService from "../../Services/GlobalConfigService";
7
10
  import GlobalConfig from "../../../Models/DatabaseModels/GlobalConfig";
@@ -21,6 +24,10 @@ import MonitorMetricType from "../../../Types/Monitor/MonitorMetricType";
21
24
  import PingMonitorResponse from "../../../Types/Monitor/PingMonitor/PingMonitorResponse";
22
25
  import PortMonitorTimings from "../../../Types/Monitor/PortMonitor/PortMonitorTimings";
23
26
  import SnmpInterface from "../../../Types/Monitor/SnmpMonitor/SnmpInterface";
27
+ import {
28
+ MAX_INTERFACE_METRIC_SERIES,
29
+ MAX_OID_METRIC_SERIES,
30
+ } from "../../../Types/Monitor/SnmpMonitor/SnmpOidListUtil";
24
31
  import { SnmpOidResponse } from "../../../Types/Monitor/SnmpMonitor/SnmpMonitorResponse";
25
32
  import ProbeMonitorResponse from "../../../Types/Probe/ProbeMonitorResponse";
26
33
  import ServerMonitorResponse from "../../../Types/Monitor/ServerMonitor/ServerMonitorResponse";
@@ -245,9 +252,14 @@ export default class MonitorMetricUtil {
245
252
  * same monitor, so there is nothing per-metric to decide, and one pass is
246
253
  * far easier to keep correct than thirty call sites.
247
254
  *
248
- * Resource attributes are merged LAST. Custom code monitors let a user
249
- * supply their own attribute names, and those must not be able to shadow the
250
- * oneuptime.* namespace.
255
+ * Resource attributes are merged LAST, so a resource attribute wins any
256
+ * collision. That merge is NOT what keeps the oneuptime.* namespace safe
257
+ * from a monitor script, though — it only ever writes the handful of keys
258
+ * this monitor's own labels and custom fields produce, and it does not run
259
+ * at all for a monitor that has neither. Script-supplied attribute keys are
260
+ * refused at the point they are read instead, by
261
+ * CapturedMetricAttributeUtil, which rejects the whole oneuptime.* and
262
+ * resource.* namespaces rather than the keys that happen to collide today.
251
263
  */
252
264
  public static applyResourceAttributesToMetricRows(data: {
253
265
  metricRows: Array<JSONObject>;
@@ -956,7 +968,7 @@ export default class MonitorMetricUtil {
956
968
  */
957
969
  const interfacesToEmit: Array<SnmpInterface> = snmpInterfaces.slice(
958
970
  0,
959
- 200,
971
+ MAX_INTERFACE_METRIC_SERIES,
960
972
  );
961
973
 
962
974
  if (interfacesToEmit.length < snmpInterfaces.length) {
@@ -1042,10 +1054,17 @@ export default class MonitorMetricUtil {
1042
1054
  ).snmpResponse?.oidResponses;
1043
1055
 
1044
1056
  if (snmpOidResponses && snmpOidResponses.length > 0) {
1045
- // Same unbounded-write cap rationale as the interface block above.
1057
+ /*
1058
+ * Same unbounded-write cap rationale as the interface block above.
1059
+ *
1060
+ * Shared with NetworkDeviceMetricUtil rather than repeated as a
1061
+ * literal: this is the monitor-scoped copy of the same emit, and the
1062
+ * two caps have to move together or a device charts a different number
1063
+ * of OIDs than the monitors watching it.
1064
+ */
1046
1065
  const oidResponsesToEmit: Array<SnmpOidResponse> = snmpOidResponses.slice(
1047
1066
  0,
1048
- 50,
1067
+ MAX_OID_METRIC_SERIES,
1049
1068
  );
1050
1069
 
1051
1070
  if (oidResponsesToEmit.length < snmpOidResponses.length) {
@@ -1327,13 +1346,13 @@ export default class MonitorMetricUtil {
1327
1346
  );
1328
1347
  }
1329
1348
 
1330
- const reservedAttributeKeys: Set<string> = new Set([
1331
- "monitorId",
1332
- "projectId",
1333
- "monitorName",
1334
- "probeName",
1335
- "probeId",
1336
- ]);
1349
+ /*
1350
+ * Keys a script tried to write but is not allowed to own, collected
1351
+ * across the whole check so the operator gets one line naming them
1352
+ * rather than one per datapoint. Without it, an attribute that silently
1353
+ * never reaches a chart is indistinguishable from a bug in the script.
1354
+ */
1355
+ const droppedReservedAttributeKeys: Set<string> = new Set<string>();
1337
1356
 
1338
1357
  for (const customMetric of allCustomMetrics) {
1339
1358
  if (
@@ -1347,7 +1366,20 @@ export default class MonitorMetricUtil {
1347
1366
 
1348
1367
  const prefixedName: string = `custom.monitor.${customMetric.name}`;
1349
1368
 
1369
+ /*
1370
+ * Script-supplied attributes first, OneUptime's own stamps after, so
1371
+ * the stamps are written onto a set the guard has already cleared of
1372
+ * every key OneUptime owns.
1373
+ */
1374
+ const sanitized: SanitizedCapturedMetricAttributes =
1375
+ CapturedMetricAttributeUtil.sanitize(customMetric.attributes);
1376
+
1377
+ for (const droppedKey of sanitized.droppedReservedKeys) {
1378
+ droppedReservedAttributeKeys.add(droppedKey);
1379
+ }
1380
+
1350
1381
  const extraAttributes: JSONObject = {
1382
+ ...sanitized.attributes,
1351
1383
  isCustomMetric: "true",
1352
1384
  };
1353
1385
 
@@ -1357,14 +1389,6 @@ export default class MonitorMetricUtil {
1357
1389
  ).probeId.toString();
1358
1390
  }
1359
1391
 
1360
- if (customMetric.attributes) {
1361
- for (const [key, val] of Object.entries(customMetric.attributes)) {
1362
- if (typeof val === "string" && !reservedAttributeKeys.has(key)) {
1363
- extraAttributes[key] = val;
1364
- }
1365
- }
1366
- }
1367
-
1368
1392
  const attributes: JSONObject = this.buildMonitorMetricAttributes({
1369
1393
  monitorId: data.monitorId,
1370
1394
  projectId: data.projectId,
@@ -1392,6 +1416,16 @@ export default class MonitorMetricUtil {
1392
1416
  metricNameServiceNameMap[prefixedName] = metricType;
1393
1417
  }
1394
1418
 
1419
+ if (droppedReservedAttributeKeys.size > 0) {
1420
+ logger.warn(
1421
+ `${data.monitorId.toString()} - Custom metric attributes dropped, these keys are reserved by OneUptime: ${Array.from(
1422
+ droppedReservedAttributeKeys,
1423
+ )
1424
+ .sort()
1425
+ .join(", ")}`,
1426
+ );
1427
+ }
1428
+
1395
1429
  this.applyResourceAttributesToMetricRows({
1396
1430
  metricRows: metricRows,
1397
1431
  labels: data.monitorLabels,
@@ -33,6 +33,18 @@ import VMUtil from "../VM/VMAPI";
33
33
  import DataToProcess from "./DataToProcess";
34
34
  import logger from "../Logger";
35
35
 
36
+ /*
37
+ * Path segments that resolve to the object prototype when a dotted series
38
+ * label key is walked as a nested property path. See the fold in
39
+ * `getStorageMap`, and the matching write-side guard in
40
+ * `CapturedMetricAttributeUtil`.
41
+ */
42
+ const PrototypeWalkingKeySegments: ReadonlySet<string> = new Set<string>([
43
+ "__proto__",
44
+ "constructor",
45
+ "prototype",
46
+ ]);
47
+
36
48
  /**
37
49
  * Utility for building template variable storage map and processing dynamic placeholders
38
50
  * shared between Incident and Alert auto-creation.
@@ -534,6 +546,26 @@ export default class MonitorTemplateUtil {
534
546
  continue;
535
547
  }
536
548
  const parts: Array<string> = key.split(".");
549
+ /*
550
+ * Series label keys are attacker-adjacent: they are whatever
551
+ * attribute names the emitting telemetry chose, and a monitor
552
+ * script picks them outright via oneuptime.captureMetric(). Walking
553
+ * `__proto__` here would hand the loop Object.prototype — it is
554
+ * truthy, an object, and not an Array, so the reset below would be
555
+ * skipped and the final assignment would land on the prototype
556
+ * itself, polluting every object in the shared Workers process that
557
+ * renders every project's alert templates. `constructor` and
558
+ * `prototype` are refused with it so no spelling of the same walk
559
+ * survives. The whole label is skipped rather than partially
560
+ * folded, and it is still reachable in full under `seriesLabels`.
561
+ */
562
+ if (
563
+ parts.some((part: string) => {
564
+ return PrototypeWalkingKeySegments.has(part);
565
+ })
566
+ ) {
567
+ continue;
568
+ }
537
569
  let cursor: JSONObject = storageMap;
538
570
  for (let i: number = 0; i < parts.length - 1; i++) {
539
571
  const part: string = parts[i]!;
@@ -1,6 +1,10 @@
1
1
  import logger from "../Logger";
2
2
  import TelemetryUtil from "../Telemetry/Telemetry";
3
3
  import MetricService from "../../Services/MetricService";
4
+ import {
5
+ MAX_INTERFACE_METRIC_SERIES,
6
+ MAX_OID_METRIC_SERIES,
7
+ } from "../../../Types/Monitor/SnmpMonitor/SnmpOidListUtil";
4
8
  import GlobalConfigService from "../../Services/GlobalConfigService";
5
9
  import GlobalConfig from "../../../Models/DatabaseModels/GlobalConfig";
6
10
  import { MetricPointType } from "../../../Models/AnalyticsModels/Metric";
@@ -31,9 +35,18 @@ export default class NetworkDeviceMetricUtil {
31
35
  /*
32
36
  * Caps mirror MonitorMetricUtil: bound what a single walk can write —
33
37
  * large routers can expose thousands of subinterfaces.
38
+ *
39
+ * They now live in one shared constant instead of a named const here and a
40
+ * bare literal in MonitorMetricUtil. The OID cap was 50 while nothing
41
+ * capped how many OIDs a device could be CONFIGURED with, so a longer list
42
+ * silently charted its first 50 in jsonb array order. It is now equal to
43
+ * the per-device configuration ceiling, which is what makes "everything you
44
+ * configure is charted" true rather than aspirational — and both writers
45
+ * have to move together or the raise is only half applied.
34
46
  */
35
- private static readonly maxInterfaceSeries: number = 200;
36
- private static readonly maxOidSeries: number = 50;
47
+ private static readonly maxInterfaceSeries: number =
48
+ MAX_INTERFACE_METRIC_SERIES;
49
+ private static readonly maxOidSeries: number = MAX_OID_METRIC_SERIES;
37
50
 
38
51
  // Retention handling mirrors MonitorMetricUtil (shared GlobalConfig knob).
39
52
  private static readonly DEFAULT_RETENTION_DAYS: number = 30;
@@ -133,7 +133,24 @@ export default class NetworkDeviceWalkUtil {
133
133
  id: device.id,
134
134
  data: {
135
135
  lastWalkLog: {
136
- snmpResponse: JSON.parse(JSON.stringify(data.snmpResponse)),
136
+ /*
137
+ * ONLY the interfaces, not the whole response.
138
+ *
139
+ * This column exists for exactly one reader —
140
+ * SnmpInterfaceRateUtil, which computes counter deltas from
141
+ * `snmpResponse.interfaces` and touches nothing else. Every other
142
+ * field was dead weight in a jsonb column rewritten on every poll
143
+ * of every device, and `oidResponses` is the one that grows: OID
144
+ * Collection Templates make long health-OID lists normal, so
145
+ * leaving them here would add tens of KB per device per poll of
146
+ * pure TOAST churn on the product's hottest table, for data
147
+ * nothing ever reads back.
148
+ */
149
+ snmpResponse: {
150
+ interfaces: JSON.parse(
151
+ JSON.stringify(data.snmpResponse.interfaces),
152
+ ),
153
+ },
137
154
  monitoredAt: OneUptimeDate.getCurrentDate(),
138
155
  },
139
156
  } as any,
@@ -60,6 +60,7 @@ export default class NetworkInventoryUtil {
60
60
  // For the vendor-template auto-apply below.
61
61
  autoApplyVendorHealthTemplate: true,
62
62
  snmpOids: true,
63
+ oidTemplateId: true,
63
64
  },
64
65
  props: {
65
66
  isRoot: true,
@@ -169,9 +170,18 @@ export default class NetworkInventoryUtil {
169
170
  * leaves it alone (including after the operator empties it on purpose
170
171
  * AND turns the toggle off; with the toggle still on, an emptied list
171
172
  * re-seeds next poll, which is what "auto-apply" says on the tin).
173
+ *
174
+ * A device linked to an OID Collection Template is exempt outright.
175
+ * Its effective list already comes from the template, and its own
176
+ * snmpOids column is by design the small set of device-specific
177
+ * ADDITIONS — usually empty, which is exactly the condition below.
178
+ * Without this guard the first poll would write a vendor copy on top
179
+ * of the template and the device would silently collect the union of
180
+ * two sources, only one of which the operator can see or edit.
172
181
  */
173
182
  if (
174
183
  ownedDevice.autoApplyVendorHealthTemplate &&
184
+ !ownedDevice.oidTemplateId &&
175
185
  (ownedDevice.snmpOids || []).length === 0 &&
176
186
  systemInfo?.sysObjectId
177
187
  ) {
@@ -160,6 +160,40 @@ export const ServiceNameLabelKeys: ReadonlyArray<string> = [
160
160
  "service.name",
161
161
  ];
162
162
 
163
+ /*
164
+ * Every label key above, in one list: the complete set of attribute
165
+ * names that make a series claim to belong to a specific Host / cluster
166
+ * / Service.
167
+ *
168
+ * `extractResourceRefs` below is the READ side of these keys. Writers
169
+ * that accept attribute names from a user — the custom code and
170
+ * synthetic monitors, whose scripts choose their own
171
+ * `oneuptime.captureMetric()` attribute keys — need the same list to
172
+ * decide what a script must NOT be allowed to stamp, because a series
173
+ * label saying `service.name = payments-api` is taken at face value
174
+ * downstream: alerts and incidents get linked to that Service, its
175
+ * owners are paged through owner inheritance, and a maintenance window
176
+ * on it silences the series. Deriving the write-side guard from this
177
+ * array is what stops the two sides from drifting apart the way the
178
+ * alert and incident linkers once did.
179
+ */
180
+ export const AllResourceIdentityLabelKeys: ReadonlyArray<string> = [
181
+ ...HostIdLabelKeys,
182
+ ...HostNameLabelKeys,
183
+ ...DockerHostIdLabelKeys,
184
+ ...DockerHostNameLabelKeys,
185
+ ...PodmanHostIdLabelKeys,
186
+ ...PodmanHostNameLabelKeys,
187
+ ...DockerSwarmClusterNameLabelKeys,
188
+ ...KubernetesClusterIdLabelKeys,
189
+ ...KubernetesClusterNameLabelKeys,
190
+ ...ProxmoxClusterNameLabelKeys,
191
+ ...CephClusterNameLabelKeys,
192
+ ...IoTFleetNameLabelKeys,
193
+ ...ServiceIdLabelKeys,
194
+ ...ServiceNameLabelKeys,
195
+ ];
196
+
163
197
  /*
164
198
  * The identifiers carried by one series, split by resource type and by
165
199
  * id-vs-name. Ids are OneUptime database ids (the `oneuptime.*.id`
@@ -0,0 +1,48 @@
1
+ import { MAX_RULES_EVALUATED_PER_PROJECT } from "../../../Utils/Rules/RuleEngineLimits";
2
+ import ObjectID from "../../../Types/ObjectID";
3
+ import logger, { LogAttributes } from "../Logger";
4
+
5
+ /*
6
+ * The one thing that makes MAX_RULES_EVALUATED_PER_PROJECT a ceiling rather
7
+ * than a cliff.
8
+ *
9
+ * A rule engine reads a project's enabled rules as `limit: <cap>, skip: 0`
10
+ * and evaluates what comes back. There is no second page, so a project with
11
+ * more rules than the cap has the remainder evaluated by nobody — and the
12
+ * read cannot tell the difference between "that is all of them" and "that is
13
+ * as many as I was allowed to ask for".
14
+ *
15
+ * That gap is the whole of OneUptime/oneuptime#3506. The cap was 100, a
16
+ * project had 1,243 rules, and the 1,143 that never ran produced no log, no
17
+ * error, no counter and no span attribute. It surfaced as a customer noticing
18
+ * that most of a 1,000-monitor import had come out bare, a day later.
19
+ *
20
+ * Raising the cap to 10,000 moves that threshold somewhere projects are very
21
+ * unlikely to reach, but it does not change the shape of the failure: at
22
+ * 10,001 rules the oldest rule goes quiet exactly as before. So the read now
23
+ * says so. Crossing the ceiling is an operator-visible error, not silence.
24
+ *
25
+ * Deliberately not an exception. A project that walks past the ceiling still
26
+ * wants the 10,000 rules that did match to be applied; refusing to label
27
+ * anything would turn a partial evaluation into no evaluation.
28
+ */
29
+ export default function logIfRuleReadWasTruncated(data: {
30
+ /** The rule model being read, e.g. "MonitorLabelRule". Names the config to go and look at. */
31
+ ruleKind: string;
32
+ projectId: ObjectID | undefined;
33
+ /** How many rows the read returned. */
34
+ rulesRead: number;
35
+ }): boolean {
36
+ if (data.rulesRead < MAX_RULES_EVALUATED_PER_PROJECT) {
37
+ return false;
38
+ }
39
+
40
+ logger.error(
41
+ `${data.ruleKind}: this project has at least ${MAX_RULES_EVALUATED_PER_PROJECT} enabled rules, which is the most one evaluation reads. Rules beyond that are NOT being evaluated, and resources they would match will silently go without. Reduce or consolidate the project's ${data.ruleKind} rows.`,
42
+ {
43
+ projectId: data.projectId?.toString(),
44
+ } as LogAttributes,
45
+ );
46
+
47
+ return true;
48
+ }