@oneuptime/common 11.4.0 → 11.5.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/DatabaseModels/AIRun.ts +50 -0
- package/Models/DatabaseModels/AlertSeverity.ts +6 -0
- package/Models/DatabaseModels/IncidentSeverity.ts +6 -0
- package/Models/DatabaseModels/Index.ts +16 -0
- package/Models/DatabaseModels/IoTDeviceCredential.ts +471 -0
- package/Models/DatabaseModels/LlmLog.ts +56 -0
- package/Models/DatabaseModels/LlmProvider.ts +33 -0
- package/Models/DatabaseModels/NetworkDevice.ts +1385 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +717 -0
- package/Models/DatabaseModels/NetworkDeviceLabelRule.ts +514 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerRule.ts +596 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerTeam.ts +487 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerUser.ts +486 -0
- package/Models/DatabaseModels/NetworkInterface.ts +563 -0
- package/Models/DatabaseModels/Project.ts +145 -0
- package/Models/DatabaseModels/TelemetryEntityRelationship.ts +54 -0
- package/Server/API/AIAgentTaskAPI.ts +10 -24
- package/Server/API/AIInvestigationAPI.ts +131 -63
- package/Server/API/AlertAPI.ts +5 -0
- package/Server/API/IncidentAPI.ts +10 -0
- package/Server/API/IncidentEpisodeAPI.ts +5 -0
- package/Server/API/LlmProviderAPI.ts +4 -0
- package/Server/API/ScheduledMaintenanceAPI.ts +5 -0
- package/Server/API/TelemetryAPI.ts +4 -3
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.ts +105 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.ts +15 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.ts +192 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.ts +37 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.ts +79 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.ts +49 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +24 -0
- package/Server/Services/AIAgentTaskService.ts +62 -0
- package/Server/Services/AIRunService.ts +58 -0
- package/Server/Services/AIService.ts +101 -0
- package/Server/Services/AnalyticsDatabaseService.ts +27 -0
- package/Server/Services/IncidentService.ts +14 -41
- package/Server/Services/Index.ts +14 -0
- package/Server/Services/IoTDeviceCredentialService.ts +351 -0
- package/Server/Services/IoTDeviceService.ts +64 -21
- package/Server/Services/LlmLogService.ts +26 -0
- package/Server/Services/LlmProviderService.ts +3 -0
- package/Server/Services/LogAggregationService.ts +29 -11
- package/Server/Services/MetricService.ts +603 -13
- package/Server/Services/MonitorService.ts +4 -1
- package/Server/Services/NetworkDeviceDiscoveryScanService.ts +10 -0
- package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +204 -0
- package/Server/Services/NetworkDeviceLabelRuleService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerRuleEngineService.ts +222 -0
- package/Server/Services/NetworkDeviceOwnerRuleService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerTeamService.ts +10 -0
- package/Server/Services/NetworkDeviceOwnerUserService.ts +10 -0
- package/Server/Services/NetworkDeviceService.ts +50 -0
- package/Server/Services/NetworkInterfaceService.ts +10 -0
- package/Server/Services/TelemetryEntityRelationshipService.ts +23 -0
- package/Server/Services/TelemetryEntityService.ts +72 -2
- package/Server/Utils/AI/Sentinel/AlertInvestigationRunner.ts +244 -12
- package/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.ts +92 -19
- package/Server/Utils/AI/Sentinel/InvestigationQueue.ts +493 -0
- package/Server/Utils/AI/Sentinel/README.md +10 -0
- package/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.ts +88 -68
- package/Server/Utils/AI/Toolbox/Index.ts +2 -1
- package/Server/Utils/AI/Toolbox/MetricTools.ts +391 -0
- package/Server/Utils/LLM/LLMService.ts +21 -0
- package/Server/Utils/Monitor/Criteria/APIRequestCriteria.ts +44 -0
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +170 -2
- package/Server/Utils/Monitor/IoTDeviceAbsenceSeries.ts +101 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +1 -1
- package/Server/Utils/Monitor/MonitorIncident.ts +19 -3
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +195 -2
- package/Server/Utils/Monitor/MonitorResource.ts +77 -21
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +1 -1
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +201 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +215 -0
- package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +169 -0
- package/Tests/Server/Services/AIAgentTaskServiceClaim.test.ts +146 -0
- package/Tests/Server/Services/AIServiceDailyBudget.test.ts +173 -0
- package/Tests/Server/Services/IncidentInternalNoteAnnouncement.test.ts +97 -0
- package/Tests/Server/Services/IoTDeviceService.test.ts +54 -0
- package/Tests/Server/Services/LogAggregationService.test.ts +22 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +194 -0
- package/Tests/Server/Utils/AI/BaselineAnomalyTool.test.ts +253 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +44 -0
- package/Tests/Server/Utils/AI/SentinelAlertGating.test.ts +360 -0
- package/Tests/Server/Utils/AI/SentinelInvestigationQueue.test.ts +295 -0
- package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +59 -0
- package/Tests/Server/Utils/Monitor/IoTDeviceAbsenceSeries.test.ts +113 -0
- package/Tests/Server/Utils/Monitor/PerSeriesRecoveryResolution.test.ts +198 -0
- package/Tests/Types/AI/AIAgentTaskStatus.test.ts +86 -0
- package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +127 -0
- package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.test.ts +152 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +1 -1
- package/Tests/Types/Trace/TraceRecordingRuleDefinition.test.ts +308 -0
- package/Tests/UI/Components/Dropdown.test.tsx +17 -0
- package/Tests/UI/Components/EntityDropdown.test.tsx +130 -0
- package/Tests/UI/Components/Modal.test.tsx +144 -2
- package/Tests/UI/Components/TelemetrySearchBar.test.tsx +90 -0
- package/Tests/UI/Utils/Theme.test.ts +161 -0
- package/Tests/Utils/Monitor/LatencyMatrixUtil.test.ts +111 -0
- package/Types/AI/AIRunStatus.ts +9 -0
- package/Types/BaseDatabase/AggregateBy.ts +12 -0
- package/Types/Dashboard/DashboardComponentType.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.ts +24 -0
- package/Types/Dashboard/DashboardTemplates.ts +9 -1
- package/Types/LlmLogStatus.ts +1 -0
- package/Types/Monitor/CriteriaFilter.ts +9 -0
- package/Types/Monitor/HttpPhaseTimings.ts +16 -0
- package/Types/Monitor/IotAlertTemplates.ts +22 -3
- package/Types/Monitor/LatencyMatrix.ts +27 -0
- package/Types/Monitor/MonitorCriteriaInstance.ts +2 -2
- package/Types/Monitor/MonitorMetricType.ts +27 -0
- package/Types/Monitor/MonitorStep.ts +36 -11
- package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +55 -0
- package/Types/Monitor/MonitorStepSnmpMonitor.ts +8 -0
- package/Types/Monitor/MonitorType.ts +14 -9
- package/Types/Monitor/PingMonitor/PingMonitorResponse.ts +20 -0
- package/Types/Monitor/SnmpMonitor/LldpNeighbor.ts +12 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +116 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +29 -0
- package/Types/Monitor/SnmpMonitor/SnmpInterface.ts +31 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +24 -0
- package/Types/Monitor/SnmpMonitor/SnmpTrap.ts +20 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +173 -0
- package/Types/Permission.ts +314 -0
- package/Types/Probe/ProbeMonitorResponse.ts +22 -0
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +8 -5
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +4 -1
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +6 -3
- package/UI/Components/CodeBlock/CodeBlock.tsx +2 -1
- package/UI/Components/CodeEditor/CodeEditor.tsx +3 -0
- package/UI/Components/Divider/Divider.tsx +1 -1
- package/UI/Components/Dropdown/Dropdown.tsx +13 -4
- package/UI/Components/EntityDropdown/EntityDropdown.tsx +110 -2
- package/UI/Components/ErrorBoundary.tsx +2 -1
- package/UI/Components/EventItem/EventItem.tsx +2 -2
- package/UI/Components/GanttChart/Bar/Index.tsx +1 -1
- package/UI/Components/Graphs/UptimeBarTooltip.tsx +30 -23
- package/UI/Components/Header/Header.tsx +7 -0
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +2 -0
- package/UI/Components/Icon/Icon.tsx +8 -6
- package/UI/Components/Label/Label.tsx +2 -2
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +22 -10
- package/UI/Components/LogsViewer/components/LogsHistogram.tsx +9 -3
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +8 -8
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +44 -20
- package/UI/Components/Modal/ConfirmModal.tsx +1 -1
- package/UI/Components/Modal/Modal.tsx +213 -121
- package/UI/Components/Modal/ModalFooter.tsx +33 -22
- package/UI/Components/ModelTable/TableView.tsx +1 -1
- package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +20 -12
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +2 -2
- package/UI/Components/Pill/Pill.tsx +21 -13
- package/UI/Components/StatusBubble/StatusBubble.tsx +3 -3
- package/UI/Components/Tabs/Tabs.tsx +10 -1
- package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +7 -1
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +9 -3
- package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +62 -4
- package/UI/Components/Workflow/Component.tsx +53 -33
- package/UI/Components/Workflow/ComponentPortViewer.tsx +6 -6
- package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +8 -8
- package/UI/Components/Workflow/ComponentsModal.tsx +16 -9
- package/UI/Components/Workflow/Workflow.tsx +13 -11
- package/UI/Utils/Navigation.ts +10 -1
- package/UI/Utils/Theme.ts +140 -0
- package/Utils/Dashboard/Components/DashboardLogChartComponent.ts +99 -0
- package/Utils/Dashboard/Components/Index.ts +7 -0
- package/Utils/Monitor/LatencyMatrixUtil.ts +162 -0
- package/Utils/Monitor/MonitorMetricType.ts +141 -3
- package/Utils/Monitor/NetworkTopologyUtil.ts +159 -0
- package/Utils/Telemetry/EntityRelationship.ts +11 -0
- package/build/dist/Models/DatabaseModels/AIRun.js +52 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertSeverity.js +6 -0
- package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js +6 -0
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +16 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js +493 -0
- package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js.map +1 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js +58 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LlmProvider.js +33 -0
- package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +1426 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +738 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js +522 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js +603 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js +503 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js +502 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js +589 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Project.js +147 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js +57 -0
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskAPI.js +8 -23
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +95 -55
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/AlertAPI.js +5 -0
- package/build/dist/Server/API/AlertAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentAPI.js +10 -0
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +5 -0
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +5 -7
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +5 -0
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js +51 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js +101 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIAgentTaskService.js +59 -0
- package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +33 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +82 -9
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +19 -0
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +14 -25
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +14 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/IoTDeviceCredentialService.js +321 -0
- package/build/dist/Server/Services/IoTDeviceCredentialService.js.map +1 -0
- package/build/dist/Server/Services/IoTDeviceService.js +49 -15
- package/build/dist/Server/Services/IoTDeviceService.js.map +1 -1
- package/build/dist/Server/Services/LlmLogService.js +29 -0
- package/build/dist/Server/Services/LlmLogService.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +3 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/LogAggregationService.js +21 -7
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/MetricService.js +449 -7
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +2 -1
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +166 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js +13 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js +186 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceService.js +52 -0
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -0
- package/build/dist/Server/Services/NetworkInterfaceService.js +9 -0
- package/build/dist/Server/Services/NetworkInterfaceService.js.map +1 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js +22 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryEntityService.js +64 -2
- package/build/dist/Server/Services/TelemetryEntityService.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js +189 -9
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js +84 -17
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js +428 -0
- package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js.map +1 -0
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js +63 -47
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +2 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js +300 -0
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +16 -0
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js +29 -0
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +130 -2
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js +81 -0
- package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +18 -7
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -10
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +155 -5
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +76 -30
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +147 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +167 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +93 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -0
- package/build/dist/Types/AI/AIRunStatus.js +9 -0
- package/build/dist/Types/AI/AIRunStatus.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/DashboardLogChartComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +9 -1
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/LlmLogStatus.js +1 -0
- package/build/dist/Types/LlmLogStatus.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +9 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/HttpPhaseTimings.js +2 -0
- package/build/dist/Types/Monitor/HttpPhaseTimings.js.map +1 -0
- package/build/dist/Types/Monitor/IotAlertTemplates.js +7 -7
- package/build/dist/Types/Monitor/IotAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/LatencyMatrix.js +2 -0
- package/build/dist/Types/Monitor/LatencyMatrix.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +2 -2
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorMetricType.js +24 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +22 -9
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +36 -0
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js +3 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +14 -9
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +89 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +137 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -0
- package/build/dist/Types/Permission.js +280 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +7 -4
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +4 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js +1 -1
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +3 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/Divider/Divider.js +1 -1
- package/build/dist/UI/Components/Divider/Divider.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +10 -4
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js +76 -3
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js.map +1 -1
- package/build/dist/UI/Components/ErrorBoundary.js +2 -1
- package/build/dist/UI/Components/ErrorBoundary.js.map +1 -1
- package/build/dist/UI/Components/EventItem/EventItem.js +2 -2
- package/build/dist/UI/Components/EventItem/EventItem.js.map +1 -1
- package/build/dist/UI/Components/GanttChart/Bar/Index.js +1 -1
- package/build/dist/UI/Components/GanttChart/Bar/Index.js.map +1 -1
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +29 -23
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
- package/build/dist/UI/Components/Header/Header.js +1 -0
- package/build/dist/UI/Components/Header/Header.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +8 -6
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Label/Label.js +2 -2
- package/build/dist/UI/Components/Label/Label.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +20 -8
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +8 -2
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +8 -8
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +40 -20
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Modal/ConfirmModal.js +1 -1
- package/build/dist/UI/Components/Modal/ConfirmModal.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +109 -51
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js +13 -10
- package/build/dist/UI/Components/Modal/ModalFooter.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
- package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +17 -12
- package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +2 -2
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/Pill/Pill.js +12 -13
- package/build/dist/UI/Components/Pill/Pill.js.map +1 -1
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js +3 -3
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js.map +1 -1
- package/build/dist/UI/Components/Tabs/Tabs.js +3 -1
- package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +8 -2
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +36 -6
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Component.js +43 -33
- package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +6 -6
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +8 -8
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +15 -9
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Workflow.js +13 -11
- package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +11 -1
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/Theme.js +106 -0
- package/build/dist/UI/Utils/Theme.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js +89 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.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/Monitor/LatencyMatrixUtil.js +89 -0
- package/build/dist/Utils/Monitor/LatencyMatrixUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorMetricType.js +138 -4
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +112 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityRelationship.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import "../TestingUtils/Init";
|
|
2
|
+
import { MetricService } from "../../../Server/Services/MetricService";
|
|
3
|
+
import Metric from "../../../Models/AnalyticsModels/Metric";
|
|
4
|
+
import AggregateBy from "../../../Server/Types/AnalyticsDatabase/AggregateBy";
|
|
5
|
+
import { Statement } from "../../../Server/Utils/AnalyticsDatabase/Statement";
|
|
6
|
+
import AggregationType from "../../../Types/BaseDatabase/AggregationType";
|
|
7
|
+
import InBetween from "../../../Types/BaseDatabase/InBetween";
|
|
8
|
+
import SortOrder from "../../../Types/BaseDatabase/SortOrder";
|
|
9
|
+
import BadDataException from "../../../Types/Exception/BadDataException";
|
|
10
|
+
import ObjectID from "../../../Types/ObjectID";
|
|
11
|
+
|
|
12
|
+
describe("MetricService aggregate statement generation", () => {
|
|
13
|
+
const projectId: ObjectID = ObjectID.generate();
|
|
14
|
+
const startDate: Date = new Date("2026-07-09T19:08:00.000Z");
|
|
15
|
+
const endDate: Date = new Date("2026-07-09T19:13:00.000Z");
|
|
16
|
+
|
|
17
|
+
let service: MetricService;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
service = new MetricService();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
type BuildAggregateByFunction = (
|
|
24
|
+
overrides?: Partial<AggregateBy<Metric>>,
|
|
25
|
+
) => AggregateBy<Metric>;
|
|
26
|
+
|
|
27
|
+
const buildAggregateBy: BuildAggregateByFunction = (
|
|
28
|
+
overrides?: Partial<AggregateBy<Metric>>,
|
|
29
|
+
): AggregateBy<Metric> => {
|
|
30
|
+
return {
|
|
31
|
+
query: {
|
|
32
|
+
projectId: projectId,
|
|
33
|
+
name: "http.client.request.duration",
|
|
34
|
+
time: new InBetween(startDate, endDate),
|
|
35
|
+
} as AggregateBy<Metric>["query"],
|
|
36
|
+
aggregationType: AggregationType.Avg,
|
|
37
|
+
aggregateColumnName: "value",
|
|
38
|
+
aggregationTimestampColumnName: "time",
|
|
39
|
+
startTimestamp: startDate,
|
|
40
|
+
endTimestamp: endDate,
|
|
41
|
+
limit: 10000,
|
|
42
|
+
skip: 0,
|
|
43
|
+
sort: { time: SortOrder.Ascending } as AggregateBy<Metric>["sort"],
|
|
44
|
+
props: { isRoot: true },
|
|
45
|
+
...overrides,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type GetQueryFunction = (aggregateBy: AggregateBy<Metric>) => string;
|
|
50
|
+
|
|
51
|
+
const getQuery: GetQueryFunction = (
|
|
52
|
+
aggregateBy: AggregateBy<Metric>,
|
|
53
|
+
): string => {
|
|
54
|
+
const result: { statement: Statement; columns: Array<string> } =
|
|
55
|
+
service.toAggregateStatement(aggregateBy);
|
|
56
|
+
return result.statement.query;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
describe("scalar aggregations", () => {
|
|
60
|
+
it("routes plain Avg (no filters, no group-by, no distribution hint) to the minute MV", () => {
|
|
61
|
+
const query: string = getQuery(buildAggregateBy());
|
|
62
|
+
expect(query).toContain("MetricItemAggMV1m");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("skips the MVs and uses count-weighted expressions when the metric is a distribution (histogram) metric", () => {
|
|
66
|
+
const aggregateBy: AggregateBy<Metric> = buildAggregateBy();
|
|
67
|
+
(
|
|
68
|
+
service as unknown as {
|
|
69
|
+
pointTypeHintByAggregate: WeakMap<AggregateBy<Metric>, string | null>;
|
|
70
|
+
}
|
|
71
|
+
).pointTypeHintByAggregate.set(aggregateBy, "Histogram");
|
|
72
|
+
|
|
73
|
+
const query: string = getQuery(aggregateBy);
|
|
74
|
+
|
|
75
|
+
expect(query).not.toContain("MetricItemAggMV1m");
|
|
76
|
+
/*
|
|
77
|
+
* Avg must be count-weighted (sum of observation totals divided
|
|
78
|
+
* by sum of observation counts) — NOT avg(value), which for
|
|
79
|
+
* histogram rows averages per-export-interval sums.
|
|
80
|
+
*/
|
|
81
|
+
expect(query).toContain("sum(multiIf(isNotNull(count)");
|
|
82
|
+
expect(query).toContain("toFloat64(count)");
|
|
83
|
+
expect(query).not.toContain("avg(value)");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("uses count-weighted expressions on the base table when an attribute filter blocks the MVs", () => {
|
|
87
|
+
const aggregateBy: AggregateBy<Metric> = buildAggregateBy({
|
|
88
|
+
query: {
|
|
89
|
+
projectId: projectId,
|
|
90
|
+
name: "http.client.request.duration",
|
|
91
|
+
time: new InBetween(startDate, endDate),
|
|
92
|
+
attributes: { "oneuptime.service.name": "starship-web" },
|
|
93
|
+
} as unknown as AggregateBy<Metric>["query"],
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const query: string = getQuery(aggregateBy);
|
|
97
|
+
|
|
98
|
+
expect(query).not.toContain("MetricItemAggMV1m");
|
|
99
|
+
expect(query).toContain("sum(multiIf(isNotNull(count)");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("groups by individual attribute keys, not the whole attributes map", () => {
|
|
103
|
+
const aggregateBy: AggregateBy<Metric> = buildAggregateBy({
|
|
104
|
+
groupByAttributeKeys: ["oneuptime.service.name"],
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const result: { statement: Statement; columns: Array<string> } =
|
|
108
|
+
service.toAggregateStatement(aggregateBy);
|
|
109
|
+
const query: string = result.statement.query;
|
|
110
|
+
|
|
111
|
+
// Key extraction is parameter-bound and aliased...
|
|
112
|
+
expect(query).toMatch(/attributes\[\{p\d+:String\}\] AS __attr_grp_0/);
|
|
113
|
+
// ...regrouped rows re-project the selected keys as a compact map...
|
|
114
|
+
expect(query).toMatch(
|
|
115
|
+
/map\(\{p\d+:String\}, __attr_grp_0\) AS attributes/,
|
|
116
|
+
);
|
|
117
|
+
// ...grouping happens on the extracted key, never the Map column.
|
|
118
|
+
expect(query).toContain("GROUP BY time, __attr_grp_0");
|
|
119
|
+
expect(query).not.toContain("GROUP BY time, attributes");
|
|
120
|
+
|
|
121
|
+
// The selected key reaches the query only as a bound parameter.
|
|
122
|
+
const parameterValues: Array<unknown> = Object.values(
|
|
123
|
+
result.statement.query_params,
|
|
124
|
+
);
|
|
125
|
+
expect(
|
|
126
|
+
parameterValues.filter((value: unknown) => {
|
|
127
|
+
return value === "oneuptime.service.name";
|
|
128
|
+
}),
|
|
129
|
+
).toHaveLength(2); // extraction + map key
|
|
130
|
+
|
|
131
|
+
expect(result.columns).toContain("attributes");
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("drops a legacy whole-map attributes group-by when key-scoped grouping is requested", () => {
|
|
135
|
+
const aggregateBy: AggregateBy<Metric> = buildAggregateBy({
|
|
136
|
+
groupBy: { attributes: true } as AggregateBy<Metric>["groupBy"],
|
|
137
|
+
groupByAttributeKeys: ["oneuptime.service.name"],
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const query: string = getQuery(aggregateBy);
|
|
141
|
+
|
|
142
|
+
expect(query).toContain("GROUP BY time, __attr_grp_0");
|
|
143
|
+
expect(query).not.toContain("GROUP BY time, attributes");
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("rejects more than 10 group-by attribute keys", () => {
|
|
147
|
+
const aggregateBy: AggregateBy<Metric> = buildAggregateBy({
|
|
148
|
+
groupByAttributeKeys: Array.from(
|
|
149
|
+
{ length: 11 },
|
|
150
|
+
(_: unknown, i: number) => {
|
|
151
|
+
return `key.${i}`;
|
|
152
|
+
},
|
|
153
|
+
),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
expect(() => {
|
|
157
|
+
return service.toAggregateStatement(aggregateBy);
|
|
158
|
+
}).toThrow(BadDataException);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe("percentile aggregations", () => {
|
|
163
|
+
it("keeps the histogram bucket fanout and pools by selected attribute keys", () => {
|
|
164
|
+
const aggregateBy: AggregateBy<Metric> = buildAggregateBy({
|
|
165
|
+
aggregationType: AggregationType.P90,
|
|
166
|
+
groupByAttributeKeys: ["oneuptime.service.name"],
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const result: { statement: Statement; columns: Array<string> } =
|
|
170
|
+
service.toAggregateStatement(aggregateBy);
|
|
171
|
+
const query: string = result.statement.query;
|
|
172
|
+
|
|
173
|
+
expect(query).toContain("quantileExactWeighted(0.9)");
|
|
174
|
+
expect(query).toMatch(/attributes\[\{p\d+:String\}\] AS __attr_grp_0/);
|
|
175
|
+
expect(query).toMatch(
|
|
176
|
+
/map\(\{p\d+:String\}, __attr_grp_0\) AS attributes/,
|
|
177
|
+
);
|
|
178
|
+
expect(query).toContain("GROUP BY time, __attr_grp_0");
|
|
179
|
+
expect(result.columns).toContain("attributes");
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("does not group when no attribute keys are selected (regression: whole-map fragmentation)", () => {
|
|
183
|
+
const aggregateBy: AggregateBy<Metric> = buildAggregateBy({
|
|
184
|
+
aggregationType: AggregationType.P90,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const query: string = getQuery(aggregateBy);
|
|
188
|
+
|
|
189
|
+
expect(query).toContain("quantileExactWeighted(0.9)");
|
|
190
|
+
expect(query).not.toContain("__attr_grp_0");
|
|
191
|
+
expect(query).toContain("GROUP BY time");
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
});
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { BaselineAnomalyTool } from "../../../../Server/Utils/AI/Toolbox/MetricTools";
|
|
2
|
+
import { ToolContext } from "../../../../Server/Utils/AI/Toolbox/ToolTypes";
|
|
3
|
+
import MetricBaselineService from "../../../../Server/Services/MetricBaselineService";
|
|
4
|
+
import MetricService from "../../../../Server/Services/MetricService";
|
|
5
|
+
import ModelPermission from "../../../../Server/Types/AnalyticsDatabase/ModelPermission";
|
|
6
|
+
import ObjectID from "../../../../Types/ObjectID";
|
|
7
|
+
import AggregatedResult from "../../../../Types/BaseDatabase/AggregatedResult";
|
|
8
|
+
import { describe, expect, test, afterEach, beforeEach } from "@jest/globals";
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* baseline_anomaly judges a metric's recent average against its learned
|
|
12
|
+
* hour-of-week baseline band (mean ± sigma·stddev — the same math the anomaly
|
|
13
|
+
* monitors use via sigmaForSensitivity). These tests mock the baseline and
|
|
14
|
+
* metric services (no ClickHouse) to lock in:
|
|
15
|
+
* (a) missing/unreliable baselines report "insufficient baseline data" and
|
|
16
|
+
* never render a normal/anomalous verdict (a missing baseline must not
|
|
17
|
+
* read as "not anomalous");
|
|
18
|
+
* (b) above-band / below-band / within-band classification at Medium (3σ);
|
|
19
|
+
* (c) a metric with no recent data points is flagged as possibly having
|
|
20
|
+
* stopped reporting, not judged normal;
|
|
21
|
+
* (d) a zero-stddev baseline still classifies (band collapses to the mean).
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const ctx: ToolContext = {
|
|
25
|
+
projectId: ObjectID.generate(),
|
|
26
|
+
props: { isRoot: true },
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function mockBaseline(data: {
|
|
30
|
+
mean: number;
|
|
31
|
+
stddev: number;
|
|
32
|
+
sampleCount?: number;
|
|
33
|
+
isReliable?: boolean;
|
|
34
|
+
}): void {
|
|
35
|
+
jest.spyOn(MetricBaselineService, "getBaseline").mockResolvedValue({
|
|
36
|
+
sampleCount: data.sampleCount ?? 50,
|
|
37
|
+
mean: data.mean,
|
|
38
|
+
stddev: data.stddev,
|
|
39
|
+
median: data.mean,
|
|
40
|
+
p95: data.mean + 2 * data.stddev,
|
|
41
|
+
minObserved: data.mean - 3 * data.stddev,
|
|
42
|
+
maxObserved: data.mean + 3 * data.stddev,
|
|
43
|
+
isReliable: data.isReliable ?? true,
|
|
44
|
+
windowDays: 14,
|
|
45
|
+
hourOfWeek: 10,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function mockCurrentValues(values: Array<number>): void {
|
|
50
|
+
jest.spyOn(MetricService, "aggregateBy").mockResolvedValue({
|
|
51
|
+
data: values.map((value: number) => {
|
|
52
|
+
return { timestamp: new Date(), value };
|
|
53
|
+
}),
|
|
54
|
+
} as unknown as AggregatedResult);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function mockEmptyBand(): void {
|
|
58
|
+
jest.spyOn(MetricBaselineService, "getBandSeries").mockResolvedValue([]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
describe("BaselineAnomalyTool", () => {
|
|
62
|
+
beforeEach(() => {
|
|
63
|
+
// Default: project-wide telemetry access (null = unrestricted).
|
|
64
|
+
jest
|
|
65
|
+
.spyOn(ModelPermission, "getAccessibleServiceIdsForAnalyticsModel")
|
|
66
|
+
.mockResolvedValue(null);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
afterEach(() => {
|
|
70
|
+
jest.restoreAllMocks();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("requires metricName", async () => {
|
|
74
|
+
await expect(BaselineAnomalyTool.execute({}, ctx)).rejects.toThrow(
|
|
75
|
+
"metricName is required",
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test("rejects an unparseable atTime", async () => {
|
|
80
|
+
await expect(
|
|
81
|
+
BaselineAnomalyTool.execute(
|
|
82
|
+
{ metricName: "cpu.usage", atTime: "yesterday-ish" },
|
|
83
|
+
ctx,
|
|
84
|
+
),
|
|
85
|
+
).rejects.toThrow("not a valid ISO 8601 timestamp");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("no baseline reports insufficient data and never queries the metric", async () => {
|
|
89
|
+
jest.spyOn(MetricBaselineService, "getBaseline").mockResolvedValue(null);
|
|
90
|
+
jest.spyOn(MetricBaselineService, "getCoverage").mockResolvedValue({
|
|
91
|
+
totalSamples: 3,
|
|
92
|
+
oldestDay: new Date(),
|
|
93
|
+
});
|
|
94
|
+
const aggregateBy: jest.SpyInstance = jest.spyOn(
|
|
95
|
+
MetricService,
|
|
96
|
+
"aggregateBy",
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
100
|
+
{ metricName: "cpu.usage" },
|
|
101
|
+
ctx,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
expect(result.dataForLlm).toContain("insufficient baseline data");
|
|
105
|
+
expect(result.dataForLlm).not.toContain("ANOMALOUS");
|
|
106
|
+
expect(aggregateBy).not.toHaveBeenCalled();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("unreliable baseline (too few samples) also reports insufficient data", async () => {
|
|
110
|
+
mockBaseline({ mean: 100, stddev: 10, sampleCount: 2, isReliable: false });
|
|
111
|
+
jest.spyOn(MetricBaselineService, "getCoverage").mockResolvedValue({
|
|
112
|
+
totalSamples: 2,
|
|
113
|
+
oldestDay: null,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
117
|
+
{ metricName: "cpu.usage" },
|
|
118
|
+
ctx,
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
expect(result.dataForLlm).toContain("insufficient baseline data");
|
|
122
|
+
expect(result.dataForLlm).toContain("only 2 sample(s)");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("value above the 3-sigma band is anomalous (above)", async () => {
|
|
126
|
+
mockBaseline({ mean: 100, stddev: 10 });
|
|
127
|
+
mockCurrentValues([150]);
|
|
128
|
+
mockEmptyBand();
|
|
129
|
+
|
|
130
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
131
|
+
{ metricName: "cpu.usage" },
|
|
132
|
+
ctx,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
expect(result.dataForLlm).toContain("ANOMALOUS — above");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("value below the 3-sigma band is anomalous (below)", async () => {
|
|
139
|
+
mockBaseline({ mean: 100, stddev: 10 });
|
|
140
|
+
mockCurrentValues([30]);
|
|
141
|
+
mockEmptyBand();
|
|
142
|
+
|
|
143
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
144
|
+
{ metricName: "cpu.usage" },
|
|
145
|
+
ctx,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
expect(result.dataForLlm).toContain("ANOMALOUS — below");
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("value inside the band is normal", async () => {
|
|
152
|
+
mockBaseline({ mean: 100, stddev: 10 });
|
|
153
|
+
mockCurrentValues([120]);
|
|
154
|
+
mockEmptyBand();
|
|
155
|
+
|
|
156
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
157
|
+
{ metricName: "cpu.usage" },
|
|
158
|
+
ctx,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
expect(result.dataForLlm).toContain("normal — within the expected range");
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test("High sensitivity (2 sigma) flags what Medium would call normal", async () => {
|
|
165
|
+
mockBaseline({ mean: 100, stddev: 10 });
|
|
166
|
+
mockCurrentValues([125]); // z = 2.5: inside 3σ, outside 2σ
|
|
167
|
+
mockEmptyBand();
|
|
168
|
+
|
|
169
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
170
|
+
{ metricName: "cpu.usage", sensitivity: "High" },
|
|
171
|
+
ctx,
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
expect(result.dataForLlm).toContain("ANOMALOUS — above");
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test("no recent data points is flagged as possibly stopped reporting", async () => {
|
|
178
|
+
mockBaseline({ mean: 100, stddev: 10 });
|
|
179
|
+
mockCurrentValues([]);
|
|
180
|
+
mockEmptyBand();
|
|
181
|
+
|
|
182
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
183
|
+
{ metricName: "cpu.usage" },
|
|
184
|
+
ctx,
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
expect(result.dataForLlm).toContain("STOPPED reporting");
|
|
188
|
+
expect(result.dataForLlm).not.toContain("normal — within");
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
test("zero-stddev baseline refuses to classify, matching the anomaly monitors", async () => {
|
|
192
|
+
mockBaseline({ mean: 100, stddev: 0 });
|
|
193
|
+
mockCurrentValues([101]);
|
|
194
|
+
mockEmptyBand();
|
|
195
|
+
|
|
196
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
197
|
+
{ metricName: "cpu.usage" },
|
|
198
|
+
ctx,
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
expect(result.dataForLlm).toContain("cannot judge");
|
|
202
|
+
expect(result.dataForLlm).toContain("zero variance");
|
|
203
|
+
expect(result.dataForLlm).not.toContain("ANOMALOUS");
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test("a label-scoped user without entityId is refused (baseline SQL skips the owned-scope filter)", async () => {
|
|
207
|
+
jest
|
|
208
|
+
.spyOn(ModelPermission, "getAccessibleServiceIdsForAnalyticsModel")
|
|
209
|
+
.mockResolvedValue([ObjectID.generate()]);
|
|
210
|
+
const getBaseline: jest.SpyInstance = jest.spyOn(
|
|
211
|
+
MetricBaselineService,
|
|
212
|
+
"getBaseline",
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
await expect(
|
|
216
|
+
BaselineAnomalyTool.execute({ metricName: "cpu.usage" }, ctx),
|
|
217
|
+
).rejects.toThrow("scoped to specific services");
|
|
218
|
+
expect(getBaseline).not.toHaveBeenCalled();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test("a label-scoped user asking about another service's entity is refused", async () => {
|
|
222
|
+
jest
|
|
223
|
+
.spyOn(ModelPermission, "getAccessibleServiceIdsForAnalyticsModel")
|
|
224
|
+
.mockResolvedValue([ObjectID.generate()]);
|
|
225
|
+
|
|
226
|
+
await expect(
|
|
227
|
+
BaselineAnomalyTool.execute(
|
|
228
|
+
{
|
|
229
|
+
metricName: "cpu.usage",
|
|
230
|
+
entityId: ObjectID.generate().toString(),
|
|
231
|
+
},
|
|
232
|
+
ctx,
|
|
233
|
+
),
|
|
234
|
+
).rejects.toThrow("scoped to specific services");
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
test("a label-scoped user pinned to their own service proceeds", async () => {
|
|
238
|
+
const ownServiceId: ObjectID = ObjectID.generate();
|
|
239
|
+
jest
|
|
240
|
+
.spyOn(ModelPermission, "getAccessibleServiceIdsForAnalyticsModel")
|
|
241
|
+
.mockResolvedValue([ownServiceId]);
|
|
242
|
+
mockBaseline({ mean: 100, stddev: 10 });
|
|
243
|
+
mockCurrentValues([120]);
|
|
244
|
+
mockEmptyBand();
|
|
245
|
+
|
|
246
|
+
const result: { dataForLlm: string } = await BaselineAnomalyTool.execute(
|
|
247
|
+
{ metricName: "cpu.usage", entityId: ownServiceId.toString() },
|
|
248
|
+
ctx,
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
expect(result.dataForLlm).toContain("normal — within the expected range");
|
|
252
|
+
});
|
|
253
|
+
});
|
|
@@ -384,3 +384,47 @@ describe("LLMService — prompt caching", () => {
|
|
|
384
384
|
expect(response.usage!.totalTokens).toBe(55);
|
|
385
385
|
});
|
|
386
386
|
});
|
|
387
|
+
|
|
388
|
+
describe("LLMService — additionalParams (per-provider overrides)", () => {
|
|
389
|
+
test("merges provider additionalParams into the request body", async () => {
|
|
390
|
+
const spy: PostSpy = mockPostResponse({
|
|
391
|
+
choices: [{ message: { content: "OK" } }],
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
await LLMService.getCompletion({
|
|
395
|
+
llmProviderConfig: { llmType: LlmType.OpenAI, apiKey: "test-key" },
|
|
396
|
+
messages: [{ role: "user", content: "hi" }],
|
|
397
|
+
maxTokens: 1024,
|
|
398
|
+
additionalParams: { temperature: 0.2, top_p: 0.9 },
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
const requestBody: JSONObject = (
|
|
402
|
+
spy.mock.calls[0]![0] as { data: JSONObject }
|
|
403
|
+
).data;
|
|
404
|
+
// additionalParams override defaults and are added to the body...
|
|
405
|
+
expect(requestBody["temperature"]).toBe(0.2);
|
|
406
|
+
expect(requestBody["top_p"]).toBe(0.9);
|
|
407
|
+
// ...while leaving the default max_tokens intact for legacy providers.
|
|
408
|
+
expect(requestBody["max_tokens"]).toBe(1024);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
test("max_completion_tokens in additionalParams drops the legacy max_tokens", async () => {
|
|
412
|
+
const spy: PostSpy = mockPostResponse({
|
|
413
|
+
choices: [{ message: { content: "OK" } }],
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
await LLMService.getCompletion({
|
|
417
|
+
llmProviderConfig: { llmType: LlmType.OpenAI, apiKey: "test-key" },
|
|
418
|
+
messages: [{ role: "user", content: "hi" }],
|
|
419
|
+
maxTokens: 1024,
|
|
420
|
+
// gpt-5 / o1 / o3 reject max_tokens and require max_completion_tokens.
|
|
421
|
+
additionalParams: { max_completion_tokens: 2048 },
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
const requestBody: JSONObject = (
|
|
425
|
+
spy.mock.calls[0]![0] as { data: JSONObject }
|
|
426
|
+
).data;
|
|
427
|
+
expect(requestBody["max_completion_tokens"]).toBe(2048);
|
|
428
|
+
expect(requestBody["max_tokens"]).toBeUndefined();
|
|
429
|
+
});
|
|
430
|
+
});
|