@oneuptime/common 11.6.1 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/Index.ts +4 -0
- package/Models/AnalyticsModels/KubernetesCostAllocation.ts +842 -0
- package/Models/AnalyticsModels/NetworkFlow.ts +54 -0
- package/Models/AnalyticsModels/SloHistory.ts +243 -0
- package/Models/DatabaseModels/Index.ts +20 -0
- package/Models/DatabaseModels/NetworkDevice.ts +453 -6
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +7 -6
- package/Models/DatabaseModels/NetworkEndpoint.ts +753 -0
- package/Models/DatabaseModels/NetworkSite.ts +1155 -0
- package/Models/DatabaseModels/NetworkSiteAssignmentRule.ts +517 -0
- package/Models/DatabaseModels/NetworkSiteLink.ts +611 -0
- package/Models/DatabaseModels/NetworkSiteStatusTimeline.ts +520 -0
- package/Models/DatabaseModels/NetworkSiteType.ts +499 -0
- package/Models/DatabaseModels/ServiceLevelObjective.ts +1115 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.ts +762 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.ts +444 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.ts +443 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.ts +359 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.ts +48 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.ts +65 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.ts +88 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.ts +391 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.ts +30 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +12 -0
- package/Server/Services/AnalyticsDatabaseService.ts +25 -9
- package/Server/Services/Index.ts +24 -0
- package/Server/Services/KubernetesCostAllocationService.ts +14 -0
- package/Server/Services/MetricService.ts +21 -2
- package/Server/Services/MonitorService.ts +22 -0
- package/Server/Services/NetworkDeviceService.ts +438 -2
- package/Server/Services/NetworkEndpointService.ts +414 -0
- package/Server/Services/NetworkSiteAssignmentRuleService.ts +98 -0
- package/Server/Services/NetworkSiteLinkService.ts +10 -0
- package/Server/Services/NetworkSiteService.ts +1254 -0
- package/Server/Services/NetworkSiteStatusTimelineService.ts +10 -0
- package/Server/Services/NetworkSiteTypeService.ts +10 -0
- package/Server/Services/ProjectService.ts +122 -2
- package/Server/Services/ServiceLevelObjectiveBurnRateRuleService.ts +457 -0
- package/Server/Services/ServiceLevelObjectiveOwnerTeamService.ts +10 -0
- package/Server/Services/ServiceLevelObjectiveOwnerUserService.ts +10 -0
- package/Server/Services/ServiceLevelObjectiveService.ts +685 -0
- package/Server/Services/SloHistoryService.ts +101 -0
- package/Server/Services/UserNotificationSettingService.ts +37 -0
- package/Server/Types/AnalyticsDatabase/AggregateBy.ts +9 -0
- package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +15 -0
- package/Server/Utils/AnalyticsDatabase/Statement.ts +39 -3
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +87 -48
- package/Server/Utils/Memory.ts +9 -1
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +190 -12
- package/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
- package/Server/Utils/Monitor/DnsResolutionCache.ts +129 -0
- package/Server/Utils/Monitor/MonitorResource.ts +4 -30
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +214 -39
- package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +343 -0
- package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +251 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +176 -142
- package/Server/Utils/Monitor/OuiLookupUtil.ts +49 -0
- package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +17 -13
- package/Server/Utils/WhatsAppTemplateUtil.ts +7 -3
- package/Tests/Models/AnalyticsModels/KubernetesCostAllocation.test.ts +135 -0
- package/Tests/Models/NetworkSiteHierarchy.test.ts +134 -0
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +239 -0
- package/Tests/Server/Services/KubernetesCostAllocationAggregate.test.ts +338 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +142 -0
- package/Tests/Server/Services/NetworkDeviceSiteAssignment.test.ts +484 -0
- package/Tests/Server/Services/NetworkEndpointServiceUpsert.test.ts +686 -0
- package/Tests/Server/Services/NetworkSiteAssignmentRuleService.test.ts +185 -0
- package/Tests/Server/Services/NetworkSiteService.test.ts +1354 -0
- package/Tests/Server/Services/ServiceLevelObjectiveBurnRateRuleService.test.ts +1313 -0
- package/Tests/Server/Services/ServiceLevelObjectiveService.test.ts +1988 -0
- package/Tests/Server/Utils/AnalyticsDatabase/Statement.test.ts +22 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +404 -0
- package/Tests/Server/Utils/Encryption.test.ts +70 -0
- package/Tests/Server/Utils/FileAttachmentMarkdownUtil.test.ts +225 -0
- package/Tests/Server/Utils/JsonWebToken.test.ts +175 -0
- package/Tests/Server/Utils/LocalFile.test.ts +258 -0
- package/Tests/Server/Utils/Memory.test.ts +213 -0
- package/Tests/Server/Utils/Monitor/Criteria/LogMonitorCriteria.test.ts +30 -0
- package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +385 -0
- package/Tests/Server/Utils/Monitor/DnsResolutionCache.test.ts +194 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +155 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +600 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +151 -124
- package/Tests/Server/Utils/Monitor/SnmpInterfaceRateUtil.test.ts +496 -0
- package/Tests/Server/Utils/MonitorCriteriaDataExtractor.test.ts +175 -0
- package/Tests/Server/Utils/MonitorCriteriaMessageFormatter.test.ts +282 -0
- package/Tests/Server/Utils/OuiLookupUtil.test.ts +59 -0
- package/Tests/Server/Utils/SeriesResourceLabels.test.ts +117 -0
- package/Tests/Server/Utils/StackTraceParser.test.ts +370 -0
- package/Tests/Server/Utils/Stream.test.ts +87 -0
- package/Tests/Server/Utils/ValidateGlobalProviderProjectTeams.test.ts +221 -0
- package/Tests/Server/Utils/WhatsAppTemplateUtil.test.ts +199 -0
- package/Tests/Types/Database/CompareOperatorWireSerialization.test.ts +33 -0
- package/Tests/Types/Email.test.ts +198 -0
- package/Tests/Types/Kubernetes/KubernetesObjectParser.test.ts +177 -0
- package/Tests/Types/Log/LogQueryToFilter.test.ts +111 -0
- package/Tests/Types/Monitor/MonitorCriteria.test.ts +155 -0
- package/Tests/Types/Monitor/MonitorCriteriaInstance.test.ts +465 -0
- package/Tests/Types/Monitor/MonitorStep.test.ts +183 -0
- package/Tests/Types/Monitor/MonitorStepNetworkDeviceMonitor.test.ts +141 -1
- package/Tests/Types/Monitor/MonitorSteps.test.ts +183 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +59 -1
- package/Tests/Types/Monitor/NetworkDeviceAlertPack.test.ts +97 -0
- package/Tests/Types/Monitor/SnmpEndpointDiscovery.test.ts +151 -0
- package/Tests/Types/Monitor/SnmpVendorTemplate.test.ts +110 -6
- package/Tests/Types/NetworkSite/DefaultNetworkSiteType.test.ts +129 -0
- package/Tests/Types/SerializableObjectDictionary.test.ts +166 -0
- package/Tests/Types/Time/RangeStartAndEndDateTime.test.ts +98 -0
- package/Tests/Types/WebsiteRequest.test.ts +230 -0
- package/Tests/UI/Components/EntityFilterRoundTrip.test.tsx +103 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableUrlState.test.tsx +612 -0
- package/Tests/UI/Components/ModelTable/FilterDataToQuery.test.ts +275 -0
- package/Tests/UI/Utils/LogExport.test.ts +159 -0
- package/Tests/UI/Utils/Navigation.test.ts +183 -0
- package/Tests/UI/Utils/TableFilterUrlState.test.ts +539 -0
- package/Tests/UI/Utils/TableViewUrlState.test.ts +272 -0
- package/Tests/Utils/Base64.test.ts +51 -0
- package/Tests/Utils/Boolean.test.ts +76 -0
- package/Tests/Utils/Crypto.test.ts +48 -0
- package/Tests/Utils/Dashboard/DashboardSloComponent.test.ts +259 -0
- package/Tests/Utils/Dashboard/ModelQueryVariableInterpolation.test.ts +162 -0
- package/Tests/Utils/Enum.test.ts +54 -0
- package/Tests/Utils/IpCanonicalUtil.test.ts +85 -0
- package/Tests/Utils/Memory.test.ts +44 -0
- package/Tests/Utils/Metrics/MetricSeriesFingerprint.test.ts +160 -0
- package/Tests/Utils/Monitor/EndpointAttachmentUtil.test.ts +836 -0
- package/Tests/Utils/Monitor/MonitorMetricType.test.ts +218 -0
- package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +447 -0
- package/Tests/Utils/NetworkSite/CidrMatchUtil.test.ts +440 -0
- package/Tests/Utils/NetworkSite/MaterializedPathUtil.test.ts +205 -0
- package/Tests/Utils/NetworkSite/SiteStatusRollupUtil.test.ts +221 -0
- package/Tests/Utils/NetworkSite/SiteUptimeUtil.test.ts +283 -0
- package/Tests/Utils/ObjectUtil.test.ts +30 -0
- package/Tests/Utils/Slo/SloBurnRateRuleState.test.ts +124 -0
- package/Tests/Utils/Slo/SloDuration.test.ts +148 -0
- package/Tests/Utils/Slo/SloHealth.test.ts +334 -0
- package/Tests/Utils/Slo/SloStatusColor.test.ts +89 -0
- package/Tests/Utils/Slo/SloUtil.test.ts +1980 -0
- package/Tests/Utils/Slo/SloWidgetFormat.test.ts +605 -0
- package/Tests/Utils/TechStack.test.ts +50 -0
- package/Tests/Utils/Traces/CriticalPath.test.ts +178 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +10 -0
- package/Types/BaseDatabase/EqualTo.ts +9 -1
- package/Types/BaseDatabase/EqualToOrNull.ts +9 -1
- package/Types/BaseDatabase/NotEqual.ts +9 -1
- package/Types/Dashboard/DashboardComponentType.ts +1 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardSloComponent.ts +42 -0
- package/Types/Dashboard/DashboardTemplates.ts +214 -0
- package/Types/Email/EmailTemplateType.ts +2 -0
- package/Types/Kubernetes/KubernetesCostIngest.ts +79 -0
- package/Types/Monitor/CriteriaFilter.ts +9 -0
- package/Types/Monitor/MonitorStep.ts +5 -8
- package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +27 -5
- package/Types/Monitor/MonitorType.ts +15 -5
- package/Types/Monitor/SnmpMonitor/ArpEntry.ts +14 -0
- package/Types/Monitor/SnmpMonitor/FdbEntry.ts +18 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +10 -3
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +31 -5
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +12 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +231 -3
- package/Types/NetworkSite/DefaultNetworkSiteType.ts +20 -0
- package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
- package/Types/Permission.ts +449 -0
- package/Types/ServiceLevelObjective/SliType.ts +6 -0
- package/Types/ServiceLevelObjective/SloMultiMonitorMode.ts +6 -0
- package/Types/ServiceLevelObjective/SloStatus.ts +9 -0
- package/Types/ServiceLevelObjective/SloWindowType.ts +6 -0
- package/Types/Telemetry/ServiceType.ts +1 -0
- package/UI/Components/Filters/EntityFilter.tsx +16 -0
- package/UI/Components/Filters/FilterViewer.tsx +22 -5
- package/UI/Components/List/List.tsx +8 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +309 -106
- package/UI/Components/ModelTable/FilterDataToQuery.ts +172 -0
- package/UI/Components/Navbar/NavBar.tsx +16 -2
- package/UI/Components/Navbar/NavBarMenuModal.tsx +3 -3
- package/UI/Utils/Navigation.ts +10 -0
- package/UI/Utils/TableFilterUrlState.ts +204 -17
- package/UI/Utils/TableViewUrlState.ts +165 -0
- package/Utils/Dashboard/Components/DashboardSloComponent.ts +114 -0
- package/Utils/Dashboard/Components/Index.ts +7 -0
- package/Utils/IpCanonicalUtil.ts +134 -0
- package/Utils/Monitor/EndpointAttachmentUtil.ts +508 -0
- package/Utils/Monitor/NetworkTopologyUtil.ts +157 -5
- package/Utils/NetworkSite/CidrMatchUtil.ts +296 -0
- package/Utils/NetworkSite/MaterializedPathUtil.ts +115 -0
- package/Utils/NetworkSite/SiteStatusRollupUtil.ts +97 -0
- package/Utils/NetworkSite/SiteUptimeUtil.ts +111 -0
- package/Utils/Slo/SloBurnRateRuleState.ts +91 -0
- package/Utils/Slo/SloDuration.ts +165 -0
- package/Utils/Slo/SloEvaluation.ts +22 -0
- package/Utils/Slo/SloHealth.ts +302 -0
- package/Utils/Slo/SloStatusColor.ts +54 -0
- package/Utils/Slo/SloUtil.ts +637 -0
- package/Utils/Slo/SloWidgetFormat.ts +383 -0
- package/build/dist/Models/AnalyticsModels/Index.js +4 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js +713 -0
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js +44 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/SloHistory.js +218 -0
- package/build/dist/Models/AnalyticsModels/SloHistory.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +20 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +458 -6
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +0 -6
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkEndpoint.js +779 -0
- package/build/dist/Models/DatabaseModels/NetworkEndpoint.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSite.js +1180 -0
- package/build/dist/Models/DatabaseModels/NetworkSite.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js +534 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteLink.js +629 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteLink.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js +538 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js +522 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js +1134 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +769 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js +460 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js +459 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js +130 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js +31 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js +36 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js +49 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js +140 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js +21 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +23 -6
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +24 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/KubernetesCostAllocationService.js +12 -0
- package/build/dist/Server/Services/KubernetesCostAllocationService.js.map +1 -0
- package/build/dist/Server/Services/MetricService.js +21 -3
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +19 -0
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +351 -1
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/NetworkEndpointService.js +319 -0
- package/build/dist/Server/Services/NetworkEndpointService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js +90 -0
- package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteLinkService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteLinkService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteService.js +1038 -0
- package/build/dist/Server/Services/NetworkSiteService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteTypeService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteTypeService.js.map +1 -0
- package/build/dist/Server/Services/ProjectService.js +98 -2
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js +358 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js +9 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveService.js +588 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveService.js.map +1 -0
- package/build/dist/Server/Services/SloHistoryService.js +77 -0
- package/build/dist/Server/Services/SloHistoryService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js +20 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +9 -0
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +15 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js +31 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +76 -48
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Memory.js +9 -1
- package/build/dist/Server/Utils/Memory.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +132 -10
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
- package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js +77 -0
- package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +21 -41
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +152 -40
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +262 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +201 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +152 -120
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js +44 -0
- package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +10 -10
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +5 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +10 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/BaseDatabase/EqualTo.js +9 -1
- package/build/dist/Types/BaseDatabase/EqualTo.js.map +1 -1
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js +9 -1
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js.map +1 -1
- package/build/dist/Types/BaseDatabase/NotEqual.js +9 -1
- package/build/dist/Types/BaseDatabase/NotEqual.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js +23 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +205 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Kubernetes/KubernetesCostIngest.js +21 -0
- package/build/dist/Types/Kubernetes/KubernetesCostIngest.js.map +1 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js +1 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +5 -5
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +8 -0
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +15 -5
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +9 -3
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +217 -3
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -1
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js +21 -0
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js.map +1 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/Permission.js +409 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/ServiceLevelObjective/SliType.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SliType.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloStatus.js +10 -0
- package/build/dist/Types/ServiceLevelObjective/SloStatus.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloWindowType.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SloWindowType.js.map +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/UI/Components/Filters/EntityFilter.js +15 -0
- package/build/dist/UI/Components/Filters/EntityFilter.js.map +1 -1
- package/build/dist/UI/Components/Filters/FilterViewer.js +19 -4
- package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
- package/build/dist/UI/Components/List/List.js +1 -1
- package/build/dist/UI/Components/List/List.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +235 -89
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js +96 -0
- package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js.map +1 -0
- package/build/dist/UI/Components/Navbar/NavBar.js +14 -2
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +3 -2
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +9 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/TableFilterUrlState.js +159 -15
- package/build/dist/UI/Utils/TableFilterUrlState.js.map +1 -1
- package/build/dist/UI/Utils/TableViewUrlState.js +103 -0
- package/build/dist/UI/Utils/TableViewUrlState.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js +93 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/IpCanonicalUtil.js +110 -0
- package/build/dist/Utils/IpCanonicalUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js +311 -0
- package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +98 -5
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkSite/CidrMatchUtil.js +222 -0
- package/build/dist/Utils/NetworkSite/CidrMatchUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js +89 -0
- package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js +60 -0
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js +76 -0
- package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js.map +1 -0
- package/build/dist/Utils/Slo/SloBurnRateRuleState.js +35 -0
- package/build/dist/Utils/Slo/SloBurnRateRuleState.js.map +1 -0
- package/build/dist/Utils/Slo/SloDuration.js +87 -0
- package/build/dist/Utils/Slo/SloDuration.js.map +1 -0
- package/build/dist/Utils/Slo/SloEvaluation.js +21 -0
- package/build/dist/Utils/Slo/SloEvaluation.js.map +1 -0
- package/build/dist/Utils/Slo/SloHealth.js +179 -0
- package/build/dist/Utils/Slo/SloHealth.js.map +1 -0
- package/build/dist/Utils/Slo/SloStatusColor.js +18 -0
- package/build/dist/Utils/Slo/SloStatusColor.js.map +1 -0
- package/build/dist/Utils/Slo/SloUtil.js +393 -0
- package/build/dist/Utils/Slo/SloUtil.js.map +1 -0
- package/build/dist/Utils/Slo/SloWidgetFormat.js +174 -0
- package/build/dist/Utils/Slo/SloWidgetFormat.js.map +1 -0
- package/package.json +2 -2
- package/Types/Dashboard/DashboardComponents/Index.ts +0 -7
- package/build/dist/Types/Dashboard/DashboardComponents/Index.js +0 -8
- package/build/dist/Types/Dashboard/DashboardComponents/Index.js.map +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Worst-of health rollup for a NetworkSite's device subtree.
|
|
3
|
+
*
|
|
4
|
+
* Each device contributes one MonitorStatus candidate and the highest
|
|
5
|
+
* priority number wins - MonitorStatus.priority is HIGHER = WORSE per the
|
|
6
|
+
* seeded rows (Operational 1 ... Offline 3), regardless of what the column
|
|
7
|
+
* docstring claims. Pure so the whole decision matrix is unit-testable.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// One device's health inputs, denormalized by the rollup engine.
|
|
11
|
+
export interface DeviceHealthState {
|
|
12
|
+
/*
|
|
13
|
+
* The MonitorStatus stamped by the monitor bridge (string form). When set
|
|
14
|
+
* together with its priority, it is the device's authoritative status.
|
|
15
|
+
*/
|
|
16
|
+
currentMonitorStatusId?: string | null | undefined;
|
|
17
|
+
// Priority of that status row; missing when the row no longer exists.
|
|
18
|
+
monitorStatusPriority?: number | null | undefined;
|
|
19
|
+
// Last SNMP contact; drives the freshness fallback for unmonitored devices.
|
|
20
|
+
lastSeenAt?: Date | null | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// A project MonitorStatus row a freshness fallback can resolve to.
|
|
24
|
+
export interface RollupStatusOption {
|
|
25
|
+
monitorStatusId: string;
|
|
26
|
+
priority: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class SiteStatusRollupUtil {
|
|
30
|
+
// A device is considered alive when SNMP data arrived within this window.
|
|
31
|
+
public static readonly DEFAULT_FRESHNESS_WINDOW_IN_MINUTES: number = 15;
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* Returns the winning MonitorStatus id for a set of devices, or null when
|
|
35
|
+
* no device contributes anything (empty subtree, or freshness fallbacks
|
|
36
|
+
* unavailable because the project has no operational/offline rows) - the
|
|
37
|
+
* caller treats null as "leave the site's status untouched".
|
|
38
|
+
*
|
|
39
|
+
* Per device: a stamped monitor status (with a known priority) wins;
|
|
40
|
+
* otherwise lastSeenAt within the freshness window maps to the project's
|
|
41
|
+
* isOperationalState row and anything staler (or never seen) maps to the
|
|
42
|
+
* isOfflineState row. Priority ties keep the first contributor (stable).
|
|
43
|
+
*/
|
|
44
|
+
public static worstStatus(data: {
|
|
45
|
+
deviceStates: Array<DeviceHealthState>;
|
|
46
|
+
operationalStatus?: RollupStatusOption | null | undefined;
|
|
47
|
+
offlineStatus?: RollupStatusOption | null | undefined;
|
|
48
|
+
now?: Date | undefined;
|
|
49
|
+
freshnessWindowInMinutes?: number | undefined;
|
|
50
|
+
}): string | null {
|
|
51
|
+
const now: Date = data.now || new Date();
|
|
52
|
+
const windowInMinutes: number =
|
|
53
|
+
data.freshnessWindowInMinutes ??
|
|
54
|
+
SiteStatusRollupUtil.DEFAULT_FRESHNESS_WINDOW_IN_MINUTES;
|
|
55
|
+
const windowInMs: number = windowInMinutes * 60 * 1000;
|
|
56
|
+
|
|
57
|
+
let winner: RollupStatusOption | null = null;
|
|
58
|
+
|
|
59
|
+
for (const device of data.deviceStates) {
|
|
60
|
+
let candidate: RollupStatusOption | null = null;
|
|
61
|
+
|
|
62
|
+
if (
|
|
63
|
+
device.currentMonitorStatusId &&
|
|
64
|
+
typeof device.monitorStatusPriority === "number" &&
|
|
65
|
+
Number.isFinite(device.monitorStatusPriority)
|
|
66
|
+
) {
|
|
67
|
+
candidate = {
|
|
68
|
+
monitorStatusId: device.currentMonitorStatusId,
|
|
69
|
+
priority: device.monitorStatusPriority,
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
const lastSeenAtInMs: number | null = device.lastSeenAt
|
|
73
|
+
? new Date(device.lastSeenAt).getTime()
|
|
74
|
+
: null;
|
|
75
|
+
const isFresh: boolean =
|
|
76
|
+
lastSeenAtInMs !== null &&
|
|
77
|
+
now.getTime() - lastSeenAtInMs <= windowInMs;
|
|
78
|
+
|
|
79
|
+
candidate = isFresh
|
|
80
|
+
? data.operationalStatus || null
|
|
81
|
+
: data.offlineStatus || null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!candidate) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!winner || candidate.priority > winner.priority) {
|
|
89
|
+
winner = candidate;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return winner ? winner.monitorStatusId : null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default SiteStatusRollupUtil;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Uptime percentage over a NetworkSiteStatusTimeline window.
|
|
3
|
+
*
|
|
4
|
+
* Every row whose status is not flagged operational counts as downtime.
|
|
5
|
+
* Rows are clamped to the window, an open row (endsAt null) extends to the
|
|
6
|
+
* window end, and overlapping down rows are merged so no second is counted
|
|
7
|
+
* twice. Time not covered by any row counts as up - the timeline only gains
|
|
8
|
+
* rows once a rollup has run, and absence of evidence is not an outage.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// One timeline row, denormalized with its status row's priority and flag.
|
|
12
|
+
export interface SiteStatusTimelineRow {
|
|
13
|
+
monitorStatusId: string;
|
|
14
|
+
startsAt: Date;
|
|
15
|
+
endsAt: Date | null;
|
|
16
|
+
priority: number;
|
|
17
|
+
isOperationalState: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface TimeInterval {
|
|
21
|
+
startInMs: number;
|
|
22
|
+
endInMs: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class SiteUptimeUtil {
|
|
26
|
+
/*
|
|
27
|
+
* Percent of [windowStart, windowEnd) the site was NOT in a
|
|
28
|
+
* non-operational status. Returns 100 for an empty or inverted window.
|
|
29
|
+
* The result is exact (not rounded) and clamped to 0..100.
|
|
30
|
+
*/
|
|
31
|
+
public static calculateUptimePercent(
|
|
32
|
+
rows: Array<SiteStatusTimelineRow>,
|
|
33
|
+
windowStart: Date,
|
|
34
|
+
windowEnd: Date,
|
|
35
|
+
): number {
|
|
36
|
+
const windowStartInMs: number = windowStart.getTime();
|
|
37
|
+
const windowEndInMs: number = windowEnd.getTime();
|
|
38
|
+
const windowInMs: number = windowEndInMs - windowStartInMs;
|
|
39
|
+
|
|
40
|
+
if (!Number.isFinite(windowInMs) || windowInMs <= 0) {
|
|
41
|
+
return 100;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const downIntervals: Array<TimeInterval> = [];
|
|
45
|
+
|
|
46
|
+
for (const row of rows) {
|
|
47
|
+
if (row.isOperationalState) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const rowStartInMs: number = new Date(row.startsAt).getTime();
|
|
52
|
+
const rowEndInMs: number = row.endsAt
|
|
53
|
+
? new Date(row.endsAt).getTime()
|
|
54
|
+
: windowEndInMs;
|
|
55
|
+
|
|
56
|
+
if (!Number.isFinite(rowStartInMs) || !Number.isFinite(rowEndInMs)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const clampedStartInMs: number = Math.max(rowStartInMs, windowStartInMs);
|
|
61
|
+
const clampedEndInMs: number = Math.min(rowEndInMs, windowEndInMs);
|
|
62
|
+
|
|
63
|
+
if (clampedEndInMs <= clampedStartInMs) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
downIntervals.push({
|
|
68
|
+
startInMs: clampedStartInMs,
|
|
69
|
+
endInMs: clampedEndInMs,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const downInMs: number = SiteUptimeUtil.totalCoveredMs(downIntervals);
|
|
74
|
+
|
|
75
|
+
const uptimePercent: number = ((windowInMs - downInMs) / windowInMs) * 100;
|
|
76
|
+
return Math.min(100, Math.max(0, uptimePercent));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Sum of interval lengths after merging overlaps.
|
|
80
|
+
private static totalCoveredMs(intervals: Array<TimeInterval>): number {
|
|
81
|
+
if (intervals.length === 0) {
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const sorted: Array<TimeInterval> = [...intervals].sort(
|
|
86
|
+
(a: TimeInterval, b: TimeInterval) => {
|
|
87
|
+
return a.startInMs - b.startInMs;
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
let totalInMs: number = 0;
|
|
92
|
+
let currentStartInMs: number = sorted[0]!.startInMs;
|
|
93
|
+
let currentEndInMs: number = sorted[0]!.endInMs;
|
|
94
|
+
|
|
95
|
+
for (let i: number = 1; i < sorted.length; i++) {
|
|
96
|
+
const interval: TimeInterval = sorted[i]!;
|
|
97
|
+
if (interval.startInMs <= currentEndInMs) {
|
|
98
|
+
currentEndInMs = Math.max(currentEndInMs, interval.endInMs);
|
|
99
|
+
} else {
|
|
100
|
+
totalInMs += currentEndInMs - currentStartInMs;
|
|
101
|
+
currentStartInMs = interval.startInMs;
|
|
102
|
+
currentEndInMs = interval.endInMs;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
totalInMs += currentEndInMs - currentStartInMs;
|
|
107
|
+
return totalInMs;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default SiteUptimeUtil;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a burn rate rule currently has an alert open.
|
|
3
|
+
*
|
|
4
|
+
* `lastAlertCreatedAt` / `lastAlertResolvedAt` are stamped by the
|
|
5
|
+
* evaluation worker every time it fires or resolves a rule's alert, and
|
|
6
|
+
* together they are the only record of the rule's lifecycle — but nothing
|
|
7
|
+
* read them outside the worker, so the Burn Rate Rules table could not
|
|
8
|
+
* tell the user whether a rule was paging someone right now, had ever
|
|
9
|
+
* fired, or had never once triggered.
|
|
10
|
+
*
|
|
11
|
+
* The predicate is the worker's own (EvaluateSlos.evaluateBurnRateRule's
|
|
12
|
+
* `hasUnresolvedFiringState`), lifted here so the table and the worker can
|
|
13
|
+
* never disagree about what "firing" means.
|
|
14
|
+
*
|
|
15
|
+
* Kept free of React and of the database model so both can import it and
|
|
16
|
+
* so the ordering edges are unit-testable without a DOM.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import SloStatus from "../../Types/ServiceLevelObjective/SloStatus";
|
|
20
|
+
|
|
21
|
+
export interface SloBurnRateRuleAlertState {
|
|
22
|
+
lastAlertCreatedAt?: Date | undefined | null;
|
|
23
|
+
lastAlertResolvedAt?: Date | undefined | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* True when the rule has fired and that alert has not been resolved
|
|
28
|
+
* since.
|
|
29
|
+
*
|
|
30
|
+
* A resolve stamped at exactly the same instant as the fire counts as
|
|
31
|
+
* resolved: the worker writes the resolve strictly after the fire, so an
|
|
32
|
+
* equal pair can only be the same lifecycle, and treating it as firing
|
|
33
|
+
* would leave a red "Firing" pill on a rule with nothing open.
|
|
34
|
+
*/
|
|
35
|
+
export type IsBurnRateRuleFiringFunction = (
|
|
36
|
+
rule: SloBurnRateRuleAlertState,
|
|
37
|
+
) => boolean;
|
|
38
|
+
|
|
39
|
+
export const isBurnRateRuleFiring: IsBurnRateRuleFiringFunction = (
|
|
40
|
+
rule: SloBurnRateRuleAlertState,
|
|
41
|
+
): boolean => {
|
|
42
|
+
if (!rule.lastAlertCreatedAt) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!rule.lastAlertResolvedAt) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return rule.lastAlertResolvedAt.getTime() < rule.lastAlertCreatedAt.getTime();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Whether the OWNING SLO is in a state where a burn rate rule could be
|
|
55
|
+
* firing at all.
|
|
56
|
+
*
|
|
57
|
+
* `isBurnRateRuleFiring` alone is not enough to render a live "Firing"
|
|
58
|
+
* badge. When an SLO is disabled, or the worker's guards move it to
|
|
59
|
+
* Misconfigured or Paused, the SLO-level resolve paths
|
|
60
|
+
* (ServiceLevelObjectiveService.resolveOpenBurnRateAlertsForSlo and the
|
|
61
|
+
* worker's setGuardStatusAndResolveOpenAlerts) close every open alert but
|
|
62
|
+
* deliberately do NOT stamp `lastAlertResolvedAt` — that column drives a
|
|
63
|
+
* live rule's re-fire suppression, and this is a state change of the SLO
|
|
64
|
+
* rather than a burn rate that recovered. The rule's own columns are
|
|
65
|
+
* therefore left mid-lifecycle, and a UI reading them alone would show a
|
|
66
|
+
* red "Firing" pill on a rule with nothing open, forever.
|
|
67
|
+
*
|
|
68
|
+
* Pairing the two predicates keeps the badge honest without touching the
|
|
69
|
+
* suppression semantics the worker depends on.
|
|
70
|
+
*/
|
|
71
|
+
export interface SloBurnRateFiringContext {
|
|
72
|
+
isEnabled?: boolean | undefined | null;
|
|
73
|
+
sloStatus?: SloStatus | undefined | null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type CanSloFireBurnRateAlertsFunction = (
|
|
77
|
+
slo: SloBurnRateFiringContext,
|
|
78
|
+
) => boolean;
|
|
79
|
+
|
|
80
|
+
export const canSloFireBurnRateAlerts: CanSloFireBurnRateAlertsFunction = (
|
|
81
|
+
slo: SloBurnRateFiringContext,
|
|
82
|
+
): boolean => {
|
|
83
|
+
if (slo.isEnabled === false) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
slo.sloStatus !== SloStatus.Misconfigured &&
|
|
89
|
+
slo.sloStatus !== SloStatus.Paused
|
|
90
|
+
);
|
|
91
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact duration rendering for error budgets.
|
|
3
|
+
*
|
|
4
|
+
* Error budgets span four orders of magnitude — a 99.99% / 7-day SLO gets
|
|
5
|
+
* 60 seconds, a 99% / 90-day SLO gets 21.6 hours — so the "minutes only"
|
|
6
|
+
* rendering the SLO pages started with reads badly at both ends: a
|
|
7
|
+
* one-minute budget shows as "1 min", and a 90-day budget shows as
|
|
8
|
+
* "1296 min of 1296 min". The docs quote budgets the way an SRE says them
|
|
9
|
+
* out loud ("43m 12s", "2h 9m"), and this is the helper that produces
|
|
10
|
+
* exactly that.
|
|
11
|
+
*
|
|
12
|
+
* Kept free of React (and of the database models) so the SLO pages, the
|
|
13
|
+
* dashboard SLO widget and any future status-page surface can all share
|
|
14
|
+
* one rendering, and so every rounding edge is unit-testable without a
|
|
15
|
+
* DOM.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** U+2212 MINUS SIGN — reads as a minus rather than a hyphen at tile sizes. */
|
|
19
|
+
const MINUS_SIGN: string = "−";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Seconds per unit, largest first. Only the two most significant non-zero
|
|
23
|
+
* units are rendered: "2d 5h" is what an on-call engineer needs, "2d 5h
|
|
24
|
+
* 13m 7s" is noise, and truncating rather than rounding up keeps the
|
|
25
|
+
* remaining budget from ever reading larger than it is.
|
|
26
|
+
*/
|
|
27
|
+
const UNITS: Array<{ suffix: string; seconds: number }> = [
|
|
28
|
+
{ suffix: "d", seconds: 86400 },
|
|
29
|
+
{ suffix: "h", seconds: 3600 },
|
|
30
|
+
{ suffix: "m", seconds: 60 },
|
|
31
|
+
{ suffix: "s", seconds: 1 },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const MAX_UNITS_SHOWN: number = 2;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* `null` for anything that is not a real, finite number. The
|
|
38
|
+
* worker-owned budget columns are NULL until the SLO is first evaluated,
|
|
39
|
+
* and a Postgres decimal can arrive as a string over JSON, so the guard
|
|
40
|
+
* has to reject non-numbers rather than coerce them.
|
|
41
|
+
*/
|
|
42
|
+
type ToFiniteNumberFunction = (
|
|
43
|
+
value: number | undefined | null,
|
|
44
|
+
) => number | null;
|
|
45
|
+
|
|
46
|
+
const toFiniteNumber: ToFiniteNumberFunction = (
|
|
47
|
+
value: number | undefined | null,
|
|
48
|
+
): number | null => {
|
|
49
|
+
if (typeof value !== "number" || !isFinite(value)) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return value;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* An unsigned duration as "2d 5h" / "43m 12s" / "45s". Fractional seconds
|
|
58
|
+
* are floored, so a 59.9-second budget renders "59s" rather than rounding
|
|
59
|
+
* up to a minute the SLO does not actually have.
|
|
60
|
+
*
|
|
61
|
+
* A duration that floors to zero renders "0s" — a real, sayable state —
|
|
62
|
+
* instead of an empty string.
|
|
63
|
+
*/
|
|
64
|
+
export type FormatDurationCompactFunction = (seconds: number) => string;
|
|
65
|
+
|
|
66
|
+
export const formatDurationCompact: FormatDurationCompactFunction = (
|
|
67
|
+
seconds: number,
|
|
68
|
+
): string => {
|
|
69
|
+
let remainingSeconds: number = Math.floor(Math.abs(seconds));
|
|
70
|
+
|
|
71
|
+
const parts: Array<string> = [];
|
|
72
|
+
|
|
73
|
+
for (const unit of UNITS) {
|
|
74
|
+
if (parts.length >= MAX_UNITS_SHOWN) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const count: number = Math.floor(remainingSeconds / unit.seconds);
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* Skip leading zero units ("0d 5h"), but once a larger unit has been
|
|
82
|
+
* emitted a zero is still skipped rather than padded — "2d" is
|
|
83
|
+
* correct for exactly 48 hours, "2d 0h" is not how anyone says it.
|
|
84
|
+
*/
|
|
85
|
+
if (count <= 0) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
parts.push(`${count}${unit.suffix}`);
|
|
90
|
+
remainingSeconds -= count * unit.seconds;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (parts.length === 0) {
|
|
94
|
+
return "0s";
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return parts.join(" ");
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* `errorBudgetRemainingSeconds` is SIGNED: negative means the budget is
|
|
102
|
+
* overspent, and that overage is the single most useful number during a
|
|
103
|
+
* bad month. Render it plainly rather than clamping to zero, which would
|
|
104
|
+
* hide a breach.
|
|
105
|
+
*
|
|
106
|
+
* Returns `null` (not a placeholder string) when the SLO has not been
|
|
107
|
+
* evaluated, so callers decide how to phrase "no data yet" in their own
|
|
108
|
+
* context.
|
|
109
|
+
*/
|
|
110
|
+
export type FormatErrorBudgetRemainingFunction = (
|
|
111
|
+
seconds: number | undefined | null,
|
|
112
|
+
) => string | null;
|
|
113
|
+
|
|
114
|
+
export const formatErrorBudgetRemaining: FormatErrorBudgetRemainingFunction = (
|
|
115
|
+
seconds: number | undefined | null,
|
|
116
|
+
): string | null => {
|
|
117
|
+
const numericSeconds: number | null = toFiniteNumber(seconds);
|
|
118
|
+
|
|
119
|
+
if (numericSeconds === null) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (numericSeconds < 0) {
|
|
124
|
+
return `${MINUS_SIGN}${formatDurationCompact(numericSeconds)} over budget`;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return `${formatDurationCompact(numericSeconds)} left`;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* "12m 30s left of 43m 12s" — the phrasing the error-budget docs use.
|
|
132
|
+
* Falls back to the bare remaining string when the total is not known
|
|
133
|
+
* (the two columns are written together by the worker, but a partially
|
|
134
|
+
* evaluated row must not render "of null").
|
|
135
|
+
*/
|
|
136
|
+
export type FormatErrorBudgetRemainingOfTotalFunction = (data: {
|
|
137
|
+
remainingSeconds: number | undefined | null;
|
|
138
|
+
totalSeconds: number | undefined | null;
|
|
139
|
+
}) => string | null;
|
|
140
|
+
|
|
141
|
+
export const formatErrorBudgetRemainingOfTotal: FormatErrorBudgetRemainingOfTotalFunction =
|
|
142
|
+
(data: {
|
|
143
|
+
remainingSeconds: number | undefined | null;
|
|
144
|
+
totalSeconds: number | undefined | null;
|
|
145
|
+
}): string | null => {
|
|
146
|
+
const remainingText: string | null = formatErrorBudgetRemaining(
|
|
147
|
+
data.remainingSeconds,
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
if (remainingText === null) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const totalSeconds: number | null = toFiniteNumber(data.totalSeconds);
|
|
155
|
+
|
|
156
|
+
/*
|
|
157
|
+
* A zero total is a real state for a brand-new SLO (no elapsed window
|
|
158
|
+
* yet). "of 0s" adds nothing, so drop the suffix rather than print it.
|
|
159
|
+
*/
|
|
160
|
+
if (totalSeconds === null || totalSeconds <= 0) {
|
|
161
|
+
return remainingText;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return `${remainingText} of ${formatDurationCompact(totalSeconds)}`;
|
|
165
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cadence constants shared by the SLO evaluation worker and every UI
|
|
3
|
+
* surface that describes what the worker produced.
|
|
4
|
+
*
|
|
5
|
+
* These numbers were previously duplicated as prose: the worker owned
|
|
6
|
+
* them, and the dashboard said "evaluated every few minutes" and "1×
|
|
7
|
+
* spends the budget exactly over the window" without ever naming the
|
|
8
|
+
* lookback the headline burn rate is actually measured over. A reader who
|
|
9
|
+
* compared the tile against a burn rate rule had no way to know they were
|
|
10
|
+
* measuring different spans. Naming them once here keeps the copy and the
|
|
11
|
+
* computation from drifting.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** How often a due SLO is re-evaluated, and how far ahead the worker schedules the next run. */
|
|
15
|
+
export const SLO_EVALUATION_CADENCE_MINUTES: number = 5;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Lookback for the "current burn rate" column shown on the SLO overview
|
|
19
|
+
* and the dashboard SLO widget. Deliberately equal to the default
|
|
20
|
+
* fast-burn rule's long window, so the tile and that rule move together.
|
|
21
|
+
*/
|
|
22
|
+
export const SLO_CURRENT_BURN_RATE_WINDOW_MINUTES: number = 60;
|