@oneuptime/common 10.0.53 → 10.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/Metric.ts +78 -0
- package/Server/API/AIAgentDataAPI.ts +6 -1
- package/Server/API/BillingAPI.ts +28 -6
- package/Server/API/CommonAPI.ts +11 -0
- package/Server/API/DashboardAPI.ts +6 -2
- package/Server/API/DashboardDomainAPI.ts +10 -3
- package/Server/API/GitHubAPI.ts +58 -14
- package/Server/API/MicrosoftTeamsAPI.ts +97 -33
- package/Server/API/OpenSourceDeploymentAPI.ts +2 -2
- package/Server/API/SlackAPI.ts +107 -36
- package/Server/API/StatusAPI.ts +37 -16
- package/Server/API/StatusPageAPI.ts +97 -23
- package/Server/API/StatusPageDomainAPI.ts +6 -3
- package/Server/API/UserAPI.ts +3 -3
- package/Server/API/UserCallAPI.ts +5 -2
- package/Server/API/UserEmailAPI.ts +5 -2
- package/Server/API/UserPushAPI.ts +9 -3
- package/Server/API/UserSmsAPI.ts +5 -2
- package/Server/API/UserWhatsAppAPI.ts +5 -2
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.ts +47 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/NotificationMiddleware.ts +2 -2
- package/Server/Middleware/ProjectAuthorization.ts +6 -0
- package/Server/Middleware/SCIMAuthorization.ts +2 -1
- package/Server/Middleware/SlackAuthorization.ts +28 -10
- package/Server/Middleware/TelemetryIngest.ts +16 -3
- package/Server/Middleware/UserAuthorization.ts +22 -5
- package/Server/Middleware/WhatsAppAuthorization.ts +15 -4
- package/Server/Services/AIAgentService.ts +13 -6
- package/Server/Services/AIService.ts +9 -3
- package/Server/Services/AlertEpisodeFeedService.ts +17 -5
- package/Server/Services/AlertEpisodeService.ts +34 -3
- package/Server/Services/AlertEpisodeStateTimelineService.ts +80 -22
- package/Server/Services/AlertFeedService.ts +17 -5
- package/Server/Services/AlertGroupingEngineService.ts +36 -7
- package/Server/Services/AlertService.ts +60 -8
- package/Server/Services/AlertStateTimelineService.ts +29 -7
- package/Server/Services/AnalyticsDatabaseService.ts +59 -25
- package/Server/Services/BillingInvoiceService.ts +7 -3
- package/Server/Services/BillingService.ts +9 -2
- package/Server/Services/DashboardDomainService.ts +56 -22
- package/Server/Services/DashboardService.ts +11 -4
- package/Server/Services/DatabaseService.ts +31 -11
- package/Server/Services/IncidentEpisodeFeedService.ts +17 -5
- package/Server/Services/IncidentEpisodeService.ts +34 -3
- package/Server/Services/IncidentEpisodeStateTimelineService.ts +80 -22
- package/Server/Services/IncidentFeedService.ts +33 -9
- package/Server/Services/IncidentGroupingEngineService.ts +35 -6
- package/Server/Services/IncidentService.ts +103 -9
- package/Server/Services/IncidentSlaRuleService.ts +16 -4
- package/Server/Services/IncidentSlaService.ts +20 -4
- package/Server/Services/IncidentStateTimelineService.ts +120 -31
- package/Server/Services/KubernetesClusterService.ts +62 -14
- package/Server/Services/MonitorFeedService.ts +33 -9
- package/Server/Services/MonitorProbeService.ts +46 -23
- package/Server/Services/MonitorService.ts +35 -4
- package/Server/Services/MonitorStatusTimelineService.ts +68 -20
- package/Server/Services/NotificationService.ts +4 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +53 -9
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +9 -2
- package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +29 -8
- package/Server/Services/OnCallDutyPolicyFeedService.ts +33 -8
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +97 -24
- package/Server/Services/OnCallDutyPolicyService.ts +2 -1
- package/Server/Services/OpenTelemetryIngestService.ts +51 -20
- package/Server/Services/ProbeService.ts +16 -7
- package/Server/Services/ProjectService.ts +21 -7
- package/Server/Services/ScheduledMaintenanceFeedService.ts +17 -4
- package/Server/Services/ScheduledMaintenanceService.ts +52 -6
- package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +72 -20
- package/Server/Services/StatusPageDomainService.ts +59 -23
- package/Server/Services/StatusPageService.ts +26 -8
- package/Server/Services/StatusPageSubscriberService.ts +382 -111
- package/Server/Services/TeamMemberService.ts +9 -3
- package/Server/Services/UserNotificationRuleService.ts +9 -3
- package/Server/Services/UserService.ts +6 -4
- package/Server/Services/UserWhatsAppService.ts +9 -3
- package/Server/Services/WorkflowService.ts +7 -3
- package/Server/Services/WorkspaceNotificationRuleService.ts +398 -156
- package/Server/Types/Domain.ts +15 -5
- package/Server/Types/Workflow/Components/API/Post.ts +22 -8
- package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +12 -4
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +10 -0
- package/Server/Utils/CodeRepository/CodeRepository.ts +62 -13
- package/Server/Utils/Express.ts +1 -0
- package/Server/Utils/Greenlock/Greenlock.ts +75 -20
- package/Server/Utils/LLM/LLMService.ts +22 -7
- package/Server/Utils/Logger.ts +93 -13
- package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +15 -5
- package/Server/Utils/Monitor/MonitorIncident.ts +17 -3
- package/Server/Utils/Monitor/MonitorStatusTimeline.ts +6 -1
- package/Server/Utils/Profiling.ts +11 -5
- package/Server/Utils/Realtime.ts +90 -31
- package/Server/Utils/Response.ts +2 -2
- package/Server/Utils/StartServer.ts +43 -9
- package/Server/Utils/Telemetry/SpanUtil.ts +90 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +58 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +58 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +19 -3
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +87 -22
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.ts +12 -3
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.ts +25 -7
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +55 -8
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +100 -22
- package/Server/Utils/Workspace/Slack/Actions/Alert.ts +35 -9
- package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +32 -8
- package/Server/Utils/Workspace/Slack/Actions/Auth.ts +3 -1
- package/Server/Utils/Workspace/Slack/Actions/Incident.ts +52 -11
- package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +4 -1
- package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +89 -20
- package/Server/Utils/Workspace/Slack/Slack.ts +498 -247
- package/Server/Utils/Workspace/Workspace.ts +33 -11
- package/Server/Utils/Workspace/WorkspaceBase.ts +3 -1
- package/Server/Utils/Workspace/WorkspaceMessages/Alert.ts +8 -2
- package/Tests/Server/Middleware/UserAuthorization.test.ts +1 -1
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +12 -3
- package/UI/Components/Charts/Area/AreaChart.tsx +35 -1
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +7 -0
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +33 -0
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +33 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.ts +14 -0
- package/UI/Components/Charts/Line/LineChart.tsx +35 -1
- package/UI/Components/Charts/Types/ExemplarPoint.ts +6 -0
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +3 -3
- package/UI/Components/Navbar/NavBar.tsx +10 -0
- package/build/dist/Models/AnalyticsModels/Metric.js +70 -0
- package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
- package/build/dist/Server/API/AIAgentDataAPI.js +6 -6
- package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
- package/build/dist/Server/API/BillingAPI.js +13 -13
- package/build/dist/Server/API/BillingAPI.js.map +1 -1
- package/build/dist/Server/API/CommonAPI.js +5 -0
- package/build/dist/Server/API/CommonAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardAPI.js +2 -2
- package/build/dist/Server/API/DashboardAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardDomainAPI.js +3 -3
- package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
- package/build/dist/Server/API/GitHubAPI.js +19 -19
- package/build/dist/Server/API/GitHubAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +34 -34
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/OpenSourceDeploymentAPI.js +2 -2
- package/build/dist/Server/API/OpenSourceDeploymentAPI.js.map +1 -1
- package/build/dist/Server/API/SlackAPI.js +38 -38
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/StatusAPI.js +16 -16
- package/build/dist/Server/API/StatusAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +52 -52
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageDomainAPI.js +3 -3
- package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
- package/build/dist/Server/API/UserAPI.js +3 -3
- package/build/dist/Server/API/UserAPI.js.map +1 -1
- package/build/dist/Server/API/UserCallAPI.js +2 -2
- package/build/dist/Server/API/UserCallAPI.js.map +1 -1
- package/build/dist/Server/API/UserEmailAPI.js +2 -2
- package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
- package/build/dist/Server/API/UserPushAPI.js +3 -3
- package/build/dist/Server/API/UserPushAPI.js.map +1 -1
- package/build/dist/Server/API/UserSmsAPI.js +2 -2
- package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
- package/build/dist/Server/API/UserWhatsAppAPI.js +2 -2
- package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js +40 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/NotificationMiddleware.js +2 -2
- package/build/dist/Server/Middleware/NotificationMiddleware.js.map +1 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js +5 -0
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/SCIMAuthorization.js +2 -2
- package/build/dist/Server/Middleware/SCIMAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/SlackAuthorization.js +10 -10
- package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +9 -4
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +10 -5
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/WhatsAppAuthorization.js +6 -6
- package/build/dist/Server/Middleware/WhatsAppAuthorization.js.map +1 -1
- package/build/dist/Server/Services/AIAgentService.js +13 -7
- package/build/dist/Server/Services/AIAgentService.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +9 -2
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeFeedService.js +17 -5
- package/build/dist/Server/Services/AlertEpisodeFeedService.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeService.js +40 -10
- package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js +81 -24
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/AlertFeedService.js +17 -5
- package/build/dist/Server/Services/AlertFeedService.js.map +1 -1
- package/build/dist/Server/Services/AlertGroupingEngineService.js +44 -28
- package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -1
- package/build/dist/Server/Services/AlertService.js +72 -20
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/AlertStateTimelineService.js +36 -13
- package/build/dist/Server/Services/AlertStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +52 -28
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/BillingInvoiceService.js +7 -2
- package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
- package/build/dist/Server/Services/BillingService.js +8 -8
- package/build/dist/Server/Services/BillingService.js.map +1 -1
- package/build/dist/Server/Services/DashboardDomainService.js +49 -27
- package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
- package/build/dist/Server/Services/DashboardService.js +11 -4
- package/build/dist/Server/Services/DashboardService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +32 -12
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js +17 -5
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeService.js +40 -10
- package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +81 -24
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentFeedService.js +34 -10
- package/build/dist/Server/Services/IncidentFeedService.js.map +1 -1
- package/build/dist/Server/Services/IncidentGroupingEngineService.js +43 -29
- package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +116 -28
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentSlaRuleService.js +19 -11
- package/build/dist/Server/Services/IncidentSlaRuleService.js.map +1 -1
- package/build/dist/Server/Services/IncidentSlaService.js +21 -14
- package/build/dist/Server/Services/IncidentSlaService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +130 -37
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/KubernetesClusterService.js +51 -14
- package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
- package/build/dist/Server/Services/MonitorFeedService.js +34 -10
- package/build/dist/Server/Services/MonitorFeedService.js.map +1 -1
- package/build/dist/Server/Services/MonitorProbeService.js +32 -16
- package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +42 -11
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorStatusTimelineService.js +69 -21
- package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
- package/build/dist/Server/Services/NotificationService.js +4 -3
- package/build/dist/Server/Services/NotificationService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +49 -12
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +9 -3
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +26 -11
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js +34 -10
- package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +94 -37
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/OpenTelemetryIngestService.js +45 -17
- package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
- package/build/dist/Server/Services/ProbeService.js +13 -7
- package/build/dist/Server/Services/ProbeService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +33 -17
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js +17 -5
- package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +71 -24
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +72 -24
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageDomainService.js +55 -29
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +29 -9
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageSubscriberService.js +393 -130
- package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +10 -2
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +10 -2
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +8 -3
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/UserWhatsAppService.js +10 -2
- package/build/dist/Server/Services/UserWhatsAppService.js.map +1 -1
- package/build/dist/Server/Services/WorkflowService.js +7 -2
- package/build/dist/Server/Services/WorkflowService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +367 -180
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Types/Domain.js +12 -6
- package/build/dist/Server/Types/Domain.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Post.js +11 -7
- package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +11 -4
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +7 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/CodeRepository.js +45 -17
- package/build/dist/Server/Utils/CodeRepository/CodeRepository.js.map +1 -1
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +36 -29
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +18 -6
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Logger.js +61 -13
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +23 -20
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +13 -4
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -22
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js +6 -3
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js.map +1 -1
- package/build/dist/Server/Utils/Profiling.js +9 -6
- package/build/dist/Server/Utils/Profiling.js.map +1 -1
- package/build/dist/Server/Utils/Realtime.js +50 -34
- package/build/dist/Server/Utils/Realtime.js.map +1 -1
- package/build/dist/Server/Utils/Response.js +2 -2
- package/build/dist/Server/Utils/Response.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +23 -11
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js +52 -0
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +58 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +58 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +19 -5
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +90 -26
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js +12 -3
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js +25 -7
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +58 -19
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +102 -29
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +38 -9
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +34 -8
- package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +3 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +55 -13
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +5 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +91 -26
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +355 -270
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Workspace.js +21 -12
- package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +3 -1
- package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js +9 -2
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js.map +1 -1
- package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js +1 -1
- package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js +12 -6
- package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js.map +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +20 -2
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +2 -2
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +9 -2
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +9 -2
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +20 -2
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js +2 -0
- package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js.map +1 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +3 -3
- package/build/dist/UI/Components/Navbar/NavBar.js +9 -1
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ import IncidentStateTimeline from "../../Models/DatabaseModels/IncidentStateTime
|
|
|
24
24
|
import IncidentMember from "../../Models/DatabaseModels/IncidentMember";
|
|
25
25
|
import IncidentRole from "../../Models/DatabaseModels/IncidentRole";
|
|
26
26
|
import { IsBillingEnabled } from "../EnvironmentConfig";
|
|
27
|
-
import logger from "../Utils/Logger";
|
|
27
|
+
import logger, { LogAttributes } from "../Utils/Logger";
|
|
28
28
|
import IncidentFeedService from "./IncidentFeedService";
|
|
29
29
|
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
|
|
30
30
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
@@ -82,7 +82,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
82
82
|
namespace: "IncidentStateTimeline.create",
|
|
83
83
|
});
|
|
84
84
|
} catch (err) {
|
|
85
|
-
logger.error(err
|
|
85
|
+
logger.error(err, {
|
|
86
|
+
projectId: createBy.data.projectId?.toString(),
|
|
87
|
+
incidentId: createBy.data.incidentId?.toString(),
|
|
88
|
+
} as LogAttributes);
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
if (!createBy.data.startsAt) {
|
|
@@ -166,8 +169,14 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
166
169
|
}),
|
|
167
170
|
]);
|
|
168
171
|
|
|
169
|
-
logger.debug("State Before this"
|
|
170
|
-
|
|
172
|
+
logger.debug("State Before this", {
|
|
173
|
+
projectId: createBy.data.projectId?.toString(),
|
|
174
|
+
incidentId: createBy.data.incidentId?.toString(),
|
|
175
|
+
} as LogAttributes);
|
|
176
|
+
logger.debug(stateBeforeThis, {
|
|
177
|
+
projectId: createBy.data.projectId?.toString(),
|
|
178
|
+
incidentId: createBy.data.incidentId?.toString(),
|
|
179
|
+
} as LogAttributes);
|
|
171
180
|
|
|
172
181
|
// If this is the first state, then do not notify the owner.
|
|
173
182
|
if (!stateBeforeThis) {
|
|
@@ -246,8 +255,14 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
246
255
|
}
|
|
247
256
|
}
|
|
248
257
|
|
|
249
|
-
logger.debug("State After this"
|
|
250
|
-
|
|
258
|
+
logger.debug("State After this", {
|
|
259
|
+
projectId: createBy.data.projectId?.toString(),
|
|
260
|
+
incidentId: createBy.data.incidentId?.toString(),
|
|
261
|
+
} as LogAttributes);
|
|
262
|
+
logger.debug(stateAfterThis, {
|
|
263
|
+
projectId: createBy.data.projectId?.toString(),
|
|
264
|
+
incidentId: createBy.data.incidentId?.toString(),
|
|
265
|
+
} as LogAttributes);
|
|
251
266
|
|
|
252
267
|
const publicNote: string | undefined = (
|
|
253
268
|
createBy.miscDataProps as JSONObject | undefined
|
|
@@ -291,7 +306,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
291
306
|
try {
|
|
292
307
|
await Semaphore.release(mutex);
|
|
293
308
|
} catch (err) {
|
|
294
|
-
logger.error(err
|
|
309
|
+
logger.error(err, {
|
|
310
|
+
projectId: createBy.data.projectId?.toString(),
|
|
311
|
+
incidentId: createBy.data.incidentId?.toString(),
|
|
312
|
+
} as LogAttributes);
|
|
295
313
|
}
|
|
296
314
|
}
|
|
297
315
|
|
|
@@ -315,14 +333,32 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
315
333
|
}
|
|
316
334
|
// update the last status as ended.
|
|
317
335
|
|
|
318
|
-
logger.debug("Status Timeline Before this"
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
logger.debug(onCreate.carryForward.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
336
|
+
logger.debug("Status Timeline Before this", {
|
|
337
|
+
projectId: createdItem.projectId?.toString(),
|
|
338
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
339
|
+
} as LogAttributes);
|
|
340
|
+
logger.debug(onCreate.carryForward.statusTimelineBeforeThisStatus, {
|
|
341
|
+
projectId: createdItem.projectId?.toString(),
|
|
342
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
343
|
+
} as LogAttributes);
|
|
344
|
+
|
|
345
|
+
logger.debug("Status Timeline After this", {
|
|
346
|
+
projectId: createdItem.projectId?.toString(),
|
|
347
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
348
|
+
} as LogAttributes);
|
|
349
|
+
logger.debug(onCreate.carryForward.statusTimelineAfterThisStatus, {
|
|
350
|
+
projectId: createdItem.projectId?.toString(),
|
|
351
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
352
|
+
} as LogAttributes);
|
|
353
|
+
|
|
354
|
+
logger.debug("Created Item", {
|
|
355
|
+
projectId: createdItem.projectId?.toString(),
|
|
356
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
357
|
+
} as LogAttributes);
|
|
358
|
+
logger.debug(createdItem, {
|
|
359
|
+
projectId: createdItem.projectId?.toString(),
|
|
360
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
361
|
+
} as LogAttributes);
|
|
326
362
|
|
|
327
363
|
/*
|
|
328
364
|
* now there are three cases.
|
|
@@ -330,7 +366,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
330
366
|
*/
|
|
331
367
|
if (!onCreate.carryForward.statusTimelineBeforeThisStatus) {
|
|
332
368
|
// This is the first status, no need to update previous status.
|
|
333
|
-
logger.debug("This is the first status."
|
|
369
|
+
logger.debug("This is the first status.", {
|
|
370
|
+
projectId: createdItem.projectId?.toString(),
|
|
371
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
372
|
+
} as LogAttributes);
|
|
334
373
|
} else if (!onCreate.carryForward.statusTimelineAfterThisStatus) {
|
|
335
374
|
/*
|
|
336
375
|
* 2. This is the last status.
|
|
@@ -345,7 +384,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
345
384
|
isRoot: true,
|
|
346
385
|
},
|
|
347
386
|
});
|
|
348
|
-
logger.debug("This is the last status."
|
|
387
|
+
logger.debug("This is the last status.", {
|
|
388
|
+
projectId: createdItem.projectId?.toString(),
|
|
389
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
390
|
+
} as LogAttributes);
|
|
349
391
|
} else {
|
|
350
392
|
/*
|
|
351
393
|
* 3. This is in the middle.
|
|
@@ -371,7 +413,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
371
413
|
isRoot: true,
|
|
372
414
|
},
|
|
373
415
|
});
|
|
374
|
-
logger.debug("This status is in the middle."
|
|
416
|
+
logger.debug("This status is in the middle.", {
|
|
417
|
+
projectId: createdItem.projectId?.toString(),
|
|
418
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
419
|
+
} as LogAttributes);
|
|
375
420
|
}
|
|
376
421
|
|
|
377
422
|
if (!createdItem.endsAt) {
|
|
@@ -408,7 +453,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
|
|
408
453
|
try {
|
|
409
454
|
await Semaphore.release(mutex);
|
|
410
455
|
} catch (err) {
|
|
411
|
-
logger.error(err
|
|
456
|
+
logger.error(err, {
|
|
457
|
+
projectId: createdItem.projectId?.toString(),
|
|
458
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
459
|
+
} as LogAttributes);
|
|
412
460
|
}
|
|
413
461
|
}
|
|
414
462
|
|
|
@@ -469,8 +517,14 @@ ${createdItem.rootCause}`,
|
|
|
469
517
|
projectId: createdItem.projectId!,
|
|
470
518
|
userId: stateChangeUserId,
|
|
471
519
|
}).catch((error: Error) => {
|
|
472
|
-
logger.error(`Error while auto-assigning incident commander
|
|
473
|
-
|
|
520
|
+
logger.error(`Error while auto-assigning incident commander:`, {
|
|
521
|
+
projectId: createdItem.projectId?.toString(),
|
|
522
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
523
|
+
} as LogAttributes);
|
|
524
|
+
logger.error(error, {
|
|
525
|
+
projectId: createdItem.projectId?.toString(),
|
|
526
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
527
|
+
} as LogAttributes);
|
|
474
528
|
});
|
|
475
529
|
}
|
|
476
530
|
|
|
@@ -523,8 +577,14 @@ ${createdItem.rootCause}`,
|
|
|
523
577
|
IncidentService.refreshIncidentMetrics({
|
|
524
578
|
incidentId: createdItem.incidentId,
|
|
525
579
|
}).catch((error: Error) => {
|
|
526
|
-
logger.error(`Error while refreshing incident metrics
|
|
527
|
-
|
|
580
|
+
logger.error(`Error while refreshing incident metrics:`, {
|
|
581
|
+
projectId: createdItem.projectId?.toString(),
|
|
582
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
583
|
+
} as LogAttributes);
|
|
584
|
+
logger.error(error, {
|
|
585
|
+
projectId: createdItem.projectId?.toString(),
|
|
586
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
587
|
+
} as LogAttributes);
|
|
528
588
|
});
|
|
529
589
|
|
|
530
590
|
// Track SLA response/resolution times
|
|
@@ -538,8 +598,14 @@ ${createdItem.rootCause}`,
|
|
|
538
598
|
onCreate.carryForward.statusTimelineBeforeThisStatus?.incidentState
|
|
539
599
|
?.isResolvedState || false,
|
|
540
600
|
}).catch((error: Error) => {
|
|
541
|
-
logger.error(`Error while tracking SLA state change
|
|
542
|
-
|
|
601
|
+
logger.error(`Error while tracking SLA state change:`, {
|
|
602
|
+
projectId: createdItem.projectId?.toString(),
|
|
603
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
604
|
+
} as LogAttributes);
|
|
605
|
+
logger.error(error, {
|
|
606
|
+
projectId: createdItem.projectId?.toString(),
|
|
607
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
608
|
+
} as LogAttributes);
|
|
543
609
|
});
|
|
544
610
|
|
|
545
611
|
const isLastIncidentState: boolean = await this.isLastIncidentState({
|
|
@@ -563,8 +629,14 @@ ${createdItem.rootCause}`,
|
|
|
563
629
|
).toString()})** is resolved. Archiving channel.`,
|
|
564
630
|
},
|
|
565
631
|
}).catch((error: Error) => {
|
|
566
|
-
logger.error(`Error while archiving workspace channels
|
|
567
|
-
|
|
632
|
+
logger.error(`Error while archiving workspace channels:`, {
|
|
633
|
+
projectId: createdItem.projectId?.toString(),
|
|
634
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
635
|
+
} as LogAttributes);
|
|
636
|
+
logger.error(error, {
|
|
637
|
+
projectId: createdItem.projectId?.toString(),
|
|
638
|
+
incidentId: createdItem.incidentId?.toString(),
|
|
639
|
+
} as LogAttributes);
|
|
568
640
|
});
|
|
569
641
|
}
|
|
570
642
|
|
|
@@ -691,6 +763,10 @@ ${createdItem.rootCause}`,
|
|
|
691
763
|
|
|
692
764
|
logger.debug(
|
|
693
765
|
`Auto-assigned user ${data.userId.toString()} as Incident Commander for incident ${data.incidentId.toString()}`,
|
|
766
|
+
{
|
|
767
|
+
projectId: data.projectId?.toString(),
|
|
768
|
+
incidentId: data.incidentId?.toString(),
|
|
769
|
+
} as LogAttributes,
|
|
694
770
|
);
|
|
695
771
|
}
|
|
696
772
|
|
|
@@ -727,6 +803,10 @@ ${createdItem.rootCause}`,
|
|
|
727
803
|
|
|
728
804
|
logger.info(
|
|
729
805
|
`Created new SLA record for reopened incident ${data.incidentId}`,
|
|
806
|
+
{
|
|
807
|
+
projectId: data.projectId?.toString(),
|
|
808
|
+
incidentId: data.incidentId?.toString(),
|
|
809
|
+
} as LogAttributes,
|
|
730
810
|
);
|
|
731
811
|
}
|
|
732
812
|
|
|
@@ -749,7 +829,10 @@ ${createdItem.rootCause}`,
|
|
|
749
829
|
});
|
|
750
830
|
}
|
|
751
831
|
} catch (error) {
|
|
752
|
-
logger.error(`Error in trackSlaStateChange: ${error}
|
|
832
|
+
logger.error(`Error in trackSlaStateChange: ${error}`, {
|
|
833
|
+
projectId: data.projectId?.toString(),
|
|
834
|
+
incidentId: data.incidentId?.toString(),
|
|
835
|
+
} as LogAttributes);
|
|
753
836
|
throw error;
|
|
754
837
|
}
|
|
755
838
|
}
|
|
@@ -847,7 +930,9 @@ ${createdItem.rootCause}`,
|
|
|
847
930
|
|
|
848
931
|
if (!stateBeforeThis) {
|
|
849
932
|
// This is the first state, no need to update previous state.
|
|
850
|
-
logger.debug("This is the first state."
|
|
933
|
+
logger.debug("This is the first state.", {
|
|
934
|
+
incidentId: incidentId?.toString(),
|
|
935
|
+
} as LogAttributes);
|
|
851
936
|
} else if (!stateAfterThis) {
|
|
852
937
|
/*
|
|
853
938
|
* This is the last state.
|
|
@@ -862,7 +947,9 @@ ${createdItem.rootCause}`,
|
|
|
862
947
|
isRoot: true,
|
|
863
948
|
},
|
|
864
949
|
});
|
|
865
|
-
logger.debug("This is the last state."
|
|
950
|
+
logger.debug("This is the last state.", {
|
|
951
|
+
incidentId: incidentId?.toString(),
|
|
952
|
+
} as LogAttributes);
|
|
866
953
|
} else {
|
|
867
954
|
/*
|
|
868
955
|
* This state is in the middle.
|
|
@@ -888,7 +975,9 @@ ${createdItem.rootCause}`,
|
|
|
888
975
|
isRoot: true,
|
|
889
976
|
},
|
|
890
977
|
});
|
|
891
|
-
logger.debug("This state is in the middle."
|
|
978
|
+
logger.debug("This state is in the middle.", {
|
|
979
|
+
incidentId: incidentId?.toString(),
|
|
980
|
+
} as LogAttributes);
|
|
892
981
|
}
|
|
893
982
|
}
|
|
894
983
|
|
|
@@ -5,6 +5,10 @@ import ObjectID from "../../Types/ObjectID";
|
|
|
5
5
|
import QueryHelper from "../Types/Database/QueryHelper";
|
|
6
6
|
import OneUptimeDate from "../../Types/Date";
|
|
7
7
|
import LIMIT_MAX from "../../Types/Database/LimitMax";
|
|
8
|
+
import GlobalCache from "../Infrastructure/GlobalCache";
|
|
9
|
+
|
|
10
|
+
const LAST_SEEN_CACHE_NAMESPACE: string = "k8s-cluster-last-seen";
|
|
11
|
+
const LAST_SEEN_THROTTLE_SECONDS: number = 60;
|
|
8
12
|
|
|
9
13
|
export class Service extends DatabaseService<Model> {
|
|
10
14
|
public constructor() {
|
|
@@ -36,26 +40,70 @@ export class Service extends DatabaseService<Model> {
|
|
|
36
40
|
return existingCluster;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
try {
|
|
44
|
+
// Create new cluster
|
|
45
|
+
const newCluster: Model = new Model();
|
|
46
|
+
newCluster.projectId = data.projectId;
|
|
47
|
+
newCluster.name = data.clusterIdentifier;
|
|
48
|
+
newCluster.clusterIdentifier = data.clusterIdentifier;
|
|
49
|
+
newCluster.otelCollectorStatus = "connected";
|
|
50
|
+
newCluster.lastSeenAt = OneUptimeDate.getCurrentDate();
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const createdCluster: Model = await this.create({
|
|
53
|
+
data: newCluster,
|
|
54
|
+
props: {
|
|
55
|
+
isRoot: true,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return createdCluster;
|
|
60
|
+
} catch {
|
|
61
|
+
/*
|
|
62
|
+
* Race condition: another request created the cluster concurrently.
|
|
63
|
+
* Re-fetch the existing cluster.
|
|
64
|
+
*/
|
|
65
|
+
const reFetchedCluster: Model | null = await this.findOneBy({
|
|
66
|
+
query: {
|
|
67
|
+
projectId: data.projectId,
|
|
68
|
+
clusterIdentifier: data.clusterIdentifier,
|
|
69
|
+
},
|
|
70
|
+
select: {
|
|
71
|
+
_id: true,
|
|
72
|
+
projectId: true,
|
|
73
|
+
clusterIdentifier: true,
|
|
74
|
+
},
|
|
75
|
+
props: {
|
|
76
|
+
isRoot: true,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (reFetchedCluster) {
|
|
81
|
+
return reFetchedCluster;
|
|
82
|
+
}
|
|
53
83
|
|
|
54
|
-
|
|
84
|
+
throw new Error(
|
|
85
|
+
"Failed to create or find cluster: " + data.clusterIdentifier,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
55
88
|
}
|
|
56
89
|
|
|
57
90
|
@CaptureSpan()
|
|
58
91
|
public async updateLastSeen(clusterId: ObjectID): Promise<void> {
|
|
92
|
+
const cacheKey: string = clusterId.toString();
|
|
93
|
+
|
|
94
|
+
const cached: string | null = await GlobalCache.getString(
|
|
95
|
+
LAST_SEEN_CACHE_NAMESPACE,
|
|
96
|
+
cacheKey,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
if (cached) {
|
|
100
|
+
return; // another pod already updated recently
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
await GlobalCache.setString(LAST_SEEN_CACHE_NAMESPACE, cacheKey, "1", {
|
|
104
|
+
expiresInSeconds: LAST_SEEN_THROTTLE_SECONDS,
|
|
105
|
+
});
|
|
106
|
+
|
|
59
107
|
await this.updateOneById({
|
|
60
108
|
id: clusterId,
|
|
61
109
|
data: {
|
|
@@ -4,7 +4,7 @@ import OneUptimeDate from "../../Types/Date";
|
|
|
4
4
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
5
5
|
import ObjectID from "../../Types/ObjectID";
|
|
6
6
|
import { IsBillingEnabled } from "../EnvironmentConfig";
|
|
7
|
-
import logger from "../Utils/Logger";
|
|
7
|
+
import logger, { LogAttributes } from "../Utils/Logger";
|
|
8
8
|
import DatabaseService from "./DatabaseService";
|
|
9
9
|
import MonitorFeed, {
|
|
10
10
|
MonitorFeedEventType,
|
|
@@ -43,8 +43,14 @@ export class Service extends DatabaseService<MonitorFeed> {
|
|
|
43
43
|
| undefined;
|
|
44
44
|
}): Promise<void> {
|
|
45
45
|
try {
|
|
46
|
-
logger.debug("MonitorFeedService.createMonitorFeedItem"
|
|
47
|
-
|
|
46
|
+
logger.debug("MonitorFeedService.createMonitorFeedItem", {
|
|
47
|
+
projectId: data.projectId?.toString(),
|
|
48
|
+
monitorId: data.monitorId?.toString(),
|
|
49
|
+
} as LogAttributes);
|
|
50
|
+
logger.debug(data, {
|
|
51
|
+
projectId: data.projectId?.toString(),
|
|
52
|
+
monitorId: data.monitorId?.toString(),
|
|
53
|
+
} as LogAttributes);
|
|
48
54
|
|
|
49
55
|
const monitorFeed: MonitorFeed = new MonitorFeed();
|
|
50
56
|
|
|
@@ -93,8 +99,14 @@ export class Service extends DatabaseService<MonitorFeed> {
|
|
|
93
99
|
},
|
|
94
100
|
});
|
|
95
101
|
|
|
96
|
-
logger.debug("Monitor Feed created"
|
|
97
|
-
|
|
102
|
+
logger.debug("Monitor Feed created", {
|
|
103
|
+
projectId: data.projectId?.toString(),
|
|
104
|
+
monitorId: data.monitorId?.toString(),
|
|
105
|
+
} as LogAttributes);
|
|
106
|
+
logger.debug(createdMonitorFeed, {
|
|
107
|
+
projectId: data.projectId?.toString(),
|
|
108
|
+
monitorId: data.monitorId?.toString(),
|
|
109
|
+
} as LogAttributes);
|
|
98
110
|
|
|
99
111
|
try {
|
|
100
112
|
// send notification to slack and teams
|
|
@@ -110,14 +122,26 @@ export class Service extends DatabaseService<MonitorFeed> {
|
|
|
110
122
|
});
|
|
111
123
|
}
|
|
112
124
|
} catch (e) {
|
|
113
|
-
logger.error("Error in sending notification to slack and teams"
|
|
114
|
-
|
|
125
|
+
logger.error("Error in sending notification to slack and teams", {
|
|
126
|
+
projectId: data.projectId?.toString(),
|
|
127
|
+
monitorId: data.monitorId?.toString(),
|
|
128
|
+
} as LogAttributes);
|
|
129
|
+
logger.error(e, {
|
|
130
|
+
projectId: data.projectId?.toString(),
|
|
131
|
+
monitorId: data.monitorId?.toString(),
|
|
132
|
+
} as LogAttributes);
|
|
115
133
|
|
|
116
134
|
// we dont throw this error as it is not a critical error
|
|
117
135
|
}
|
|
118
136
|
} catch (e) {
|
|
119
|
-
logger.error("Error in creating monitor feed"
|
|
120
|
-
|
|
137
|
+
logger.error("Error in creating monitor feed", {
|
|
138
|
+
projectId: data.projectId?.toString(),
|
|
139
|
+
monitorId: data.monitorId?.toString(),
|
|
140
|
+
} as LogAttributes);
|
|
141
|
+
logger.error(e, {
|
|
142
|
+
projectId: data.projectId?.toString(),
|
|
143
|
+
monitorId: data.monitorId?.toString(),
|
|
144
|
+
} as LogAttributes);
|
|
121
145
|
|
|
122
146
|
// we dont throw this error as it is not a critical error
|
|
123
147
|
}
|
|
@@ -11,7 +11,7 @@ import { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
|
|
|
11
11
|
import MonitorService from "./MonitorService";
|
|
12
12
|
import { MonitorTypeHelper } from "../../Types/Monitor/MonitorType";
|
|
13
13
|
import CronTab from "../Utils/CronTab";
|
|
14
|
-
import logger from "../Utils/Logger";
|
|
14
|
+
import logger, { LogAttributes } from "../Utils/Logger";
|
|
15
15
|
|
|
16
16
|
export class Service extends DatabaseService<MonitorProbe> {
|
|
17
17
|
public constructor() {
|
|
@@ -54,7 +54,9 @@ export class Service extends DatabaseService<MonitorProbe> {
|
|
|
54
54
|
monitorProbe?.monitor?.monitoringInterval as string,
|
|
55
55
|
);
|
|
56
56
|
} catch (err) {
|
|
57
|
-
logger.error(err
|
|
57
|
+
logger.error(err, {
|
|
58
|
+
monitorId: data.monitorId?.toString(),
|
|
59
|
+
} as LogAttributes);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
if (nextPing && monitorProbe.id) {
|
|
@@ -92,13 +94,15 @@ export class Service extends DatabaseService<MonitorProbe> {
|
|
|
92
94
|
const claimedIds: Array<ObjectID> = await this.executeTransaction(
|
|
93
95
|
async (transactionalEntityManager: EntityManager) => {
|
|
94
96
|
/*
|
|
95
|
-
*
|
|
97
|
+
* Select and lock the monitor probes that need to be processed,
|
|
98
|
+
* including the monitoringInterval so we can compute the real nextPingAt
|
|
99
|
+
* in a single UPDATE (avoiding a second round-trip).
|
|
96
100
|
* FOR UPDATE SKIP LOCKED ensures that:
|
|
97
101
|
* 1. Rows are locked for this transaction
|
|
98
102
|
* 2. Rows already locked by other transactions are skipped
|
|
99
103
|
*/
|
|
100
104
|
const selectQuery: string = `
|
|
101
|
-
SELECT mp."_id"
|
|
105
|
+
SELECT mp."_id", m."monitoringInterval"
|
|
102
106
|
FROM "MonitorProbe" mp
|
|
103
107
|
INNER JOIN "Monitor" m ON mp."monitorId" = m."_id"
|
|
104
108
|
INNER JOIN "Project" p ON mp."projectId" = p."_id"
|
|
@@ -120,41 +124,60 @@ export class Service extends DatabaseService<MonitorProbe> {
|
|
|
120
124
|
FOR UPDATE OF mp SKIP LOCKED
|
|
121
125
|
`;
|
|
122
126
|
|
|
123
|
-
const selectedRows: Array<{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
const selectedRows: Array<{
|
|
128
|
+
_id: string;
|
|
129
|
+
monitoringInterval: string | null;
|
|
130
|
+
}> = await transactionalEntityManager.query(selectQuery, [
|
|
131
|
+
data.probeId.toString(),
|
|
132
|
+
currentDate,
|
|
133
|
+
data.limit,
|
|
134
|
+
]);
|
|
129
135
|
|
|
130
136
|
if (selectedRows.length === 0) {
|
|
131
137
|
return [];
|
|
132
138
|
}
|
|
133
139
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
/*
|
|
139
|
-
* Update the claimed monitors to set nextPingAt to 1 minute from now
|
|
140
|
-
* This is a temporary value; the actual nextPingAt will be calculated
|
|
141
|
-
* based on the monitor's interval after the probe fetches the full details
|
|
142
|
-
*/
|
|
143
|
-
const tempNextPingAt: Date = OneUptimeDate.addRemoveMinutes(
|
|
140
|
+
// Compute the real nextPingAt per monitor and batch-update in one query
|
|
141
|
+
const defaultNextPing: Date = OneUptimeDate.addRemoveMinutes(
|
|
144
142
|
currentDate,
|
|
145
143
|
1,
|
|
146
144
|
);
|
|
147
145
|
|
|
146
|
+
const ids: Array<string> = [];
|
|
147
|
+
const nextPingDates: Array<Date> = [];
|
|
148
|
+
const caseFragments: Array<string> = [];
|
|
149
|
+
|
|
150
|
+
for (let i: number = 0; i < selectedRows.length; i++) {
|
|
151
|
+
const row: { _id: string; monitoringInterval: string | null } =
|
|
152
|
+
selectedRows[i]!;
|
|
153
|
+
ids.push(row._id);
|
|
154
|
+
|
|
155
|
+
let nextPing: Date = defaultNextPing;
|
|
156
|
+
if (row.monitoringInterval) {
|
|
157
|
+
try {
|
|
158
|
+
nextPing = CronTab.getNextExecutionTime(row.monitoringInterval);
|
|
159
|
+
} catch {
|
|
160
|
+
// fall back to default 1 minute
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
nextPingDates.push(nextPing);
|
|
165
|
+
caseFragments.push(
|
|
166
|
+
`WHEN '${row._id}'::uuid THEN $${i + 3}::timestamptz`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
148
170
|
const updateQuery: string = `
|
|
149
171
|
UPDATE "MonitorProbe"
|
|
150
|
-
SET "lastPingAt" = $1,
|
|
151
|
-
|
|
172
|
+
SET "lastPingAt" = $1,
|
|
173
|
+
"nextPingAt" = CASE "_id" ${caseFragments.join(" ")} END
|
|
174
|
+
WHERE "_id" = ANY($2::uuid[])
|
|
152
175
|
`;
|
|
153
176
|
|
|
154
177
|
await transactionalEntityManager.query(updateQuery, [
|
|
155
178
|
currentDate,
|
|
156
|
-
tempNextPingAt,
|
|
157
179
|
ids,
|
|
180
|
+
...nextPingDates,
|
|
158
181
|
]);
|
|
159
182
|
|
|
160
183
|
return ids.map((id: string) => {
|
|
@@ -65,7 +65,7 @@ import MonitorFeedService from "./MonitorFeedService";
|
|
|
65
65
|
import { MonitorFeedEventType } from "../../Models/DatabaseModels/MonitorFeed";
|
|
66
66
|
import { Gray500, Green500 } from "../../Types/BrandColors";
|
|
67
67
|
import LabelService from "./LabelService";
|
|
68
|
-
import logger from "../Utils/Logger";
|
|
68
|
+
import logger, { LogAttributes } from "../Utils/Logger";
|
|
69
69
|
import PushNotificationUtil from "../Utils/PushNotificationUtil";
|
|
70
70
|
import ExceptionMessages from "../../Types/Exception/ExceptionMessages";
|
|
71
71
|
import Project from "../../Models/DatabaseModels/Project";
|
|
@@ -263,6 +263,10 @@ export class Service extends DatabaseService<Model> {
|
|
|
263
263
|
} catch (error) {
|
|
264
264
|
logger.error(
|
|
265
265
|
`Error while archiving workspace channels for monitor ${monitor.id?.toString()}: ${error}`,
|
|
266
|
+
{
|
|
267
|
+
projectId: monitor.projectId?.toString(),
|
|
268
|
+
monitorId: monitor.id?.toString(),
|
|
269
|
+
} as LogAttributes,
|
|
266
270
|
);
|
|
267
271
|
}
|
|
268
272
|
}
|
|
@@ -620,6 +624,10 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
620
624
|
} catch (error) {
|
|
621
625
|
logger.error(
|
|
622
626
|
"Workspace operations failed in MonitorService.onCreateSuccess",
|
|
627
|
+
{
|
|
628
|
+
projectId: createdItem.projectId?.toString(),
|
|
629
|
+
monitorId: createdItem.id?.toString(),
|
|
630
|
+
} as LogAttributes,
|
|
623
631
|
);
|
|
624
632
|
logger.error(error as Error);
|
|
625
633
|
return Promise.resolve();
|
|
@@ -639,6 +647,10 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
639
647
|
} catch (error) {
|
|
640
648
|
logger.error(
|
|
641
649
|
"Change monitor status failed in MonitorService.onCreateSuccess",
|
|
650
|
+
{
|
|
651
|
+
projectId: createdItem.projectId?.toString(),
|
|
652
|
+
monitorId: createdItem.id?.toString(),
|
|
653
|
+
} as LogAttributes,
|
|
642
654
|
);
|
|
643
655
|
logger.error(error as Error);
|
|
644
656
|
return Promise.resolve();
|
|
@@ -659,6 +671,10 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
659
671
|
} catch (error) {
|
|
660
672
|
logger.error(
|
|
661
673
|
"Add default probes failed in MonitorService.onCreateSuccess",
|
|
674
|
+
{
|
|
675
|
+
projectId: createdItem.projectId?.toString(),
|
|
676
|
+
monitorId: createdItem.id?.toString(),
|
|
677
|
+
} as LogAttributes,
|
|
662
678
|
);
|
|
663
679
|
logger.error(error as Error);
|
|
664
680
|
return Promise.resolve();
|
|
@@ -675,6 +691,10 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
675
691
|
} catch (error) {
|
|
676
692
|
logger.error(
|
|
677
693
|
"Billing operations failed in MonitorService.onCreateSuccess",
|
|
694
|
+
{
|
|
695
|
+
projectId: createdItem.projectId?.toString(),
|
|
696
|
+
monitorId: createdItem.id?.toString(),
|
|
697
|
+
} as LogAttributes,
|
|
678
698
|
);
|
|
679
699
|
logger.error(error as Error);
|
|
680
700
|
return Promise.resolve();
|
|
@@ -702,7 +722,10 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
702
722
|
}
|
|
703
723
|
return Promise.resolve();
|
|
704
724
|
} catch (error) {
|
|
705
|
-
logger.error("Add owners failed in MonitorService.onCreateSuccess"
|
|
725
|
+
logger.error("Add owners failed in MonitorService.onCreateSuccess", {
|
|
726
|
+
projectId: createdItem.projectId?.toString(),
|
|
727
|
+
monitorId: createdItem.id?.toString(),
|
|
728
|
+
} as LogAttributes);
|
|
706
729
|
logger.error(error as Error);
|
|
707
730
|
return Promise.resolve();
|
|
708
731
|
}
|
|
@@ -713,6 +736,10 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
713
736
|
} catch (error) {
|
|
714
737
|
logger.error(
|
|
715
738
|
"Refresh probe status failed in MonitorService.onCreateSuccess",
|
|
739
|
+
{
|
|
740
|
+
projectId: createdItem.projectId?.toString(),
|
|
741
|
+
monitorId: createdItem.id?.toString(),
|
|
742
|
+
} as LogAttributes,
|
|
716
743
|
);
|
|
717
744
|
logger.error(error as Error);
|
|
718
745
|
return Promise.resolve();
|
|
@@ -721,6 +748,10 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
721
748
|
.catch((error: Error) => {
|
|
722
749
|
logger.error(
|
|
723
750
|
`Critical error in MonitorService sequential operations: ${error}`,
|
|
751
|
+
{
|
|
752
|
+
projectId: createdItem.projectId?.toString(),
|
|
753
|
+
monitorId: createdItem.id?.toString(),
|
|
754
|
+
} as LogAttributes,
|
|
724
755
|
);
|
|
725
756
|
});
|
|
726
757
|
|
|
@@ -1287,7 +1318,7 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
1287
1318
|
const emailMessage: EmailEnvelope = {
|
|
1288
1319
|
templateType: EmailTemplateType.MonitorProbesStatus,
|
|
1289
1320
|
vars: vars,
|
|
1290
|
-
subject: `[
|
|
1321
|
+
subject: `[${enabledStatus} Monitor Probes] ${monitor.name!}`,
|
|
1291
1322
|
};
|
|
1292
1323
|
|
|
1293
1324
|
const sms: SMSMessage = {
|
|
@@ -1417,7 +1448,7 @@ ${createdItem.description?.trim() || "No description provided."}
|
|
|
1417
1448
|
const emailMessage: EmailEnvelope = {
|
|
1418
1449
|
templateType: EmailTemplateType.MonitorProbesStatus,
|
|
1419
1450
|
vars: vars,
|
|
1420
|
-
subject: `[
|
|
1451
|
+
subject: `[${status} Monitor Probes] ${monitor.name!}`,
|
|
1421
1452
|
};
|
|
1422
1453
|
|
|
1423
1454
|
const sms: SMSMessage = {
|