@oneuptime/common 10.0.53 → 10.0.54
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 +4 -2
- 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 +4 -2
- 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
package/Server/Utils/Logger.ts
CHANGED
|
@@ -7,6 +7,47 @@ import ConfigLogLevel from "../Types/ConfigLogLevel";
|
|
|
7
7
|
|
|
8
8
|
export type LogBody = string | JSONObject | Exception | Error | unknown;
|
|
9
9
|
|
|
10
|
+
export interface LogAttributes {
|
|
11
|
+
userId?: string | undefined;
|
|
12
|
+
projectId?: string | undefined;
|
|
13
|
+
requestId?: string | undefined;
|
|
14
|
+
[key: string]: string | number | boolean | undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface RequestLike {
|
|
18
|
+
requestId?: string;
|
|
19
|
+
tenantId?: { toString(): string };
|
|
20
|
+
userAuthorization?: { userId?: { toString(): string } };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getLogAttributesFromRequest(
|
|
24
|
+
req?: RequestLike | null,
|
|
25
|
+
): LogAttributes {
|
|
26
|
+
if (!req) {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const attributes: LogAttributes = {};
|
|
32
|
+
|
|
33
|
+
if (req.requestId) {
|
|
34
|
+
attributes.requestId = req.requestId;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (req.tenantId) {
|
|
38
|
+
attributes.projectId = req.tenantId.toString();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (req.userAuthorization?.userId) {
|
|
42
|
+
attributes.userId = req.userAuthorization.userId.toString();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return attributes;
|
|
46
|
+
} catch {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
10
51
|
export default class logger {
|
|
11
52
|
public static getLogLevel(): ConfigLogLevel {
|
|
12
53
|
if (!LogLevel) {
|
|
@@ -25,7 +66,31 @@ export default class logger {
|
|
|
25
66
|
return JSON.stringify(body);
|
|
26
67
|
}
|
|
27
68
|
|
|
28
|
-
|
|
69
|
+
private static sanitizeAttributes(
|
|
70
|
+
attributes?: LogAttributes,
|
|
71
|
+
): Record<string, string | number | boolean> | undefined {
|
|
72
|
+
if (!attributes) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const sanitized: Record<string, string | number | boolean> = {};
|
|
78
|
+
|
|
79
|
+
for (const key in attributes) {
|
|
80
|
+
const value: string | number | boolean | undefined = attributes[key];
|
|
81
|
+
|
|
82
|
+
if (value !== undefined && value !== null) {
|
|
83
|
+
sanitized[key] = value;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return Object.keys(sanitized).length > 0 ? sanitized : undefined;
|
|
88
|
+
} catch {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public static info(message: LogBody, attributes?: LogAttributes): void {
|
|
29
94
|
const logLevel: ConfigLogLevel = this.getLogLevel();
|
|
30
95
|
|
|
31
96
|
if (logLevel === ConfigLogLevel.DEBUG || logLevel === ConfigLogLevel.INFO) {
|
|
@@ -35,11 +100,12 @@ export default class logger {
|
|
|
35
100
|
this.emit({
|
|
36
101
|
body: message,
|
|
37
102
|
severityNumber: SeverityNumber.INFO,
|
|
103
|
+
attributes,
|
|
38
104
|
});
|
|
39
105
|
}
|
|
40
106
|
}
|
|
41
107
|
|
|
42
|
-
public static error(message: LogBody): void {
|
|
108
|
+
public static error(message: LogBody, attributes?: LogAttributes): void {
|
|
43
109
|
const logLevel: ConfigLogLevel = this.getLogLevel();
|
|
44
110
|
|
|
45
111
|
if (
|
|
@@ -54,11 +120,12 @@ export default class logger {
|
|
|
54
120
|
this.emit({
|
|
55
121
|
body: message,
|
|
56
122
|
severityNumber: SeverityNumber.ERROR,
|
|
123
|
+
attributes,
|
|
57
124
|
});
|
|
58
125
|
}
|
|
59
126
|
}
|
|
60
127
|
|
|
61
|
-
public static warn(message: LogBody): void {
|
|
128
|
+
public static warn(message: LogBody, attributes?: LogAttributes): void {
|
|
62
129
|
const logLevel: ConfigLogLevel = this.getLogLevel();
|
|
63
130
|
|
|
64
131
|
if (
|
|
@@ -72,11 +139,12 @@ export default class logger {
|
|
|
72
139
|
this.emit({
|
|
73
140
|
body: message,
|
|
74
141
|
severityNumber: SeverityNumber.WARN,
|
|
142
|
+
attributes,
|
|
75
143
|
});
|
|
76
144
|
}
|
|
77
145
|
}
|
|
78
146
|
|
|
79
|
-
public static debug(message: LogBody): void {
|
|
147
|
+
public static debug(message: LogBody, attributes?: LogAttributes): void {
|
|
80
148
|
const logLevel: ConfigLogLevel = this.getLogLevel();
|
|
81
149
|
|
|
82
150
|
if (logLevel === ConfigLogLevel.DEBUG) {
|
|
@@ -86,6 +154,7 @@ export default class logger {
|
|
|
86
154
|
this.emit({
|
|
87
155
|
body: message,
|
|
88
156
|
severityNumber: SeverityNumber.DEBUG,
|
|
157
|
+
attributes,
|
|
89
158
|
});
|
|
90
159
|
}
|
|
91
160
|
}
|
|
@@ -93,20 +162,30 @@ export default class logger {
|
|
|
93
162
|
public static emit(data: {
|
|
94
163
|
body: LogBody;
|
|
95
164
|
severityNumber: SeverityNumber;
|
|
165
|
+
attributes?: LogAttributes | undefined;
|
|
96
166
|
}): void {
|
|
97
|
-
|
|
167
|
+
try {
|
|
168
|
+
const logger: TelemetryLogger | null = OneUptimeTelemetry.getLogger();
|
|
98
169
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
170
|
+
if (logger === null) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
102
173
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
174
|
+
const sanitizedAttributes:
|
|
175
|
+
| Record<string, string | number | boolean>
|
|
176
|
+
| undefined = this.sanitizeAttributes(data.attributes);
|
|
177
|
+
|
|
178
|
+
logger.emit({
|
|
179
|
+
body: this.serializeLogBody(data.body),
|
|
180
|
+
severityNumber: data.severityNumber,
|
|
181
|
+
...(sanitizedAttributes ? { attributes: sanitizedAttributes } : {}),
|
|
182
|
+
});
|
|
183
|
+
} catch {
|
|
184
|
+
// Never let logging errors propagate
|
|
185
|
+
}
|
|
107
186
|
}
|
|
108
187
|
|
|
109
|
-
public static trace(message: LogBody): void {
|
|
188
|
+
public static trace(message: LogBody, attributes?: LogAttributes): void {
|
|
110
189
|
const logLevel: ConfigLogLevel = this.getLogLevel();
|
|
111
190
|
|
|
112
191
|
if (logLevel === ConfigLogLevel.DEBUG) {
|
|
@@ -116,6 +195,7 @@ export default class logger {
|
|
|
116
195
|
this.emit({
|
|
117
196
|
body: message,
|
|
118
197
|
severityNumber: SeverityNumber.DEBUG,
|
|
198
|
+
attributes,
|
|
119
199
|
});
|
|
120
200
|
}
|
|
121
201
|
}
|
|
@@ -17,7 +17,7 @@ import { DisableAutomaticAlertCreation } from "../../EnvironmentConfig";
|
|
|
17
17
|
import AlertService from "../../Services/AlertService";
|
|
18
18
|
import AlertSeverityService from "../../Services/AlertSeverityService";
|
|
19
19
|
import AlertStateTimelineService from "../../Services/AlertStateTimelineService";
|
|
20
|
-
import logger from "../Logger";
|
|
20
|
+
import logger, { LogAttributes } from "../Logger";
|
|
21
21
|
import CaptureSpan from "../Telemetry/CaptureSpan";
|
|
22
22
|
import DataToProcess from "./DataToProcess";
|
|
23
23
|
import MonitorTemplateUtil from "./MonitorTemplateUtil";
|
|
@@ -104,8 +104,15 @@ export default class MonitorAlert {
|
|
|
104
104
|
telemetryQuery?: TelemetryQuery | undefined;
|
|
105
105
|
};
|
|
106
106
|
}): Promise<void> {
|
|
107
|
+
const alertLogAttributes: LogAttributes = {
|
|
108
|
+
projectId: input.monitor.projectId?.toString(),
|
|
109
|
+
};
|
|
110
|
+
|
|
107
111
|
// check open alerts
|
|
108
|
-
logger.debug(
|
|
112
|
+
logger.debug(
|
|
113
|
+
`${input.monitor.id?.toString()} - Check open alerts.`,
|
|
114
|
+
alertLogAttributes,
|
|
115
|
+
);
|
|
109
116
|
// check active alerts and if there are open alerts, do not cretae anothr alert.
|
|
110
117
|
const openAlerts: Array<Alert> =
|
|
111
118
|
await this.checkOpenAlertsAndCloseIfResolved({
|
|
@@ -137,10 +144,12 @@ export default class MonitorAlert {
|
|
|
137
144
|
|
|
138
145
|
logger.debug(
|
|
139
146
|
`${input.monitor.id?.toString()} - Open Alert ${alreadyOpenAlert?.id?.toString()}`,
|
|
147
|
+
alertLogAttributes,
|
|
140
148
|
);
|
|
141
149
|
|
|
142
150
|
logger.debug(
|
|
143
151
|
`${input.monitor.id?.toString()} - Has open alert ${hasAlreadyOpenAlert}`,
|
|
152
|
+
alertLogAttributes,
|
|
144
153
|
);
|
|
145
154
|
|
|
146
155
|
if (hasAlreadyOpenAlert) {
|
|
@@ -161,7 +170,10 @@ export default class MonitorAlert {
|
|
|
161
170
|
|
|
162
171
|
// create alert here.
|
|
163
172
|
|
|
164
|
-
logger.debug(
|
|
173
|
+
logger.debug(
|
|
174
|
+
`${input.monitor.id?.toString()} - Create alert.`,
|
|
175
|
+
alertLogAttributes,
|
|
176
|
+
);
|
|
165
177
|
|
|
166
178
|
const alert: Alert = new Alert();
|
|
167
179
|
const storageMap: JSONObject =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import logger from "../Logger";
|
|
1
|
+
import logger, { LogAttributes } from "../Logger";
|
|
2
2
|
import LogAggregationService from "../../Services/LogAggregationService";
|
|
3
3
|
import VMUtil from "../VM/VMAPI";
|
|
4
4
|
import APIRequestCriteria from "./Criteria/APIRequestCriteria";
|
|
@@ -284,7 +284,9 @@ ${contextBlock}
|
|
|
284
284
|
.responseBody as string) || "{}",
|
|
285
285
|
);
|
|
286
286
|
} catch (err) {
|
|
287
|
-
logger.error(err
|
|
287
|
+
logger.error(err, {
|
|
288
|
+
projectId: input.monitor.projectId?.toString(),
|
|
289
|
+
});
|
|
288
290
|
responseBody = (input.dataToProcess as ProbeMonitorResponse)
|
|
289
291
|
.responseBody as JSONObject;
|
|
290
292
|
}
|
|
@@ -331,7 +333,9 @@ ${contextBlock}
|
|
|
331
333
|
},
|
|
332
334
|
});
|
|
333
335
|
} catch (err) {
|
|
334
|
-
logger.error(err
|
|
336
|
+
logger.error(err, {
|
|
337
|
+
projectId: input.monitor.projectId?.toString(),
|
|
338
|
+
});
|
|
335
339
|
return null;
|
|
336
340
|
}
|
|
337
341
|
|
|
@@ -903,8 +907,14 @@ ${contextBlock}
|
|
|
903
907
|
);
|
|
904
908
|
}
|
|
905
909
|
} catch (err) {
|
|
906
|
-
|
|
907
|
-
|
|
910
|
+
const k8sLogAttributes: LogAttributes = {
|
|
911
|
+
projectId: input.monitor.projectId?.toString(),
|
|
912
|
+
};
|
|
913
|
+
logger.error(
|
|
914
|
+
"Failed to fetch container logs for root cause context",
|
|
915
|
+
k8sLogAttributes,
|
|
916
|
+
);
|
|
917
|
+
logger.error(err, k8sLogAttributes);
|
|
908
918
|
}
|
|
909
919
|
}
|
|
910
920
|
}
|
|
@@ -19,7 +19,7 @@ import IncidentService from "../../Services/IncidentService";
|
|
|
19
19
|
import IncidentSeverityService from "../../Services/IncidentSeverityService";
|
|
20
20
|
import IncidentStateTimelineService from "../../Services/IncidentStateTimelineService";
|
|
21
21
|
import IncidentMemberService from "../../Services/IncidentMemberService";
|
|
22
|
-
import logger from "../Logger";
|
|
22
|
+
import logger, { LogAttributes } from "../Logger";
|
|
23
23
|
import CaptureSpan from "../Telemetry/CaptureSpan";
|
|
24
24
|
import DataToProcess from "./DataToProcess";
|
|
25
25
|
import MonitorTemplateUtil from "./MonitorTemplateUtil";
|
|
@@ -113,8 +113,15 @@ export default class MonitorIncident {
|
|
|
113
113
|
telemetryQuery?: TelemetryQuery | undefined;
|
|
114
114
|
};
|
|
115
115
|
}): Promise<void> {
|
|
116
|
+
const incidentLogAttributes: LogAttributes = {
|
|
117
|
+
projectId: input.monitor.projectId?.toString(),
|
|
118
|
+
};
|
|
119
|
+
|
|
116
120
|
// check open incidents
|
|
117
|
-
logger.debug(
|
|
121
|
+
logger.debug(
|
|
122
|
+
`${input.monitor.id?.toString()} - Check open incidents.`,
|
|
123
|
+
incidentLogAttributes,
|
|
124
|
+
);
|
|
118
125
|
// check active incidents and if there are open incidents, do not cretae anothr incident.
|
|
119
126
|
const openIncidents: Array<Incident> =
|
|
120
127
|
await this.checkOpenIncidentsAndCloseIfResolved({
|
|
@@ -149,10 +156,12 @@ export default class MonitorIncident {
|
|
|
149
156
|
|
|
150
157
|
logger.debug(
|
|
151
158
|
`${input.monitor.id?.toString()} - Open Incident ${alreadyOpenIncident?.id?.toString()}`,
|
|
159
|
+
incidentLogAttributes,
|
|
152
160
|
);
|
|
153
161
|
|
|
154
162
|
logger.debug(
|
|
155
163
|
`${input.monitor.id?.toString()} - Has open incident ${hasAlreadyOpenIncident}`,
|
|
164
|
+
incidentLogAttributes,
|
|
156
165
|
);
|
|
157
166
|
|
|
158
167
|
if (hasAlreadyOpenIncident) {
|
|
@@ -171,7 +180,10 @@ export default class MonitorIncident {
|
|
|
171
180
|
continue;
|
|
172
181
|
}
|
|
173
182
|
|
|
174
|
-
logger.debug(
|
|
183
|
+
logger.debug(
|
|
184
|
+
`${input.monitor.id?.toString()} - Create incident.`,
|
|
185
|
+
incidentLogAttributes,
|
|
186
|
+
);
|
|
175
187
|
|
|
176
188
|
const incident: Incident = new Incident();
|
|
177
189
|
const storageMap: JSONObject =
|
|
@@ -341,11 +353,13 @@ export default class MonitorIncident {
|
|
|
341
353
|
|
|
342
354
|
logger.debug(
|
|
343
355
|
`${input.monitor.id?.toString()} - Assigned incident member role ${assignment.roleId.toString()} to user ${assignment.userId.toString()}`,
|
|
356
|
+
incidentLogAttributes,
|
|
344
357
|
);
|
|
345
358
|
}
|
|
346
359
|
} catch (memberError) {
|
|
347
360
|
logger.error(
|
|
348
361
|
`${input.monitor.id?.toString()} - Failed to assign incident member role: ${memberError}`,
|
|
362
|
+
incidentLogAttributes,
|
|
349
363
|
);
|
|
350
364
|
}
|
|
351
365
|
}
|
|
@@ -6,7 +6,7 @@ import MonitorCriteriaInstance from "../../../Types/Monitor/MonitorCriteriaInsta
|
|
|
6
6
|
import ObjectID from "../../../Types/ObjectID";
|
|
7
7
|
import { TelemetryQuery } from "../../../Types/Telemetry/TelemetryQuery";
|
|
8
8
|
import MonitorStatusTimelineService from "../../Services/MonitorStatusTimelineService";
|
|
9
|
-
import logger from "../Logger";
|
|
9
|
+
import logger, { LogAttributes } from "../Logger";
|
|
10
10
|
import CaptureSpan from "../Telemetry/CaptureSpan";
|
|
11
11
|
import DataToProcess from "./DataToProcess";
|
|
12
12
|
|
|
@@ -71,8 +71,13 @@ export default class MonitorStatusTimelineUtil {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (shouldUpdateStatus) {
|
|
74
|
+
const monitorLogAttributes: LogAttributes = {
|
|
75
|
+
projectId: input.monitor.projectId?.toString(),
|
|
76
|
+
};
|
|
77
|
+
|
|
74
78
|
logger.debug(
|
|
75
79
|
`${input.monitor.id?.toString()} - Change monitor status to ${input.criteriaInstance.data?.monitorStatusId?.toString()}`,
|
|
80
|
+
monitorLogAttributes,
|
|
76
81
|
);
|
|
77
82
|
// change monitor status
|
|
78
83
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Pyroscope from "@pyroscope/nodejs";
|
|
2
2
|
import { EnableProfiling } from "../EnvironmentConfig";
|
|
3
|
-
import logger from "./Logger";
|
|
3
|
+
import logger, { LogAttributes } from "./Logger";
|
|
4
4
|
|
|
5
5
|
export default class Profiling {
|
|
6
6
|
public static init(data: { serviceName: string }): void {
|
|
@@ -11,9 +11,14 @@ export default class Profiling {
|
|
|
11
11
|
const serverAddress: string | undefined = this.getServerAddress();
|
|
12
12
|
const authToken: string | undefined = this.getAuthToken();
|
|
13
13
|
|
|
14
|
+
const profilingLogAttributes: LogAttributes = {
|
|
15
|
+
serviceName: data.serviceName,
|
|
16
|
+
};
|
|
17
|
+
|
|
14
18
|
if (!serverAddress) {
|
|
15
19
|
logger.warn(
|
|
16
20
|
"Profiling enabled but OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT not configured. Skipping profiling initialization.",
|
|
21
|
+
profilingLogAttributes,
|
|
17
22
|
);
|
|
18
23
|
return;
|
|
19
24
|
}
|
|
@@ -32,16 +37,17 @@ export default class Profiling {
|
|
|
32
37
|
|
|
33
38
|
logger.info(
|
|
34
39
|
`Profiling initialized for service: ${data.serviceName} -> ${serverAddress}`,
|
|
40
|
+
profilingLogAttributes,
|
|
35
41
|
);
|
|
36
42
|
} catch (err) {
|
|
37
|
-
logger.error("Failed to initialize profiling:");
|
|
38
|
-
logger.error(err);
|
|
43
|
+
logger.error("Failed to initialize profiling:", profilingLogAttributes);
|
|
44
|
+
logger.error(err, profilingLogAttributes);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
process.on("SIGTERM", () => {
|
|
42
48
|
Pyroscope.stop().catch((err: unknown) => {
|
|
43
|
-
logger.error("Error stopping profiler:");
|
|
44
|
-
logger.error(err);
|
|
49
|
+
logger.error("Error stopping profiler:", profilingLogAttributes);
|
|
50
|
+
logger.error(err, profilingLogAttributes);
|
|
45
51
|
});
|
|
46
52
|
});
|
|
47
53
|
}
|
package/Server/Utils/Realtime.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import IO, { Socket, SocketServer } from "../Infrastructure/SocketIO";
|
|
2
|
-
import logger from "./Logger";
|
|
2
|
+
import logger, { LogAttributes } from "./Logger";
|
|
3
3
|
import AnalyticsBaseModel from "../../Models/AnalyticsModels/AnalyticsBaseModel/AnalyticsBaseModel";
|
|
4
4
|
import BaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
5
5
|
import DatabaseType from "../../Types/BaseDatabase/DatabaseType";
|
|
@@ -49,20 +49,24 @@ export default abstract class Realtime {
|
|
|
49
49
|
logger.debug("Received ListenToModalEvent with data:");
|
|
50
50
|
logger.debug(data);
|
|
51
51
|
|
|
52
|
+
const socketLogAttributes: LogAttributes = {
|
|
53
|
+
projectId: data["tenantId"]?.toString(),
|
|
54
|
+
};
|
|
55
|
+
|
|
52
56
|
if (typeof data["eventType"] !== "string") {
|
|
53
|
-
logger.error("eventType is not a string");
|
|
57
|
+
logger.error("eventType is not a string", socketLogAttributes);
|
|
54
58
|
throw new BadDataException("eventType is not a string");
|
|
55
59
|
}
|
|
56
60
|
if (typeof data["modelType"] !== "string") {
|
|
57
|
-
logger.error("modelType is not a string");
|
|
61
|
+
logger.error("modelType is not a string", socketLogAttributes);
|
|
58
62
|
throw new BadDataException("modelType is not a string");
|
|
59
63
|
}
|
|
60
64
|
if (typeof data["modelName"] !== "string") {
|
|
61
|
-
logger.error("modelName is not a string");
|
|
65
|
+
logger.error("modelName is not a string", socketLogAttributes);
|
|
62
66
|
throw new BadDataException("modelName is not a string");
|
|
63
67
|
}
|
|
64
68
|
if (typeof data["tenantId"] !== "string") {
|
|
65
|
-
logger.error("tenantId is not a string");
|
|
69
|
+
logger.error("tenantId is not a string", socketLogAttributes);
|
|
66
70
|
throw new BadDataException("tenantId is not a string");
|
|
67
71
|
}
|
|
68
72
|
|
|
@@ -84,11 +88,18 @@ export default abstract class Realtime {
|
|
|
84
88
|
socket: Socket,
|
|
85
89
|
data: ListenToModelEventJSON,
|
|
86
90
|
): Promise<void> {
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
const listenLogAttributes: LogAttributes = {
|
|
92
|
+
projectId: data.tenantId?.toString(),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
logger.debug("Listening to model event with data:", listenLogAttributes);
|
|
96
|
+
logger.debug(data, listenLogAttributes);
|
|
89
97
|
|
|
90
98
|
if (!this.socketServer) {
|
|
91
|
-
logger.debug(
|
|
99
|
+
logger.debug(
|
|
100
|
+
"Socket server not initialized, initializing now",
|
|
101
|
+
listenLogAttributes,
|
|
102
|
+
);
|
|
92
103
|
await this.init();
|
|
93
104
|
}
|
|
94
105
|
|
|
@@ -97,42 +108,56 @@ export default abstract class Realtime {
|
|
|
97
108
|
* and to this model and to this event type
|
|
98
109
|
*/
|
|
99
110
|
|
|
100
|
-
logger.debug(
|
|
111
|
+
logger.debug(
|
|
112
|
+
"Extracting user access token from socket",
|
|
113
|
+
listenLogAttributes,
|
|
114
|
+
);
|
|
101
115
|
const userAccessToken: string | undefined =
|
|
102
116
|
this.getAccessTokenFromSocket(socket);
|
|
103
117
|
|
|
104
118
|
if (!userAccessToken) {
|
|
105
119
|
logger.debug(
|
|
106
120
|
"User access token not found in socket, aborting joining room",
|
|
121
|
+
listenLogAttributes,
|
|
107
122
|
);
|
|
108
123
|
return;
|
|
109
124
|
}
|
|
110
125
|
|
|
111
|
-
logger.debug("Decoding user access token");
|
|
126
|
+
logger.debug("Decoding user access token", listenLogAttributes);
|
|
112
127
|
const userAuthorizationData: JSONWebTokenData =
|
|
113
128
|
JSONWebToken.decode(userAccessToken);
|
|
114
129
|
|
|
115
130
|
if (!userAuthorizationData) {
|
|
116
131
|
logger.debug(
|
|
117
132
|
"User authorization data not found in socket, aborting joining room",
|
|
133
|
+
listenLogAttributes,
|
|
118
134
|
);
|
|
119
135
|
return;
|
|
120
136
|
}
|
|
121
137
|
|
|
122
138
|
if (!userAuthorizationData.userId) {
|
|
123
|
-
logger.debug(
|
|
139
|
+
logger.debug(
|
|
140
|
+
"User ID not found in socket, aborting joining room",
|
|
141
|
+
listenLogAttributes,
|
|
142
|
+
);
|
|
124
143
|
return;
|
|
125
144
|
}
|
|
126
145
|
|
|
127
|
-
logger.debug("Checking user access permissions");
|
|
146
|
+
logger.debug("Checking user access permissions", listenLogAttributes);
|
|
128
147
|
let hasAccess: boolean = false;
|
|
129
148
|
|
|
130
149
|
if (userAuthorizationData.isMasterAdmin) {
|
|
131
|
-
logger.debug(
|
|
150
|
+
logger.debug(
|
|
151
|
+
"User is a master admin, granting access",
|
|
152
|
+
listenLogAttributes,
|
|
153
|
+
);
|
|
132
154
|
hasAccess = true;
|
|
133
155
|
}
|
|
134
156
|
|
|
135
|
-
logger.debug(
|
|
157
|
+
logger.debug(
|
|
158
|
+
"Fetching user global access permissions",
|
|
159
|
+
listenLogAttributes,
|
|
160
|
+
);
|
|
136
161
|
const userGlobalAccessPermission: UserGlobalAccessPermission | null =
|
|
137
162
|
await UserPermissionUtil.getUserGlobalAccessPermissionFromCache(
|
|
138
163
|
userAuthorizationData.userId,
|
|
@@ -140,7 +165,10 @@ export default abstract class Realtime {
|
|
|
140
165
|
|
|
141
166
|
// check if the user has access to this tenant
|
|
142
167
|
if (userGlobalAccessPermission && !hasAccess) {
|
|
143
|
-
logger.debug(
|
|
168
|
+
logger.debug(
|
|
169
|
+
"Checking if user has access to the tenant",
|
|
170
|
+
listenLogAttributes,
|
|
171
|
+
);
|
|
144
172
|
const hasAccessToProjectId: boolean =
|
|
145
173
|
userGlobalAccessPermission.projectIds.some((projectId: ObjectID) => {
|
|
146
174
|
return projectId.toString() === data.tenantId.toString();
|
|
@@ -149,11 +177,15 @@ export default abstract class Realtime {
|
|
|
149
177
|
if (!hasAccessToProjectId) {
|
|
150
178
|
logger.debug(
|
|
151
179
|
"User does not have access to this tenant, aborting joining room",
|
|
180
|
+
listenLogAttributes,
|
|
152
181
|
);
|
|
153
182
|
return;
|
|
154
183
|
}
|
|
155
184
|
|
|
156
|
-
logger.debug(
|
|
185
|
+
logger.debug(
|
|
186
|
+
"User has access to the tenant, checking model access",
|
|
187
|
+
listenLogAttributes,
|
|
188
|
+
);
|
|
157
189
|
const userId: ObjectID = new ObjectID(
|
|
158
190
|
userAuthorizationData.userId.toString(),
|
|
159
191
|
);
|
|
@@ -174,7 +206,10 @@ export default abstract class Realtime {
|
|
|
174
206
|
data.modelName,
|
|
175
207
|
)
|
|
176
208
|
) {
|
|
177
|
-
logger.debug(
|
|
209
|
+
logger.debug(
|
|
210
|
+
"User has access to the model, granting access",
|
|
211
|
+
listenLogAttributes,
|
|
212
|
+
);
|
|
178
213
|
hasAccess = true;
|
|
179
214
|
}
|
|
180
215
|
}
|
|
@@ -182,6 +217,7 @@ export default abstract class Realtime {
|
|
|
182
217
|
if (!hasAccess) {
|
|
183
218
|
logger.debug(
|
|
184
219
|
"User does not have access to this tenant, aborting joining room",
|
|
220
|
+
listenLogAttributes,
|
|
185
221
|
);
|
|
186
222
|
return;
|
|
187
223
|
}
|
|
@@ -194,7 +230,7 @@ export default abstract class Realtime {
|
|
|
194
230
|
data.modelId,
|
|
195
231
|
);
|
|
196
232
|
|
|
197
|
-
logger.debug(`Joining room with ID: ${modelRoomId}
|
|
233
|
+
logger.debug(`Joining room with ID: ${modelRoomId}`, listenLogAttributes);
|
|
198
234
|
// join the room.
|
|
199
235
|
await socket.join(modelRoomId);
|
|
200
236
|
} else {
|
|
@@ -204,7 +240,7 @@ export default abstract class Realtime {
|
|
|
204
240
|
data.eventType,
|
|
205
241
|
);
|
|
206
242
|
|
|
207
|
-
logger.debug(`Joining room with ID: ${roomId}
|
|
243
|
+
logger.debug(`Joining room with ID: ${roomId}`, listenLogAttributes);
|
|
208
244
|
// join the room.
|
|
209
245
|
await socket.join(roomId);
|
|
210
246
|
}
|
|
@@ -215,11 +251,21 @@ export default abstract class Realtime {
|
|
|
215
251
|
socket: Socket,
|
|
216
252
|
data: ListenToModelEventJSON,
|
|
217
253
|
): Promise<void> {
|
|
218
|
-
|
|
219
|
-
|
|
254
|
+
const stopLogAttributes: LogAttributes = {
|
|
255
|
+
projectId: data.tenantId?.toString(),
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
logger.debug(
|
|
259
|
+
"Stopping listening to model event with data:",
|
|
260
|
+
stopLogAttributes,
|
|
261
|
+
);
|
|
262
|
+
logger.debug(data, stopLogAttributes);
|
|
220
263
|
|
|
221
264
|
if (!this.socketServer) {
|
|
222
|
-
logger.debug(
|
|
265
|
+
logger.debug(
|
|
266
|
+
"Socket server not initialized, initializing now",
|
|
267
|
+
stopLogAttributes,
|
|
268
|
+
);
|
|
223
269
|
await this.init();
|
|
224
270
|
}
|
|
225
271
|
|
|
@@ -230,7 +276,7 @@ export default abstract class Realtime {
|
|
|
230
276
|
data.modelId,
|
|
231
277
|
);
|
|
232
278
|
|
|
233
|
-
logger.debug(`Leaving room with ID: ${roomId}
|
|
279
|
+
logger.debug(`Leaving room with ID: ${roomId}`, stopLogAttributes);
|
|
234
280
|
// leave this room.
|
|
235
281
|
await socket.leave(roomId);
|
|
236
282
|
}
|
|
@@ -242,13 +288,20 @@ export default abstract class Realtime {
|
|
|
242
288
|
modelId: ObjectID;
|
|
243
289
|
modelType: { new (): BaseModel | AnalyticsBaseModel };
|
|
244
290
|
}): Promise<void> {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
291
|
+
const emitLogAttributes: LogAttributes = {
|
|
292
|
+
projectId: data.tenantId?.toString(),
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
logger.debug("Emitting model event with data:", emitLogAttributes);
|
|
296
|
+
logger.debug(`Tenant ID: ${data.tenantId}`, emitLogAttributes);
|
|
297
|
+
logger.debug(`Event Type: ${data.eventType}`, emitLogAttributes);
|
|
298
|
+
logger.debug(`Model ID: ${data.modelId}`, emitLogAttributes);
|
|
249
299
|
|
|
250
300
|
if (!this.socketServer) {
|
|
251
|
-
logger.debug(
|
|
301
|
+
logger.debug(
|
|
302
|
+
"Socket server not initialized, initializing now",
|
|
303
|
+
emitLogAttributes,
|
|
304
|
+
);
|
|
252
305
|
await this.init();
|
|
253
306
|
}
|
|
254
307
|
|
|
@@ -259,7 +312,10 @@ export default abstract class Realtime {
|
|
|
259
312
|
const model: BaseModel | AnalyticsBaseModel = new data.modelType();
|
|
260
313
|
|
|
261
314
|
if (!model.tableName) {
|
|
262
|
-
logger.warn(
|
|
315
|
+
logger.warn(
|
|
316
|
+
"Model does not have a tableName, aborting emit",
|
|
317
|
+
emitLogAttributes,
|
|
318
|
+
);
|
|
263
319
|
return;
|
|
264
320
|
}
|
|
265
321
|
|
|
@@ -276,8 +332,11 @@ export default abstract class Realtime {
|
|
|
276
332
|
data.modelId,
|
|
277
333
|
);
|
|
278
334
|
|
|
279
|
-
logger.debug(
|
|
280
|
-
|
|
335
|
+
logger.debug(
|
|
336
|
+
`Emitting event to room with ID: ${roomId}`,
|
|
337
|
+
emitLogAttributes,
|
|
338
|
+
);
|
|
339
|
+
logger.debug(jsonObject, emitLogAttributes);
|
|
281
340
|
|
|
282
341
|
this.socketServer!.to(roomId).emit(roomId, jsonObject);
|
|
283
342
|
this.socketServer!.to(modelRoomId).emit(modelRoomId, jsonObject);
|
package/Server/Utils/Response.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
OneUptimeResponse,
|
|
6
6
|
} from "./Express";
|
|
7
7
|
import JsonToCsv from "./JsonToCsv";
|
|
8
|
-
import logger from "./Logger";
|
|
8
|
+
import logger, { getLogAttributesFromRequest } from "./Logger";
|
|
9
9
|
import AnalyticsDataModel, {
|
|
10
10
|
AnalyticsBaseModelType,
|
|
11
11
|
} from "../../Models/AnalyticsModels/AnalyticsBaseModel/AnalyticsBaseModel";
|
|
@@ -109,7 +109,7 @@ export default class Response {
|
|
|
109
109
|
const status: number = error.code || 500;
|
|
110
110
|
const message: string = error.message || "Server Error";
|
|
111
111
|
|
|
112
|
-
logger.error(error);
|
|
112
|
+
logger.error(error, getLogAttributesFromRequest(_req as any));
|
|
113
113
|
|
|
114
114
|
oneUptimeResponse.status(status).send({ message });
|
|
115
115
|
}
|