@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
|
@@ -205,6 +205,60 @@ export default class TelemetryEntityRelationship extends DatabaseBaseModel {
|
|
|
205
205
|
@Column({ type: ColumnType.Date, nullable: true })
|
|
206
206
|
public lastSeenAt?: Date = undefined;
|
|
207
207
|
|
|
208
|
+
/*
|
|
209
|
+
* Traffic metrics for `depends-on` edges, refreshed each run of the
|
|
210
|
+
* ComputeServiceDependencies cron from the most recent span window
|
|
211
|
+
* (~15 min). Null on co-occurrence-inferred edges, which carry no
|
|
212
|
+
* call semantics.
|
|
213
|
+
*/
|
|
214
|
+
@ColumnAccessControl({
|
|
215
|
+
create: CREATE_PERMS,
|
|
216
|
+
read: READ_PERMS,
|
|
217
|
+
update: UPDATE_PERMS,
|
|
218
|
+
})
|
|
219
|
+
@TableColumn({
|
|
220
|
+
type: TableColumnType.Number,
|
|
221
|
+
required: false,
|
|
222
|
+
title: "Call Count",
|
|
223
|
+
description:
|
|
224
|
+
"Calls observed over this edge in the most recent computation window (depends-on edges only).",
|
|
225
|
+
example: "1240",
|
|
226
|
+
})
|
|
227
|
+
@Column({ type: ColumnType.Number, nullable: true })
|
|
228
|
+
public callCount?: number = undefined;
|
|
229
|
+
|
|
230
|
+
@ColumnAccessControl({
|
|
231
|
+
create: CREATE_PERMS,
|
|
232
|
+
read: READ_PERMS,
|
|
233
|
+
update: UPDATE_PERMS,
|
|
234
|
+
})
|
|
235
|
+
@TableColumn({
|
|
236
|
+
type: TableColumnType.Number,
|
|
237
|
+
required: false,
|
|
238
|
+
title: "Error Count",
|
|
239
|
+
description:
|
|
240
|
+
"Errored calls observed over this edge in the most recent computation window (depends-on edges only).",
|
|
241
|
+
example: "12",
|
|
242
|
+
})
|
|
243
|
+
@Column({ type: ColumnType.Number, nullable: true })
|
|
244
|
+
public errorCount?: number = undefined;
|
|
245
|
+
|
|
246
|
+
@ColumnAccessControl({
|
|
247
|
+
create: CREATE_PERMS,
|
|
248
|
+
read: READ_PERMS,
|
|
249
|
+
update: UPDATE_PERMS,
|
|
250
|
+
})
|
|
251
|
+
@TableColumn({
|
|
252
|
+
type: TableColumnType.Number,
|
|
253
|
+
required: false,
|
|
254
|
+
title: "Average Duration (ms)",
|
|
255
|
+
description:
|
|
256
|
+
"Average call duration in milliseconds over this edge in the most recent computation window (depends-on edges only).",
|
|
257
|
+
example: "38",
|
|
258
|
+
})
|
|
259
|
+
@Column({ type: ColumnType.Number, nullable: true })
|
|
260
|
+
public avgDurationMs?: number = undefined;
|
|
261
|
+
|
|
208
262
|
@ColumnAccessControl({ create: CREATE_PERMS, read: READ_PERMS, update: [] })
|
|
209
263
|
@TableColumn({
|
|
210
264
|
manyToOneRelationColumn: "createdByUserId",
|
|
@@ -16,7 +16,6 @@ import { JSONObject } from "../../Types/JSON";
|
|
|
16
16
|
import ObjectID from "../../Types/ObjectID";
|
|
17
17
|
import OneUptimeDate from "../../Types/Date";
|
|
18
18
|
import AIAgentTaskStatus from "../../Types/AI/AIAgentTaskStatus";
|
|
19
|
-
import SortOrder from "../../Types/BaseDatabase/SortOrder";
|
|
20
19
|
import PositiveNumber from "../../Types/PositiveNumber";
|
|
21
20
|
|
|
22
21
|
export default class AIAgentTaskAPI extends BaseAPI<
|
|
@@ -27,8 +26,10 @@ export default class AIAgentTaskAPI extends BaseAPI<
|
|
|
27
26
|
super(AIAgentTask, AIAgentTaskService);
|
|
28
27
|
|
|
29
28
|
/*
|
|
30
|
-
*
|
|
31
|
-
* Validates aiAgentId and aiAgentKey before
|
|
29
|
+
* Claim the next pending (scheduled) task for processing.
|
|
30
|
+
* Validates aiAgentId and aiAgentKey before claiming. The task is
|
|
31
|
+
* atomically transitioned Scheduled -> InProgress before it is
|
|
32
|
+
* returned, so concurrent workers can never receive the same task.
|
|
32
33
|
*/
|
|
33
34
|
this.router.post(
|
|
34
35
|
`${new this.entityType().getCrudApiPath()?.toString()}/get-pending-task`,
|
|
@@ -39,7 +40,7 @@ export default class AIAgentTaskAPI extends BaseAPI<
|
|
|
39
40
|
/* Validate AI Agent credentials */
|
|
40
41
|
const aiAgent: AIAgent | null = await this.validateAIAgent(data);
|
|
41
42
|
|
|
42
|
-
if (!aiAgent) {
|
|
43
|
+
if (!aiAgent || !aiAgent.id) {
|
|
43
44
|
return Response.sendErrorResponse(
|
|
44
45
|
req,
|
|
45
46
|
res,
|
|
@@ -47,25 +48,10 @@ export default class AIAgentTaskAPI extends BaseAPI<
|
|
|
47
48
|
);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
sort: {
|
|
56
|
-
createdAt: SortOrder.Ascending,
|
|
57
|
-
},
|
|
58
|
-
select: {
|
|
59
|
-
_id: true,
|
|
60
|
-
projectId: true,
|
|
61
|
-
taskType: true,
|
|
62
|
-
metadata: true,
|
|
63
|
-
createdAt: true,
|
|
64
|
-
},
|
|
65
|
-
props: {
|
|
66
|
-
isRoot: true,
|
|
67
|
-
},
|
|
68
|
-
});
|
|
51
|
+
const task: AIAgentTask | null =
|
|
52
|
+
await AIAgentTaskService.claimNextScheduledTask({
|
|
53
|
+
aiAgentId: aiAgent.id,
|
|
54
|
+
});
|
|
69
55
|
|
|
70
56
|
if (!task) {
|
|
71
57
|
return Response.sendJsonObjectResponse(req, res, {
|
|
@@ -82,7 +68,7 @@ export default class AIAgentTaskAPI extends BaseAPI<
|
|
|
82
68
|
metadata: task.metadata as JSONObject | undefined,
|
|
83
69
|
createdAt: task.createdAt,
|
|
84
70
|
},
|
|
85
|
-
message: "Task
|
|
71
|
+
message: "Task claimed successfully",
|
|
86
72
|
});
|
|
87
73
|
} catch (err) {
|
|
88
74
|
next(err);
|
|
@@ -12,13 +12,16 @@ import ObjectID from "../../Types/ObjectID";
|
|
|
12
12
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
13
13
|
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
14
14
|
import SortOrder from "../../Types/BaseDatabase/SortOrder";
|
|
15
|
+
import Query from "../../Types/BaseDatabase/Query";
|
|
15
16
|
import { JSONArray, JSONObject } from "../../Types/JSON";
|
|
16
17
|
import AIRunType from "../../Types/AI/AIRunType";
|
|
17
18
|
import AIRun from "../../Models/DatabaseModels/AIRun";
|
|
18
19
|
import AIRunEvent from "../../Models/DatabaseModels/AIRunEvent";
|
|
19
20
|
import Incident from "../../Models/DatabaseModels/Incident";
|
|
21
|
+
import Alert from "../../Models/DatabaseModels/Alert";
|
|
20
22
|
import BaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
21
23
|
import IncidentService from "../Services/IncidentService";
|
|
24
|
+
import AlertService from "../Services/AlertService";
|
|
22
25
|
import AIRunService from "../Services/AIRunService";
|
|
23
26
|
import AIRunEventService from "../Services/AIRunEventService";
|
|
24
27
|
|
|
@@ -28,14 +31,96 @@ const MAX_EVENTS: number = 500;
|
|
|
28
31
|
|
|
29
32
|
/*
|
|
30
33
|
* Returns the latest Sentinel investigation (the AIRun + its ordered
|
|
31
|
-
* AIRunEvents) for an incident, so the dashboard can render a live
|
|
32
|
-
* think" panel.
|
|
34
|
+
* AIRunEvents) for an incident or alert, so the dashboard can render a live
|
|
35
|
+
* "watch it think" panel.
|
|
33
36
|
*
|
|
34
37
|
* Investigation runs are system-authored (userId = null) and are therefore
|
|
35
38
|
* hidden by the per-user privacy pin on the generic AIRun / AIRunEvent CRUD. So
|
|
36
|
-
* we gate access explicitly here: first confirm the caller can read the
|
|
37
|
-
* under THEIR permissions, then read the run + events as root.
|
|
39
|
+
* we gate access explicitly here: first confirm the caller can read the
|
|
40
|
+
* incident/alert under THEIR permissions, then read the run + events as root.
|
|
38
41
|
*/
|
|
42
|
+
|
|
43
|
+
async function getLoggedInProps(
|
|
44
|
+
req: ExpressRequest,
|
|
45
|
+
): Promise<DatabaseCommonInteractionProps> {
|
|
46
|
+
const props: DatabaseCommonInteractionProps =
|
|
47
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
48
|
+
|
|
49
|
+
if (!props.userId) {
|
|
50
|
+
throw new NotAuthorizedException("A logged-in user session is required.");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return props;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* Read the latest investigation run + its events as root (bypasses the
|
|
58
|
+
* per-user pin) and send them. Callers must have already access-checked the
|
|
59
|
+
* subject under the USER's permissions.
|
|
60
|
+
*/
|
|
61
|
+
async function sendLatestInvestigation(
|
|
62
|
+
req: ExpressRequest,
|
|
63
|
+
res: ExpressResponse,
|
|
64
|
+
runQuery: Query<AIRun>,
|
|
65
|
+
): Promise<void> {
|
|
66
|
+
const runs: Array<AIRun> = await AIRunService.findBy({
|
|
67
|
+
query: runQuery,
|
|
68
|
+
select: {
|
|
69
|
+
_id: true,
|
|
70
|
+
status: true,
|
|
71
|
+
startedAt: true,
|
|
72
|
+
completedAt: true,
|
|
73
|
+
errorMessage: true,
|
|
74
|
+
llmCallCount: true,
|
|
75
|
+
toolCallCount: true,
|
|
76
|
+
totalTokens: true,
|
|
77
|
+
createdAt: true,
|
|
78
|
+
},
|
|
79
|
+
sort: { createdAt: SortOrder.Descending },
|
|
80
|
+
limit: 1,
|
|
81
|
+
skip: 0,
|
|
82
|
+
props: { isRoot: true },
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const run: AIRun | undefined = runs[0];
|
|
86
|
+
|
|
87
|
+
if (!run) {
|
|
88
|
+
Response.sendJsonObjectResponse(req, res, {
|
|
89
|
+
run: null,
|
|
90
|
+
events: [],
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const events: Array<AIRunEvent> = await AIRunEventService.findBy({
|
|
96
|
+
query: { aiRunId: run.id! },
|
|
97
|
+
select: {
|
|
98
|
+
_id: true,
|
|
99
|
+
sequence: true,
|
|
100
|
+
eventType: true,
|
|
101
|
+
toolName: true,
|
|
102
|
+
resultSummary: true,
|
|
103
|
+
createdAt: true,
|
|
104
|
+
},
|
|
105
|
+
sort: { sequence: SortOrder.Ascending },
|
|
106
|
+
limit: MAX_EVENTS,
|
|
107
|
+
skip: 0,
|
|
108
|
+
props: { isRoot: true },
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const runJson: JSONObject | undefined = BaseModel.toJSONArray(
|
|
112
|
+
[run],
|
|
113
|
+
AIRun,
|
|
114
|
+
)[0];
|
|
115
|
+
|
|
116
|
+
const eventsJson: JSONArray = BaseModel.toJSONArray(events, AIRunEvent);
|
|
117
|
+
|
|
118
|
+
Response.sendJsonObjectResponse(req, res, {
|
|
119
|
+
run: runJson || null,
|
|
120
|
+
events: eventsJson,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
39
124
|
router.post(
|
|
40
125
|
"/ai-investigation/incident",
|
|
41
126
|
UserMiddleware.getUserMiddleware,
|
|
@@ -45,14 +130,7 @@ router.post(
|
|
|
45
130
|
next: NextFunction,
|
|
46
131
|
): Promise<void> => {
|
|
47
132
|
try {
|
|
48
|
-
const props: DatabaseCommonInteractionProps =
|
|
49
|
-
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
50
|
-
|
|
51
|
-
if (!props.userId) {
|
|
52
|
-
throw new NotAuthorizedException(
|
|
53
|
-
"A logged-in user session is required.",
|
|
54
|
-
);
|
|
55
|
-
}
|
|
133
|
+
const props: DatabaseCommonInteractionProps = await getLoggedInProps(req);
|
|
56
134
|
|
|
57
135
|
const incidentIdString: string | undefined = req.body["incidentId"] as
|
|
58
136
|
| string
|
|
@@ -77,65 +155,55 @@ router.post(
|
|
|
77
155
|
);
|
|
78
156
|
}
|
|
79
157
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
triggeredByIncidentId: incidentId,
|
|
84
|
-
runType: AIRunType.Investigation,
|
|
85
|
-
},
|
|
86
|
-
select: {
|
|
87
|
-
_id: true,
|
|
88
|
-
status: true,
|
|
89
|
-
startedAt: true,
|
|
90
|
-
completedAt: true,
|
|
91
|
-
errorMessage: true,
|
|
92
|
-
llmCallCount: true,
|
|
93
|
-
toolCallCount: true,
|
|
94
|
-
totalTokens: true,
|
|
95
|
-
createdAt: true,
|
|
96
|
-
},
|
|
97
|
-
sort: { createdAt: SortOrder.Descending },
|
|
98
|
-
limit: 1,
|
|
99
|
-
skip: 0,
|
|
100
|
-
props: { isRoot: true },
|
|
158
|
+
await sendLatestInvestigation(req, res, {
|
|
159
|
+
triggeredByIncidentId: incidentId,
|
|
160
|
+
runType: AIRunType.Investigation,
|
|
101
161
|
});
|
|
162
|
+
return;
|
|
163
|
+
} catch (err) {
|
|
164
|
+
next(err);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
router.post(
|
|
171
|
+
"/ai-investigation/alert",
|
|
172
|
+
UserMiddleware.getUserMiddleware,
|
|
173
|
+
async (
|
|
174
|
+
req: ExpressRequest,
|
|
175
|
+
res: ExpressResponse,
|
|
176
|
+
next: NextFunction,
|
|
177
|
+
): Promise<void> => {
|
|
178
|
+
try {
|
|
179
|
+
const props: DatabaseCommonInteractionProps = await getLoggedInProps(req);
|
|
102
180
|
|
|
103
|
-
const
|
|
181
|
+
const alertIdString: string | undefined = req.body["alertId"] as
|
|
182
|
+
| string
|
|
183
|
+
| undefined;
|
|
104
184
|
|
|
105
|
-
if (!
|
|
106
|
-
|
|
107
|
-
run: null,
|
|
108
|
-
events: [],
|
|
109
|
-
});
|
|
110
|
-
return;
|
|
185
|
+
if (!alertIdString) {
|
|
186
|
+
throw new BadDataException("alertId is required.");
|
|
111
187
|
}
|
|
112
188
|
|
|
113
|
-
const
|
|
114
|
-
query: { aiRunId: run.id! },
|
|
115
|
-
select: {
|
|
116
|
-
_id: true,
|
|
117
|
-
sequence: true,
|
|
118
|
-
eventType: true,
|
|
119
|
-
toolName: true,
|
|
120
|
-
resultSummary: true,
|
|
121
|
-
createdAt: true,
|
|
122
|
-
},
|
|
123
|
-
sort: { sequence: SortOrder.Ascending },
|
|
124
|
-
limit: MAX_EVENTS,
|
|
125
|
-
skip: 0,
|
|
126
|
-
props: { isRoot: true },
|
|
127
|
-
});
|
|
189
|
+
const alertId: ObjectID = new ObjectID(alertIdString);
|
|
128
190
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
191
|
+
// Access check under the USER's permissions (null when not allowed).
|
|
192
|
+
const alert: Alert | null = await AlertService.findOneById({
|
|
193
|
+
id: alertId,
|
|
194
|
+
select: { _id: true },
|
|
195
|
+
props,
|
|
196
|
+
});
|
|
133
197
|
|
|
134
|
-
|
|
198
|
+
if (!alert) {
|
|
199
|
+
throw new BadDataException(
|
|
200
|
+
"Alert not found (or you do not have access to it).",
|
|
201
|
+
);
|
|
202
|
+
}
|
|
135
203
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
204
|
+
await sendLatestInvestigation(req, res, {
|
|
205
|
+
triggeredByAlertId: alertId,
|
|
206
|
+
runType: AIRunType.Investigation,
|
|
139
207
|
});
|
|
140
208
|
return;
|
|
141
209
|
} catch (err) {
|
package/Server/API/AlertAPI.ts
CHANGED
|
@@ -123,6 +123,11 @@ export default class AlertAPI extends BaseAPI<Alert, AlertServiceType> {
|
|
|
123
123
|
messages: aiContext.messages,
|
|
124
124
|
maxTokens: 4096,
|
|
125
125
|
temperature: 0.2,
|
|
126
|
+
/*
|
|
127
|
+
* G8: the prompt embeds incident/alert/maintenance context whose read
|
|
128
|
+
* ACLs are narrower than LlmLog's — do not store previews.
|
|
129
|
+
*/
|
|
130
|
+
storeContentPreviews: false,
|
|
126
131
|
};
|
|
127
132
|
|
|
128
133
|
if (props.userId) {
|
|
@@ -231,6 +231,11 @@ export default class IncidentAPI extends BaseAPI<
|
|
|
231
231
|
messages: aiContext.messages,
|
|
232
232
|
maxTokens: 8192,
|
|
233
233
|
temperature: 0.2,
|
|
234
|
+
/*
|
|
235
|
+
* G8: the prompt embeds incident/alert/maintenance context whose read
|
|
236
|
+
* ACLs are narrower than LlmLog's — do not store previews.
|
|
237
|
+
*/
|
|
238
|
+
storeContentPreviews: false,
|
|
234
239
|
};
|
|
235
240
|
|
|
236
241
|
if (props.userId) {
|
|
@@ -348,6 +353,11 @@ export default class IncidentAPI extends BaseAPI<
|
|
|
348
353
|
messages: aiContext.messages,
|
|
349
354
|
maxTokens: 4096,
|
|
350
355
|
temperature: 0.2,
|
|
356
|
+
/*
|
|
357
|
+
* G8: the prompt embeds incident/alert/maintenance context whose read
|
|
358
|
+
* ACLs are narrower than LlmLog's — do not store previews.
|
|
359
|
+
*/
|
|
360
|
+
storeContentPreviews: false,
|
|
351
361
|
};
|
|
352
362
|
|
|
353
363
|
if (props.userId) {
|
|
@@ -134,6 +134,11 @@ export default class IncidentEpisodeAPI extends BaseAPI<
|
|
|
134
134
|
messages: aiContext.messages,
|
|
135
135
|
maxTokens: 8192,
|
|
136
136
|
temperature: 0.2,
|
|
137
|
+
/*
|
|
138
|
+
* G8: the prompt embeds incident/alert/maintenance context whose read
|
|
139
|
+
* ACLs are narrower than LlmLog's — do not store previews.
|
|
140
|
+
*/
|
|
141
|
+
storeContentPreviews: false,
|
|
137
142
|
};
|
|
138
143
|
|
|
139
144
|
if (props.userId) {
|
|
@@ -152,6 +152,7 @@ export default class LlmProviderAPI extends BaseAPI<
|
|
|
152
152
|
apiKey: true,
|
|
153
153
|
baseUrl: true,
|
|
154
154
|
modelName: true,
|
|
155
|
+
additionalParams: true,
|
|
155
156
|
},
|
|
156
157
|
props: {
|
|
157
158
|
isRoot: true,
|
|
@@ -191,6 +192,9 @@ export default class LlmProviderAPI extends BaseAPI<
|
|
|
191
192
|
temperature: 0,
|
|
192
193
|
maxTokens: 16,
|
|
193
194
|
llmProviderConfig: llmProviderConfig,
|
|
195
|
+
...(provider.additionalParams
|
|
196
|
+
? { additionalParams: provider.additionalParams }
|
|
197
|
+
: {}),
|
|
194
198
|
});
|
|
195
199
|
} catch (err) {
|
|
196
200
|
logger.error(err);
|
|
@@ -148,6 +148,11 @@ export default class ScheduledMaintenanceAPI extends BaseAPI<
|
|
|
148
148
|
messages: aiContext.messages,
|
|
149
149
|
maxTokens: 4096,
|
|
150
150
|
temperature: 0.2,
|
|
151
|
+
/*
|
|
152
|
+
* G8: the prompt embeds incident/alert/maintenance context whose read
|
|
153
|
+
* ACLs are narrower than LlmLog's — do not store previews.
|
|
154
|
+
*/
|
|
155
|
+
storeContentPreviews: false,
|
|
151
156
|
};
|
|
152
157
|
|
|
153
158
|
if (props.userId) {
|
|
@@ -404,9 +404,10 @@ router.post(
|
|
|
404
404
|
? (body["spanIds"] as Array<string>)
|
|
405
405
|
: undefined;
|
|
406
406
|
|
|
407
|
-
const attributes: Record<string, string
|
|
408
|
-
|
|
409
|
-
|
|
407
|
+
const attributes: Record<string, string | Array<string>> | undefined =
|
|
408
|
+
body["attributes"]
|
|
409
|
+
? (body["attributes"] as Record<string, string | Array<string>>)
|
|
410
|
+
: undefined;
|
|
410
411
|
|
|
411
412
|
const request: HistogramRequest = {
|
|
412
413
|
projectId: databaseProps.tenantId,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddAdditionalParamsToLlmProvider1783650000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddAdditionalParamsToLlmProvider1783650000000";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "LlmProvider" ADD "additionalParams" jsonb`,
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`ALTER TABLE "LlmProvider" DROP COLUMN "additionalParams"`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddCacheTokenColumnsToLlmLog1783695782697
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddCacheTokenColumnsToLlmLog1783695782697";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "LlmLog" ADD "cachedInputTokens" integer NOT NULL DEFAULT '0'`,
|
|
11
|
+
);
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`ALTER TABLE "LlmLog" ADD "cacheCreationTokens" integer NOT NULL DEFAULT '0'`,
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "LlmLog" DROP COLUMN "cacheCreationTokens"`,
|
|
20
|
+
);
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`ALTER TABLE "LlmLog" DROP COLUMN "cachedInputTokens"`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
package/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddAlertInvestigationGating1783701585317
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddAlertInvestigationGating1783701585317";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "Project" ADD "alertInvestigationMinimumSeverityId" uuid`,
|
|
11
|
+
);
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`ALTER TABLE "Project" ADD CONSTRAINT "FK_Project_alertInvestigationMinimumSeverityId" FOREIGN KEY ("alertInvestigationMinimumSeverityId") REFERENCES "AlertSeverity"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
14
|
+
);
|
|
15
|
+
await queryRunner.query(`ALTER TABLE "AIRun" ADD "monitorId" uuid`);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`CREATE INDEX "IDX_AIRun_monitorId" ON "AIRun" ("monitorId")`,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
22
|
+
await queryRunner.query(`DROP INDEX "IDX_AIRun_monitorId"`);
|
|
23
|
+
await queryRunner.query(`ALTER TABLE "AIRun" DROP COLUMN "monitorId"`);
|
|
24
|
+
await queryRunner.query(
|
|
25
|
+
`ALTER TABLE "Project" DROP CONSTRAINT "FK_Project_alertInvestigationMinimumSeverityId"`,
|
|
26
|
+
);
|
|
27
|
+
await queryRunner.query(
|
|
28
|
+
`ALTER TABLE "Project" DROP COLUMN "alertInvestigationMinimumSeverityId"`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddAiDailyAutonomousTokenLimitToProject1783702431535
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddAiDailyAutonomousTokenLimitToProject1783702431535";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "Project" ADD "aiDailyAutonomousTokenLimit" integer`,
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`ALTER TABLE "Project" DROP COLUMN "aiDailyAutonomousTokenLimit"`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
package/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddNetworkDeviceTables1783720000000 implements MigrationInterface {
|
|
4
|
+
public name = "AddNetworkDeviceTables1783720000000";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "NetworkDevice" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "name" character varying(100) NOT NULL, "slug" character varying(100) NOT NULL, "description" character varying(500), "hostname" character varying(100) NOT NULL, "probeId" uuid, "snmpVersion" character varying(100) DEFAULT '2c', "snmpCommunityString" character varying(100), "snmpPort" integer DEFAULT '161', "snmpV3Auth" jsonb, "sysDescr" character varying(500), "sysName" character varying(100), "lastSeenAt" TIMESTAMP WITH TIME ZONE, "interfacesTotal" integer DEFAULT '0', "interfacesUp" integer DEFAULT '0', "interfacesDown" integer DEFAULT '0', "createdByUserId" uuid, "isArchived" boolean NOT NULL DEFAULT false, "archivedAt" TIMESTAMP WITH TIME ZONE, "archivedByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_network_device_id" PRIMARY KEY ("_id"))`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE INDEX "IDX_network_device_projectId" ON "NetworkDevice" ("projectId")`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`CREATE INDEX "IDX_network_device_projectId_isArchived" ON "NetworkDevice" ("projectId", "isArchived")`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`CREATE INDEX "IDX_network_device_hostname" ON "NetworkDevice" ("hostname")`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`CREATE UNIQUE INDEX "IDX_network_device_slug" ON "NetworkDevice" ("slug")`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "NetworkDevice" ADD CONSTRAINT "FK_network_device_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "NetworkDevice" ADD CONSTRAINT "FK_network_device_probeId" FOREIGN KEY ("probeId") REFERENCES "Probe"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
27
|
+
);
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`ALTER TABLE "NetworkDevice" ADD CONSTRAINT "FK_network_device_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`ALTER TABLE "NetworkDevice" ADD CONSTRAINT "FK_network_device_archivedByUserId" FOREIGN KEY ("archivedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`ALTER TABLE "NetworkDevice" ADD CONSTRAINT "FK_network_device_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// Label join table
|
|
39
|
+
await queryRunner.query(
|
|
40
|
+
`CREATE TABLE "NetworkDeviceLabel" ("networkDeviceId" uuid NOT NULL, "labelId" uuid NOT NULL, CONSTRAINT "PK_network_device_label" PRIMARY KEY ("networkDeviceId", "labelId"))`,
|
|
41
|
+
);
|
|
42
|
+
await queryRunner.query(
|
|
43
|
+
`CREATE INDEX "IDX_network_device_label_networkDeviceId" ON "NetworkDeviceLabel" ("networkDeviceId")`,
|
|
44
|
+
);
|
|
45
|
+
await queryRunner.query(
|
|
46
|
+
`CREATE INDEX "IDX_network_device_label_labelId" ON "NetworkDeviceLabel" ("labelId")`,
|
|
47
|
+
);
|
|
48
|
+
await queryRunner.query(
|
|
49
|
+
`ALTER TABLE "NetworkDeviceLabel" ADD CONSTRAINT "FK_network_device_label_networkDeviceId" FOREIGN KEY ("networkDeviceId") REFERENCES "NetworkDevice"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
50
|
+
);
|
|
51
|
+
await queryRunner.query(
|
|
52
|
+
`ALTER TABLE "NetworkDeviceLabel" ADD CONSTRAINT "FK_network_device_label_labelId" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// Interfaces
|
|
56
|
+
await queryRunner.query(
|
|
57
|
+
`CREATE TABLE "NetworkInterface" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "networkDeviceId" uuid NOT NULL, "interfaceIndex" integer NOT NULL, "name" character varying(100) NOT NULL, "alias" character varying(100), "isMonitored" boolean NOT NULL DEFAULT true, "isOperationallyUp" boolean, "isAdministrativelyUp" boolean, "speedInMbps" decimal, "inRateMbps" decimal, "outRateMbps" decimal, "utilizationPercent" decimal, "errorsPerSecond" decimal, "lastSeenAt" TIMESTAMP WITH TIME ZONE, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_network_interface_id" PRIMARY KEY ("_id"))`,
|
|
58
|
+
);
|
|
59
|
+
await queryRunner.query(
|
|
60
|
+
`CREATE INDEX "IDX_network_interface_projectId" ON "NetworkInterface" ("projectId")`,
|
|
61
|
+
);
|
|
62
|
+
await queryRunner.query(
|
|
63
|
+
`CREATE INDEX "IDX_network_interface_networkDeviceId" ON "NetworkInterface" ("networkDeviceId")`,
|
|
64
|
+
);
|
|
65
|
+
await queryRunner.query(
|
|
66
|
+
`CREATE INDEX "IDX_network_interface_projectId_networkDeviceId" ON "NetworkInterface" ("projectId", "networkDeviceId")`,
|
|
67
|
+
);
|
|
68
|
+
/*
|
|
69
|
+
* The upsert path looks interfaces up by (device, ifIndex); enforce
|
|
70
|
+
* uniqueness at the DB level for soft-delete-aware rows.
|
|
71
|
+
*/
|
|
72
|
+
await queryRunner.query(
|
|
73
|
+
`CREATE UNIQUE INDEX "IDX_network_interface_device_ifindex" ON "NetworkInterface" ("networkDeviceId", "interfaceIndex") WHERE "deletedAt" IS NULL`,
|
|
74
|
+
);
|
|
75
|
+
await queryRunner.query(
|
|
76
|
+
`ALTER TABLE "NetworkInterface" ADD CONSTRAINT "FK_network_interface_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
77
|
+
);
|
|
78
|
+
await queryRunner.query(
|
|
79
|
+
`ALTER TABLE "NetworkInterface" ADD CONSTRAINT "FK_network_interface_networkDeviceId" FOREIGN KEY ("networkDeviceId") REFERENCES "NetworkDevice"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
80
|
+
);
|
|
81
|
+
await queryRunner.query(
|
|
82
|
+
`ALTER TABLE "NetworkInterface" ADD CONSTRAINT "FK_network_interface_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
83
|
+
);
|
|
84
|
+
await queryRunner.query(
|
|
85
|
+
`ALTER TABLE "NetworkInterface" ADD CONSTRAINT "FK_network_interface_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* SNMP monitor type retirement: the monitor type was replaced by
|
|
90
|
+
* Network Device monitors backed by NetworkDevice resources. The few
|
|
91
|
+
* existing SNMP monitors are soft-deleted (customers were notified);
|
|
92
|
+
* their rows remain recoverable but stop being scheduled or listed.
|
|
93
|
+
*/
|
|
94
|
+
await queryRunner.query(
|
|
95
|
+
`UPDATE "Monitor" SET "deletedAt" = now() WHERE "monitorType" = 'SNMP' AND "deletedAt" IS NULL`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
100
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "NetworkInterface"`);
|
|
101
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "NetworkDeviceLabel"`);
|
|
102
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "NetworkDevice"`);
|
|
103
|
+
// Soft-deleted SNMP monitors are not restored on rollback.
|
|
104
|
+
}
|
|
105
|
+
}
|