@oneuptime/common 10.0.52 → 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.
Files changed (405) hide show
  1. package/Models/AnalyticsModels/Metric.ts +78 -0
  2. package/Server/API/AIAgentDataAPI.ts +6 -1
  3. package/Server/API/BillingAPI.ts +28 -6
  4. package/Server/API/CommonAPI.ts +11 -0
  5. package/Server/API/DashboardAPI.ts +6 -2
  6. package/Server/API/DashboardDomainAPI.ts +10 -3
  7. package/Server/API/GitHubAPI.ts +58 -14
  8. package/Server/API/MicrosoftTeamsAPI.ts +97 -33
  9. package/Server/API/OpenSourceDeploymentAPI.ts +2 -2
  10. package/Server/API/SlackAPI.ts +107 -36
  11. package/Server/API/StatusAPI.ts +37 -16
  12. package/Server/API/StatusPageAPI.ts +97 -23
  13. package/Server/API/StatusPageDomainAPI.ts +6 -3
  14. package/Server/API/TelemetryAPI.ts +81 -0
  15. package/Server/API/UserAPI.ts +3 -3
  16. package/Server/API/UserCallAPI.ts +5 -2
  17. package/Server/API/UserEmailAPI.ts +5 -2
  18. package/Server/API/UserPushAPI.ts +9 -3
  19. package/Server/API/UserSmsAPI.ts +5 -2
  20. package/Server/API/UserWhatsAppAPI.ts +5 -2
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.ts +47 -0
  22. package/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.ts +35 -0
  23. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  24. package/Server/Middleware/NotificationMiddleware.ts +2 -2
  25. package/Server/Middleware/ProjectAuthorization.ts +6 -0
  26. package/Server/Middleware/SCIMAuthorization.ts +2 -1
  27. package/Server/Middleware/SlackAuthorization.ts +28 -10
  28. package/Server/Middleware/TelemetryIngest.ts +16 -3
  29. package/Server/Middleware/UserAuthorization.ts +22 -5
  30. package/Server/Middleware/WhatsAppAuthorization.ts +15 -4
  31. package/Server/Services/AIAgentService.ts +13 -6
  32. package/Server/Services/AIService.ts +9 -3
  33. package/Server/Services/AlertEpisodeFeedService.ts +17 -5
  34. package/Server/Services/AlertEpisodeService.ts +34 -3
  35. package/Server/Services/AlertEpisodeStateTimelineService.ts +80 -22
  36. package/Server/Services/AlertFeedService.ts +17 -5
  37. package/Server/Services/AlertGroupingEngineService.ts +36 -7
  38. package/Server/Services/AlertService.ts +60 -8
  39. package/Server/Services/AlertStateTimelineService.ts +29 -7
  40. package/Server/Services/AnalyticsDatabaseService.ts +59 -25
  41. package/Server/Services/BillingInvoiceService.ts +7 -3
  42. package/Server/Services/BillingService.ts +9 -2
  43. package/Server/Services/DashboardDomainService.ts +56 -22
  44. package/Server/Services/DashboardService.ts +11 -4
  45. package/Server/Services/DatabaseService.ts +31 -11
  46. package/Server/Services/IncidentEpisodeFeedService.ts +17 -5
  47. package/Server/Services/IncidentEpisodeService.ts +34 -3
  48. package/Server/Services/IncidentEpisodeStateTimelineService.ts +80 -22
  49. package/Server/Services/IncidentFeedService.ts +33 -9
  50. package/Server/Services/IncidentGroupingEngineService.ts +35 -6
  51. package/Server/Services/IncidentService.ts +103 -9
  52. package/Server/Services/IncidentSlaRuleService.ts +16 -4
  53. package/Server/Services/IncidentSlaService.ts +20 -4
  54. package/Server/Services/IncidentStateTimelineService.ts +120 -31
  55. package/Server/Services/KubernetesClusterService.ts +62 -14
  56. package/Server/Services/LabelService.ts +14 -1
  57. package/Server/Services/MonitorFeedService.ts +33 -9
  58. package/Server/Services/MonitorProbeService.ts +31 -2
  59. package/Server/Services/MonitorService.ts +35 -4
  60. package/Server/Services/MonitorStatusTimelineService.ts +68 -20
  61. package/Server/Services/NotificationService.ts +4 -2
  62. package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +53 -9
  63. package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +9 -2
  64. package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +29 -8
  65. package/Server/Services/OnCallDutyPolicyFeedService.ts +33 -8
  66. package/Server/Services/OnCallDutyPolicyScheduleService.ts +97 -24
  67. package/Server/Services/OnCallDutyPolicyService.ts +2 -1
  68. package/Server/Services/OpenTelemetryIngestService.ts +51 -20
  69. package/Server/Services/ProbeService.ts +16 -7
  70. package/Server/Services/ProjectService.ts +29 -11
  71. package/Server/Services/ScheduledMaintenanceFeedService.ts +17 -4
  72. package/Server/Services/ScheduledMaintenanceService.ts +52 -6
  73. package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +72 -20
  74. package/Server/Services/StatusPageDomainService.ts +59 -23
  75. package/Server/Services/StatusPageService.ts +26 -8
  76. package/Server/Services/StatusPageSubscriberService.ts +382 -111
  77. package/Server/Services/TeamMemberService.ts +9 -3
  78. package/Server/Services/TelemetryAttributeService.ts +117 -4
  79. package/Server/Services/UserNotificationRuleService.ts +9 -3
  80. package/Server/Services/UserService.ts +6 -4
  81. package/Server/Services/UserWhatsAppService.ts +9 -3
  82. package/Server/Services/WorkflowService.ts +7 -3
  83. package/Server/Services/WorkspaceNotificationRuleService.ts +398 -156
  84. package/Server/Types/Domain.ts +15 -5
  85. package/Server/Types/Workflow/Components/API/Post.ts +22 -8
  86. package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +12 -4
  87. package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +10 -0
  88. package/Server/Utils/CodeRepository/CodeRepository.ts +62 -13
  89. package/Server/Utils/Express.ts +1 -0
  90. package/Server/Utils/Greenlock/Greenlock.ts +75 -20
  91. package/Server/Utils/LLM/LLMService.ts +22 -7
  92. package/Server/Utils/Logger.ts +93 -13
  93. package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
  94. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +15 -5
  95. package/Server/Utils/Monitor/MonitorIncident.ts +17 -3
  96. package/Server/Utils/Monitor/MonitorStatusTimeline.ts +6 -1
  97. package/Server/Utils/Profiling.ts +11 -5
  98. package/Server/Utils/Realtime.ts +90 -31
  99. package/Server/Utils/Response.ts +2 -2
  100. package/Server/Utils/StartServer.ts +43 -9
  101. package/Server/Utils/Telemetry/SpanUtil.ts +90 -0
  102. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +58 -15
  103. package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +58 -15
  104. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +19 -3
  105. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +87 -22
  106. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.ts +12 -3
  107. package/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.ts +25 -7
  108. package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +55 -8
  109. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +100 -22
  110. package/Server/Utils/Workspace/Slack/Actions/Alert.ts +35 -9
  111. package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +32 -8
  112. package/Server/Utils/Workspace/Slack/Actions/Auth.ts +3 -1
  113. package/Server/Utils/Workspace/Slack/Actions/Incident.ts +52 -11
  114. package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +4 -1
  115. package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +89 -20
  116. package/Server/Utils/Workspace/Slack/Slack.ts +498 -247
  117. package/Server/Utils/Workspace/Workspace.ts +33 -11
  118. package/Server/Utils/Workspace/WorkspaceBase.ts +3 -1
  119. package/Server/Utils/Workspace/WorkspaceMessages/Alert.ts +8 -2
  120. package/Tests/Server/Middleware/UserAuthorization.test.ts +1 -1
  121. package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +12 -3
  122. package/UI/Components/BulkUpdate/BulkUpdateForm.tsx +60 -38
  123. package/UI/Components/Charts/Area/AreaChart.tsx +35 -1
  124. package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +7 -0
  125. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +33 -0
  126. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +33 -0
  127. package/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.ts +14 -0
  128. package/UI/Components/Charts/Line/LineChart.tsx +35 -1
  129. package/UI/Components/Charts/Types/ExemplarPoint.ts +6 -0
  130. package/UI/Components/Dictionary/Dictionary.tsx +13 -1
  131. package/UI/Components/Filters/FiltersForm.tsx +2 -0
  132. package/UI/Components/Filters/JSONFilter.tsx +5 -1
  133. package/UI/Components/Filters/Types/Filter.ts +2 -0
  134. package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +3 -3
  135. package/UI/Components/ModelTable/BaseModelTable.tsx +10 -6
  136. package/UI/Components/Navbar/NavBar.tsx +10 -0
  137. package/build/dist/Models/AnalyticsModels/Metric.js +70 -0
  138. package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
  139. package/build/dist/Server/API/AIAgentDataAPI.js +6 -6
  140. package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
  141. package/build/dist/Server/API/BillingAPI.js +13 -13
  142. package/build/dist/Server/API/BillingAPI.js.map +1 -1
  143. package/build/dist/Server/API/CommonAPI.js +5 -0
  144. package/build/dist/Server/API/CommonAPI.js.map +1 -1
  145. package/build/dist/Server/API/DashboardAPI.js +2 -2
  146. package/build/dist/Server/API/DashboardAPI.js.map +1 -1
  147. package/build/dist/Server/API/DashboardDomainAPI.js +3 -3
  148. package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
  149. package/build/dist/Server/API/GitHubAPI.js +19 -19
  150. package/build/dist/Server/API/GitHubAPI.js.map +1 -1
  151. package/build/dist/Server/API/MicrosoftTeamsAPI.js +34 -34
  152. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  153. package/build/dist/Server/API/OpenSourceDeploymentAPI.js +2 -2
  154. package/build/dist/Server/API/OpenSourceDeploymentAPI.js.map +1 -1
  155. package/build/dist/Server/API/SlackAPI.js +38 -38
  156. package/build/dist/Server/API/SlackAPI.js.map +1 -1
  157. package/build/dist/Server/API/StatusAPI.js +16 -16
  158. package/build/dist/Server/API/StatusAPI.js.map +1 -1
  159. package/build/dist/Server/API/StatusPageAPI.js +52 -52
  160. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  161. package/build/dist/Server/API/StatusPageDomainAPI.js +3 -3
  162. package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
  163. package/build/dist/Server/API/TelemetryAPI.js +39 -0
  164. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  165. package/build/dist/Server/API/UserAPI.js +3 -3
  166. package/build/dist/Server/API/UserAPI.js.map +1 -1
  167. package/build/dist/Server/API/UserCallAPI.js +2 -2
  168. package/build/dist/Server/API/UserCallAPI.js.map +1 -1
  169. package/build/dist/Server/API/UserEmailAPI.js +2 -2
  170. package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
  171. package/build/dist/Server/API/UserPushAPI.js +3 -3
  172. package/build/dist/Server/API/UserPushAPI.js.map +1 -1
  173. package/build/dist/Server/API/UserSmsAPI.js +2 -2
  174. package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
  175. package/build/dist/Server/API/UserWhatsAppAPI.js +2 -2
  176. package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -1
  177. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js +40 -0
  178. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js.map +1 -0
  179. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js +18 -0
  180. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js.map +1 -0
  181. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  182. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  183. package/build/dist/Server/Middleware/NotificationMiddleware.js +2 -2
  184. package/build/dist/Server/Middleware/NotificationMiddleware.js.map +1 -1
  185. package/build/dist/Server/Middleware/ProjectAuthorization.js +5 -0
  186. package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
  187. package/build/dist/Server/Middleware/SCIMAuthorization.js +2 -2
  188. package/build/dist/Server/Middleware/SCIMAuthorization.js.map +1 -1
  189. package/build/dist/Server/Middleware/SlackAuthorization.js +10 -10
  190. package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -1
  191. package/build/dist/Server/Middleware/TelemetryIngest.js +9 -4
  192. package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
  193. package/build/dist/Server/Middleware/UserAuthorization.js +10 -5
  194. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  195. package/build/dist/Server/Middleware/WhatsAppAuthorization.js +6 -6
  196. package/build/dist/Server/Middleware/WhatsAppAuthorization.js.map +1 -1
  197. package/build/dist/Server/Services/AIAgentService.js +13 -7
  198. package/build/dist/Server/Services/AIAgentService.js.map +1 -1
  199. package/build/dist/Server/Services/AIService.js +9 -2
  200. package/build/dist/Server/Services/AIService.js.map +1 -1
  201. package/build/dist/Server/Services/AlertEpisodeFeedService.js +17 -5
  202. package/build/dist/Server/Services/AlertEpisodeFeedService.js.map +1 -1
  203. package/build/dist/Server/Services/AlertEpisodeService.js +40 -10
  204. package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
  205. package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js +81 -24
  206. package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js.map +1 -1
  207. package/build/dist/Server/Services/AlertFeedService.js +17 -5
  208. package/build/dist/Server/Services/AlertFeedService.js.map +1 -1
  209. package/build/dist/Server/Services/AlertGroupingEngineService.js +44 -28
  210. package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -1
  211. package/build/dist/Server/Services/AlertService.js +72 -20
  212. package/build/dist/Server/Services/AlertService.js.map +1 -1
  213. package/build/dist/Server/Services/AlertStateTimelineService.js +36 -13
  214. package/build/dist/Server/Services/AlertStateTimelineService.js.map +1 -1
  215. package/build/dist/Server/Services/AnalyticsDatabaseService.js +52 -28
  216. package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
  217. package/build/dist/Server/Services/BillingInvoiceService.js +7 -2
  218. package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
  219. package/build/dist/Server/Services/BillingService.js +8 -8
  220. package/build/dist/Server/Services/BillingService.js.map +1 -1
  221. package/build/dist/Server/Services/DashboardDomainService.js +49 -27
  222. package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
  223. package/build/dist/Server/Services/DashboardService.js +11 -4
  224. package/build/dist/Server/Services/DashboardService.js.map +1 -1
  225. package/build/dist/Server/Services/DatabaseService.js +32 -12
  226. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  227. package/build/dist/Server/Services/IncidentEpisodeFeedService.js +17 -5
  228. package/build/dist/Server/Services/IncidentEpisodeFeedService.js.map +1 -1
  229. package/build/dist/Server/Services/IncidentEpisodeService.js +40 -10
  230. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  231. package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +81 -24
  232. package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -1
  233. package/build/dist/Server/Services/IncidentFeedService.js +34 -10
  234. package/build/dist/Server/Services/IncidentFeedService.js.map +1 -1
  235. package/build/dist/Server/Services/IncidentGroupingEngineService.js +43 -29
  236. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  237. package/build/dist/Server/Services/IncidentService.js +116 -28
  238. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  239. package/build/dist/Server/Services/IncidentSlaRuleService.js +19 -11
  240. package/build/dist/Server/Services/IncidentSlaRuleService.js.map +1 -1
  241. package/build/dist/Server/Services/IncidentSlaService.js +21 -14
  242. package/build/dist/Server/Services/IncidentSlaService.js.map +1 -1
  243. package/build/dist/Server/Services/IncidentStateTimelineService.js +130 -37
  244. package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
  245. package/build/dist/Server/Services/KubernetesClusterService.js +51 -14
  246. package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
  247. package/build/dist/Server/Services/LabelService.js +10 -1
  248. package/build/dist/Server/Services/LabelService.js.map +1 -1
  249. package/build/dist/Server/Services/MonitorFeedService.js +34 -10
  250. package/build/dist/Server/Services/MonitorFeedService.js.map +1 -1
  251. package/build/dist/Server/Services/MonitorProbeService.js +23 -3
  252. package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
  253. package/build/dist/Server/Services/MonitorService.js +42 -11
  254. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  255. package/build/dist/Server/Services/MonitorStatusTimelineService.js +69 -21
  256. package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
  257. package/build/dist/Server/Services/NotificationService.js +4 -3
  258. package/build/dist/Server/Services/NotificationService.js.map +1 -1
  259. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +49 -12
  260. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
  261. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +9 -3
  262. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
  263. package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +26 -11
  264. package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
  265. package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js +34 -10
  266. package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js.map +1 -1
  267. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +94 -37
  268. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
  269. package/build/dist/Server/Services/OnCallDutyPolicyService.js +1 -1
  270. package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
  271. package/build/dist/Server/Services/OpenTelemetryIngestService.js +45 -17
  272. package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
  273. package/build/dist/Server/Services/ProbeService.js +13 -7
  274. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  275. package/build/dist/Server/Services/ProjectService.js +41 -21
  276. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  277. package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js +17 -5
  278. package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js.map +1 -1
  279. package/build/dist/Server/Services/ScheduledMaintenanceService.js +71 -24
  280. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  281. package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +72 -24
  282. package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
  283. package/build/dist/Server/Services/StatusPageDomainService.js +55 -29
  284. package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
  285. package/build/dist/Server/Services/StatusPageService.js +29 -9
  286. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  287. package/build/dist/Server/Services/StatusPageSubscriberService.js +393 -130
  288. package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
  289. package/build/dist/Server/Services/TeamMemberService.js +10 -2
  290. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  291. package/build/dist/Server/Services/TelemetryAttributeService.js +83 -6
  292. package/build/dist/Server/Services/TelemetryAttributeService.js.map +1 -1
  293. package/build/dist/Server/Services/UserNotificationRuleService.js +10 -2
  294. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  295. package/build/dist/Server/Services/UserService.js +8 -3
  296. package/build/dist/Server/Services/UserService.js.map +1 -1
  297. package/build/dist/Server/Services/UserWhatsAppService.js +10 -2
  298. package/build/dist/Server/Services/UserWhatsAppService.js.map +1 -1
  299. package/build/dist/Server/Services/WorkflowService.js +7 -2
  300. package/build/dist/Server/Services/WorkflowService.js.map +1 -1
  301. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +367 -180
  302. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  303. package/build/dist/Server/Types/Domain.js +12 -6
  304. package/build/dist/Server/Types/Domain.js.map +1 -1
  305. package/build/dist/Server/Types/Workflow/Components/API/Post.js +11 -7
  306. package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
  307. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +11 -4
  308. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
  309. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +7 -0
  310. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
  311. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js +45 -17
  312. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js.map +1 -1
  313. package/build/dist/Server/Utils/Express.js.map +1 -1
  314. package/build/dist/Server/Utils/Greenlock/Greenlock.js +36 -29
  315. package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
  316. package/build/dist/Server/Utils/LLM/LLMService.js +18 -6
  317. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  318. package/build/dist/Server/Utils/Logger.js +61 -13
  319. package/build/dist/Server/Utils/Logger.js.map +1 -1
  320. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +23 -20
  321. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  322. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +13 -4
  323. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  324. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -22
  325. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  326. package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js +6 -3
  327. package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js.map +1 -1
  328. package/build/dist/Server/Utils/Profiling.js +9 -6
  329. package/build/dist/Server/Utils/Profiling.js.map +1 -1
  330. package/build/dist/Server/Utils/Realtime.js +50 -34
  331. package/build/dist/Server/Utils/Realtime.js.map +1 -1
  332. package/build/dist/Server/Utils/Response.js +2 -2
  333. package/build/dist/Server/Utils/Response.js.map +1 -1
  334. package/build/dist/Server/Utils/StartServer.js +23 -11
  335. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  336. package/build/dist/Server/Utils/Telemetry/SpanUtil.js +52 -0
  337. package/build/dist/Server/Utils/Telemetry/SpanUtil.js.map +1 -0
  338. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +58 -15
  339. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
  340. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +58 -15
  341. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
  342. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +19 -5
  343. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
  344. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +90 -26
  345. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  346. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js +12 -3
  347. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js.map +1 -1
  348. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js +25 -7
  349. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js.map +1 -1
  350. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +58 -19
  351. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
  352. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +102 -29
  353. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  354. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +38 -9
  355. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
  356. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +34 -8
  357. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -1
  358. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +3 -1
  359. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
  360. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +55 -13
  361. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
  362. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +5 -1
  363. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -1
  364. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +91 -26
  365. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
  366. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +355 -270
  367. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  368. package/build/dist/Server/Utils/Workspace/Workspace.js +21 -12
  369. package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
  370. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +3 -1
  371. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
  372. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js +9 -2
  373. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js.map +1 -1
  374. package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js +1 -1
  375. package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js.map +1 -1
  376. package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js +12 -6
  377. package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js.map +1 -1
  378. package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js +31 -30
  379. package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js.map +1 -1
  380. package/build/dist/UI/Components/Charts/Area/AreaChart.js +20 -2
  381. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  382. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +2 -2
  383. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
  384. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +9 -2
  385. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  386. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +9 -2
  387. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  388. package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js +2 -0
  389. package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js.map +1 -0
  390. package/build/dist/UI/Components/Charts/Line/LineChart.js +20 -2
  391. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  392. package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js +2 -0
  393. package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js.map +1 -0
  394. package/build/dist/UI/Components/Dictionary/Dictionary.js +9 -1
  395. package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
  396. package/build/dist/UI/Components/Filters/FiltersForm.js +1 -1
  397. package/build/dist/UI/Components/Filters/FiltersForm.js.map +1 -1
  398. package/build/dist/UI/Components/Filters/JSONFilter.js +1 -1
  399. package/build/dist/UI/Components/Filters/JSONFilter.js.map +1 -1
  400. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +3 -3
  401. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +9 -5
  402. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  403. package/build/dist/UI/Components/Navbar/NavBar.js +9 -1
  404. package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
  405. package/package.json +1 -1
@@ -35,7 +35,7 @@ import WorkspaceProjectAuthToken, {
35
35
  SlackMiscData,
36
36
  } from "../../Models/DatabaseModels/WorkspaceProjectAuthToken";
37
37
  import WorkspaceProjectAuthTokenService from "./WorkspaceProjectAuthTokenService";
38
- import logger from "../Utils/Logger";
38
+ import logger, { LogAttributes } from "../Utils/Logger";
39
39
  import NotificationRuleWorkspaceChannel from "../../Types/Workspace/NotificationRules/NotificationRuleWorkspaceChannel";
40
40
  import WorkspaceNotificationRule from "../../Models/DatabaseModels/WorkspaceNotificationRule";
41
41
  import UserService from "./UserService";
@@ -512,7 +512,9 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
512
512
  });
513
513
 
514
514
  if (!projectAuth || !projectAuth.authToken) {
515
- logger.debug("No project auth found for workspace type");
515
+ logger.debug("No project auth found for workspace type", {
516
+ projectId: data.projectId?.toString(),
517
+ } as LogAttributes);
516
518
  continue;
517
519
  }
518
520
 
@@ -689,8 +691,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
689
691
  notificationFor: NotificationFor;
690
692
  workspaceType: WorkspaceType;
691
693
  }): Promise<Array<WorkspaceChannel>> {
692
- logger.debug("getWorkspaceChannelsByNotificationFor called with data:");
693
- logger.debug(JSON.stringify(data, null, 2));
694
+ logger.debug("getWorkspaceChannelsByNotificationFor called with data:", {
695
+ projectId: data.projectId?.toString(),
696
+ } as LogAttributes);
697
+ logger.debug(JSON.stringify(data, null, 2), {
698
+ projectId: data.projectId?.toString(),
699
+ } as LogAttributes);
694
700
 
695
701
  let monitorChannels: Array<WorkspaceChannel> = [];
696
702
 
@@ -755,8 +761,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
755
761
  );
756
762
  }
757
763
 
758
- logger.debug("Workspace channels found:");
759
- logger.debug(monitorChannels);
764
+ logger.debug("Workspace channels found:", {
765
+ projectId: data.projectId?.toString(),
766
+ } as LogAttributes);
767
+ logger.debug(monitorChannels, {
768
+ projectId: data.projectId?.toString(),
769
+ } as LogAttributes);
760
770
 
761
771
  return monitorChannels;
762
772
  }
@@ -832,8 +842,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
832
842
  notificationRuleEventType: NotificationRuleEventType;
833
843
  notificationFor: NotificationFor;
834
844
  }): Promise<Array<WorkspaceChannel>> {
835
- logger.debug("getExistingChannelNamesBasedOnEventType called with data:");
836
- logger.debug(data);
845
+ logger.debug("getExistingChannelNamesBasedOnEventType called with data:", {
846
+ projectId: data.projectId?.toString(),
847
+ } as LogAttributes);
848
+ logger.debug(data, {
849
+ projectId: data.projectId?.toString(),
850
+ } as LogAttributes);
837
851
 
838
852
  const notificationRules: Array<WorkspaceNotificationRule> =
839
853
  await this.getMatchingNotificationRules({
@@ -843,8 +857,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
843
857
  notificationFor: data.notificationFor,
844
858
  });
845
859
 
846
- logger.debug("Notification rules retrieved:");
847
- logger.debug(notificationRules);
860
+ logger.debug("Notification rules retrieved:", {
861
+ projectId: data.projectId?.toString(),
862
+ } as LogAttributes);
863
+ logger.debug(notificationRules, {
864
+ projectId: data.projectId?.toString(),
865
+ } as LogAttributes);
848
866
 
849
867
  const existingChannels: Array<WorkspaceChannel> =
850
868
  this.getExistingChannelNamesFromNotificationRules({
@@ -856,8 +874,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
856
874
  workspaceType: data.workspaceType,
857
875
  }) || [];
858
876
 
859
- logger.debug("Existing channels:");
860
- logger.debug(existingChannels);
877
+ logger.debug("Existing channels:", {
878
+ projectId: data.projectId?.toString(),
879
+ } as LogAttributes);
880
+ logger.debug(existingChannels, {
881
+ projectId: data.projectId?.toString(),
882
+ } as LogAttributes);
861
883
 
862
884
  return existingChannels;
863
885
  }
@@ -874,8 +896,11 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
874
896
  try {
875
897
  logger.debug(
876
898
  "WorkspaceNotificationRuleService.createInviteAndPostToChannelsBasedOnRules",
899
+ { projectId: data.projectId?.toString() } as LogAttributes,
877
900
  );
878
- logger.debug(data);
901
+ logger.debug(data, {
902
+ projectId: data.projectId?.toString(),
903
+ } as LogAttributes);
879
904
 
880
905
  const channelsCreated: Array<NotificationRuleWorkspaceChannel> = [];
881
906
 
@@ -884,8 +909,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
884
909
  projectId: data.projectId,
885
910
  });
886
911
 
887
- logger.debug("projectAuths");
888
- logger.debug(projectAuths);
912
+ logger.debug("projectAuths", {
913
+ projectId: data.projectId?.toString(),
914
+ } as LogAttributes);
915
+ logger.debug(projectAuths, {
916
+ projectId: data.projectId?.toString(),
917
+ } as LogAttributes);
889
918
 
890
919
  if (!projectAuths || projectAuths.length === 0) {
891
920
  // do nothing.
@@ -913,14 +942,20 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
913
942
  notificationFor: data.notificationFor,
914
943
  });
915
944
 
916
- logger.debug("notificationRules");
917
- logger.debug(notificationRules);
945
+ logger.debug("notificationRules", {
946
+ projectId: data.projectId?.toString(),
947
+ } as LogAttributes);
948
+ logger.debug(notificationRules, {
949
+ projectId: data.projectId?.toString(),
950
+ } as LogAttributes);
918
951
 
919
952
  if (!notificationRules || notificationRules.length === 0) {
920
953
  return null;
921
954
  }
922
955
 
923
- logger.debug("Creating channels based on rules");
956
+ logger.debug("Creating channels based on rules", {
957
+ projectId: data.projectId?.toString(),
958
+ } as LogAttributes);
924
959
  const createdWorkspaceChannels: Array<NotificationRuleWorkspaceChannel> =
925
960
  await this.createChannelsBasedOnRules({
926
961
  projectId: data.projectId,
@@ -932,10 +967,16 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
932
967
  notificationFor: data.notificationFor,
933
968
  });
934
969
 
935
- logger.debug("createdWorkspaceChannels");
936
- logger.debug(createdWorkspaceChannels);
970
+ logger.debug("createdWorkspaceChannels", {
971
+ projectId: data.projectId?.toString(),
972
+ } as LogAttributes);
973
+ logger.debug(createdWorkspaceChannels, {
974
+ projectId: data.projectId?.toString(),
975
+ } as LogAttributes);
937
976
 
938
- logger.debug("Inviting users and teams to channels based on rules");
977
+ logger.debug("Inviting users and teams to channels based on rules", {
978
+ projectId: data.projectId?.toString(),
979
+ } as LogAttributes);
939
980
  await this.inviteUsersAndTeamsToChannelsBasedOnRules({
940
981
  projectId: data.projectId,
941
982
  projectAuth: projectAuth,
@@ -946,6 +987,7 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
946
987
 
947
988
  logger.debug(
948
989
  "Getting existing channel names from notification rules",
990
+ { projectId: data.projectId?.toString() } as LogAttributes,
949
991
  );
950
992
  const existingChannels: Array<WorkspaceChannel> =
951
993
  this.getExistingChannelNamesFromNotificationRules({
@@ -957,11 +999,16 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
957
999
  workspaceType: workspaceType,
958
1000
  }) || [];
959
1001
 
960
- logger.debug("Existing channels:");
961
- logger.debug(existingChannels);
1002
+ logger.debug("Existing channels:", {
1003
+ projectId: data.projectId?.toString(),
1004
+ } as LogAttributes);
1005
+ logger.debug(existingChannels, {
1006
+ projectId: data.projectId?.toString(),
1007
+ } as LogAttributes);
962
1008
 
963
1009
  logger.debug(
964
1010
  "Adding created channel names to existing channel names",
1011
+ { projectId: data.projectId?.toString() } as LogAttributes,
965
1012
  );
966
1013
  const allChannelNames: Array<string> = existingChannels.map(
967
1014
  (c: WorkspaceChannel) => {
@@ -974,33 +1021,51 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
974
1021
  }
975
1022
  }
976
1023
 
977
- logger.debug("Final list of channel names to post messages to:");
978
- logger.debug(allChannelNames);
1024
+ logger.debug("Final list of channel names to post messages to:", {
1025
+ projectId: data.projectId?.toString(),
1026
+ } as LogAttributes);
1027
+ logger.debug(allChannelNames, {
1028
+ projectId: data.projectId?.toString(),
1029
+ } as LogAttributes);
979
1030
 
980
- logger.debug("Posting messages to workspace channels");
1031
+ logger.debug("Posting messages to workspace channels", {
1032
+ projectId: data.projectId?.toString(),
1033
+ } as LogAttributes);
981
1034
 
982
- logger.debug("Channels created:");
983
- logger.debug(createdWorkspaceChannels);
1035
+ logger.debug("Channels created:", {
1036
+ projectId: data.projectId?.toString(),
1037
+ } as LogAttributes);
1038
+ logger.debug(createdWorkspaceChannels, {
1039
+ projectId: data.projectId?.toString(),
1040
+ } as LogAttributes);
984
1041
 
985
1042
  channelsCreated.push(...createdWorkspaceChannels);
986
1043
  } catch (err) {
987
1044
  logger.error(
988
1045
  "Error in creating channels and inviting users to channels for workspace type " +
989
1046
  projectAuth.workspaceType,
1047
+ { projectId: data.projectId?.toString() } as LogAttributes,
990
1048
  );
991
- logger.error(err);
1049
+ logger.error(err, {
1050
+ projectId: data.projectId?.toString(),
1051
+ } as LogAttributes);
992
1052
  }
993
1053
  }
994
1054
 
995
- logger.debug("Returning created channels");
1055
+ logger.debug("Returning created channels", {
1056
+ projectId: data.projectId?.toString(),
1057
+ } as LogAttributes);
996
1058
  return {
997
1059
  channelsCreated: channelsCreated,
998
1060
  };
999
1061
  } catch (err) {
1000
1062
  logger.error(
1001
1063
  "Error in createChannelsAndInviteUsersToChannelsBasedOnRules:",
1064
+ { projectId: data.projectId?.toString() } as LogAttributes,
1002
1065
  );
1003
- logger.error(err);
1066
+ logger.error(err, {
1067
+ projectId: data.projectId?.toString(),
1068
+ } as LogAttributes);
1004
1069
  return null;
1005
1070
  }
1006
1071
  }
@@ -1077,8 +1142,13 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1077
1142
  notificationRules: Array<WorkspaceNotificationRule>;
1078
1143
  notificationChannels: Array<NotificationRuleWorkspaceChannel>;
1079
1144
  }): Promise<void> {
1080
- logger.debug("inviteUsersAndTeamsToChannelsBasedOnRules called with data:");
1081
- logger.debug(data);
1145
+ logger.debug(
1146
+ "inviteUsersAndTeamsToChannelsBasedOnRules called with data:",
1147
+ { projectId: data.projectId?.toString() } as LogAttributes,
1148
+ );
1149
+ logger.debug(data, {
1150
+ projectId: data.projectId?.toString(),
1151
+ } as LogAttributes);
1082
1152
 
1083
1153
  const inviteUserPayloads: Array<{
1084
1154
  notificationRuleId: string;
@@ -1087,8 +1157,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1087
1157
  notificationRules: data.notificationRules,
1088
1158
  });
1089
1159
 
1090
- logger.debug("User IDs to invite by Workspace Notification Rule ID:");
1091
- logger.debug(inviteUserPayloads);
1160
+ logger.debug("User IDs to invite by Workspace Notification Rule ID:", {
1161
+ projectId: data.projectId?.toString(),
1162
+ } as LogAttributes);
1163
+ logger.debug(inviteUserPayloads, {
1164
+ projectId: data.projectId?.toString(),
1165
+ } as LogAttributes);
1092
1166
 
1093
1167
  for (const inviteUserPayload of inviteUserPayloads) {
1094
1168
  const userIds: Array<ObjectID> = inviteUserPayload.userIds;
@@ -1120,8 +1194,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1120
1194
  return channel.id as string;
1121
1195
  }) || [];
1122
1196
 
1123
- logger.debug("Channel IDs to send message to:");
1124
- logger.debug(channelIds);
1197
+ logger.debug("Channel IDs to send message to:", {
1198
+ projectId: data.projectId?.toString(),
1199
+ } as LogAttributes);
1200
+ logger.debug(channelIds, {
1201
+ projectId: data.projectId?.toString(),
1202
+ } as LogAttributes);
1125
1203
 
1126
1204
  const sendMessageData: {
1127
1205
  userId: string;
@@ -1163,13 +1241,21 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1163
1241
  data.workspaceType,
1164
1242
  ).sendMessage(sendMessageData);
1165
1243
  } catch (e) {
1166
- logger.error("Error in sending message to channel");
1167
- logger.error(e);
1244
+ logger.error("Error in sending message to channel", {
1245
+ projectId: data.projectId?.toString(),
1246
+ } as LogAttributes);
1247
+ logger.error(e, {
1248
+ projectId: data.projectId?.toString(),
1249
+ } as LogAttributes);
1168
1250
  }
1169
1251
  }
1170
1252
 
1171
- logger.debug("Workspace User IDs to invite:");
1172
- logger.debug(workspaceUserIds);
1253
+ logger.debug("Workspace User IDs to invite:", {
1254
+ projectId: data.projectId?.toString(),
1255
+ } as LogAttributes);
1256
+ logger.debug(workspaceUserIds, {
1257
+ projectId: data.projectId?.toString(),
1258
+ } as LogAttributes);
1173
1259
 
1174
1260
  await WorkspaceUtil.getWorkspaceTypeUtil(
1175
1261
  data.workspaceType,
@@ -1193,7 +1279,9 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1193
1279
  }
1194
1280
  }
1195
1281
 
1196
- logger.debug("Users invited to channels successfully");
1282
+ logger.debug("Users invited to channels successfully", {
1283
+ projectId: data.projectId?.toString(),
1284
+ } as LogAttributes);
1197
1285
  }
1198
1286
 
1199
1287
  @CaptureSpan()
@@ -1205,18 +1293,27 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1205
1293
  }): Promise<void> {
1206
1294
  // if no rules then return.
1207
1295
  if (data.notificationRules.length === 0) {
1208
- logger.debug("No notification rules found. Returning.");
1296
+ logger.debug("No notification rules found. Returning.", {
1297
+ projectId: data.projectId?.toString(),
1298
+ } as LogAttributes);
1209
1299
  return;
1210
1300
  }
1211
1301
 
1212
1302
  logger.debug(
1213
1303
  "inviteUsersBasedOnRulesAndWorkspaceChannels called with data:",
1304
+ { projectId: data.projectId?.toString() } as LogAttributes,
1214
1305
  );
1215
- logger.debug(data);
1306
+ logger.debug(data, {
1307
+ projectId: data.projectId?.toString(),
1308
+ } as LogAttributes);
1216
1309
  const userIds: Array<ObjectID> = data.userIds;
1217
1310
 
1218
- logger.debug("Users:");
1219
- logger.debug(userIds);
1311
+ logger.debug("Users:", {
1312
+ projectId: data.projectId?.toString(),
1313
+ } as LogAttributes);
1314
+ logger.debug(userIds, {
1315
+ projectId: data.projectId?.toString(),
1316
+ } as LogAttributes);
1220
1317
 
1221
1318
  // get all Workspaces.
1222
1319
  const workspaceTypes: Array<WorkspaceType> = Service.getAllWorkspaceTypes();
@@ -1229,8 +1326,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1229
1326
  return rule.workspaceType === workspaceType;
1230
1327
  });
1231
1328
 
1232
- logger.debug("Notification rules for workspace type:");
1233
- logger.debug(notificationRules);
1329
+ logger.debug("Notification rules for workspace type:", {
1330
+ projectId: data.projectId?.toString(),
1331
+ } as LogAttributes);
1332
+ logger.debug(notificationRules, {
1333
+ projectId: data.projectId?.toString(),
1334
+ } as LogAttributes);
1234
1335
 
1235
1336
  const channelsToInviteToBasedOnRule: Array<NotificationRuleWorkspaceChannel> =
1236
1337
  data.workspaceChannels.filter(
@@ -1241,11 +1342,17 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1241
1342
  },
1242
1343
  );
1243
1344
 
1244
- logger.debug("Channels to invite to based on rule:");
1245
- logger.debug(channelsToInviteToBasedOnRule);
1345
+ logger.debug("Channels to invite to based on rule:", {
1346
+ projectId: data.projectId?.toString(),
1347
+ } as LogAttributes);
1348
+ logger.debug(channelsToInviteToBasedOnRule, {
1349
+ projectId: data.projectId?.toString(),
1350
+ } as LogAttributes);
1246
1351
 
1247
1352
  if (channelsToInviteToBasedOnRule.length === 0) {
1248
- logger.debug("No channels to invite to based on rule.");
1353
+ logger.debug("No channels to invite to based on rule.", {
1354
+ projectId: data.projectId?.toString(),
1355
+ } as LogAttributes);
1249
1356
  continue;
1250
1357
  }
1251
1358
 
@@ -1266,7 +1373,9 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1266
1373
  });
1267
1374
 
1268
1375
  if (!projectAuth) {
1269
- logger.debug("No project auth found for workspace type");
1376
+ logger.debug("No project auth found for workspace type", {
1377
+ projectId: data.projectId?.toString(),
1378
+ } as LogAttributes);
1270
1379
  continue;
1271
1380
  }
1272
1381
 
@@ -1294,8 +1403,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1294
1403
  },
1295
1404
  );
1296
1405
 
1297
- logger.debug("Channel IDs to send message to:");
1298
- logger.debug(channelIds);
1406
+ logger.debug("Channel IDs to send message to:", {
1407
+ projectId: data.projectId?.toString(),
1408
+ } as LogAttributes);
1409
+ logger.debug(channelIds, {
1410
+ projectId: data.projectId?.toString(),
1411
+ } as LogAttributes);
1299
1412
 
1300
1413
  const sendMessageData: {
1301
1414
  userId: string;
@@ -1337,14 +1450,22 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1337
1450
  sendMessageData,
1338
1451
  );
1339
1452
  } catch (e) {
1340
- logger.error("Error in sending message to channel");
1341
- logger.error(e);
1453
+ logger.error("Error in sending message to channel", {
1454
+ projectId: data.projectId?.toString(),
1455
+ } as LogAttributes);
1456
+ logger.error(e, {
1457
+ projectId: data.projectId?.toString(),
1458
+ } as LogAttributes);
1342
1459
  }
1343
1460
  }
1344
1461
  }
1345
1462
 
1346
- logger.debug("Workspace User IDs to invite:");
1347
- logger.debug(workspaceUserIds);
1463
+ logger.debug("Workspace User IDs to invite:", {
1464
+ projectId: data.projectId?.toString(),
1465
+ } as LogAttributes);
1466
+ logger.debug(workspaceUserIds, {
1467
+ projectId: data.projectId?.toString(),
1468
+ } as LogAttributes);
1348
1469
 
1349
1470
  const channelNames: Array<string> = channelsToInviteToBasedOnRule.map(
1350
1471
  (channel: NotificationRuleWorkspaceChannel) => {
@@ -1352,8 +1473,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1352
1473
  },
1353
1474
  );
1354
1475
 
1355
- logger.debug("Channel names to invite to:");
1356
- logger.debug(channelNames);
1476
+ logger.debug("Channel names to invite to:", {
1477
+ projectId: data.projectId?.toString(),
1478
+ } as LogAttributes);
1479
+ logger.debug(channelNames, {
1480
+ projectId: data.projectId?.toString(),
1481
+ } as LogAttributes);
1357
1482
 
1358
1483
  await WorkspaceUtil.getWorkspaceTypeUtil(
1359
1484
  workspaceType,
@@ -1394,8 +1519,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1394
1519
  }
1395
1520
  }
1396
1521
  } catch (err) {
1397
- logger.error("Error logging user invitations:");
1398
- logger.error(err);
1522
+ logger.error("Error logging user invitations:", {
1523
+ projectId: data.projectId?.toString(),
1524
+ } as LogAttributes);
1525
+ logger.error(err, {
1526
+ projectId: data.projectId?.toString(),
1527
+ } as LogAttributes);
1399
1528
  // Don't throw the error, just log it so the main flow continues
1400
1529
  }
1401
1530
  }
@@ -1410,7 +1539,9 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1410
1539
  }): Promise<void> {
1411
1540
  // if no rules then return.
1412
1541
  if (data.notificationRules.length === 0) {
1413
- logger.debug("No notification rules found. Returning.");
1542
+ logger.debug("No notification rules found. Returning.", {
1543
+ projectId: data.projectId?.toString(),
1544
+ } as LogAttributes);
1414
1545
  return;
1415
1546
  }
1416
1547
 
@@ -1418,8 +1549,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1418
1549
  data.teamIds,
1419
1550
  );
1420
1551
 
1421
- logger.debug("Users in teams:");
1422
- logger.debug(usersInTeam);
1552
+ logger.debug("Users in teams:", {
1553
+ projectId: data.projectId?.toString(),
1554
+ } as LogAttributes);
1555
+ logger.debug(usersInTeam, {
1556
+ projectId: data.projectId?.toString(),
1557
+ } as LogAttributes);
1423
1558
 
1424
1559
  return this.inviteUsersBasedOnRulesAndWorkspaceChannels({
1425
1560
  workspaceChannels: data.workspaceChannels,
@@ -1437,8 +1572,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1437
1572
  workspaceType: WorkspaceType;
1438
1573
  oneuptimeUserId: ObjectID;
1439
1574
  }): Promise<string | null> {
1440
- logger.debug("getWorkspaceUserIdFromOneUptimeUserId called with data:");
1441
- logger.debug(data);
1575
+ logger.debug("getWorkspaceUserIdFromOneUptimeUserId called with data:", {
1576
+ projectId: data.projectId?.toString(),
1577
+ } as LogAttributes);
1578
+ logger.debug(data, {
1579
+ projectId: data.projectId?.toString(),
1580
+ } as LogAttributes);
1442
1581
 
1443
1582
  const userAuth: WorkspaceUserAuthToken | null =
1444
1583
  await WorkspaceUserAuthTokenService.findOneBy({
@@ -1456,12 +1595,18 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1456
1595
  });
1457
1596
 
1458
1597
  if (!userAuth) {
1459
- logger.debug("No userAuth found for given data");
1598
+ logger.debug("No userAuth found for given data", {
1599
+ projectId: data.projectId?.toString(),
1600
+ } as LogAttributes);
1460
1601
  return null;
1461
1602
  }
1462
1603
 
1463
- logger.debug("Found userAuth:");
1464
- logger.debug(userAuth);
1604
+ logger.debug("Found userAuth:", {
1605
+ projectId: data.projectId?.toString(),
1606
+ } as LogAttributes);
1607
+ logger.debug(userAuth, {
1608
+ projectId: data.projectId?.toString(),
1609
+ } as LogAttributes);
1465
1610
 
1466
1611
  return userAuth.workspaceUserId?.toString() || null;
1467
1612
  }
@@ -1476,8 +1621,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1476
1621
  notificationEventType: NotificationRuleEventType;
1477
1622
  notificationFor?: NotificationFor;
1478
1623
  }): Promise<Array<NotificationRuleWorkspaceChannel>> {
1479
- logger.debug("createChannelsBasedOnRules called with data:");
1480
- logger.debug(data);
1624
+ logger.debug("createChannelsBasedOnRules called with data:", {
1625
+ projectId: data.projectId?.toString(),
1626
+ } as LogAttributes);
1627
+ logger.debug(data, {
1628
+ projectId: data.projectId?.toString(),
1629
+ } as LogAttributes);
1481
1630
 
1482
1631
  const createdWorkspaceChannels: Array<NotificationRuleWorkspaceChannel> =
1483
1632
  [];
@@ -1493,8 +1642,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1493
1642
  notificationEventType: data.notificationEventType,
1494
1643
  });
1495
1644
 
1496
- logger.debug("New channel names to be created:");
1497
- logger.debug(notificationChannels);
1645
+ logger.debug("New channel names to be created:", {
1646
+ projectId: data.projectId?.toString(),
1647
+ } as LogAttributes);
1648
+ logger.debug(notificationChannels, {
1649
+ projectId: data.projectId?.toString(),
1650
+ } as LogAttributes);
1498
1651
 
1499
1652
  // Get project auth to access teamId for Microsoft Teams
1500
1653
  const projectAuth: WorkspaceProjectAuthToken | null =
@@ -1510,7 +1663,9 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1510
1663
  }
1511
1664
 
1512
1665
  if (!notificationChannels || notificationChannels.length === 0) {
1513
- logger.debug("No new channel names found. Returning empty array.");
1666
+ logger.debug("No new channel names found. Returning empty array.", {
1667
+ projectId: data.projectId?.toString(),
1668
+ } as LogAttributes);
1514
1669
  return [];
1515
1670
  }
1516
1671
 
@@ -1522,12 +1677,14 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1522
1677
  ) {
1523
1678
  logger.debug(
1524
1679
  `Channel name ${notificationChannel.channelName} already created. Skipping.`,
1680
+ { projectId: data.projectId?.toString() } as LogAttributes,
1525
1681
  );
1526
1682
  continue;
1527
1683
  }
1528
1684
 
1529
1685
  logger.debug(
1530
1686
  `Creating new channel with name: ${notificationChannel.channelName}`,
1687
+ { projectId: data.projectId?.toString() } as LogAttributes,
1531
1688
  );
1532
1689
  const createChannelData: {
1533
1690
  authToken: string;
@@ -1569,8 +1726,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1569
1726
  notificationRuleId: notificationChannel.notificationRuleId,
1570
1727
  };
1571
1728
 
1572
- logger.debug("Channel created:");
1573
- logger.debug(channel);
1729
+ logger.debug("Channel created:", {
1730
+ projectId: data.projectId?.toString(),
1731
+ } as LogAttributes);
1732
+ logger.debug(channel, {
1733
+ projectId: data.projectId?.toString(),
1734
+ } as LogAttributes);
1574
1735
 
1575
1736
  // Log the channel creation
1576
1737
  try {
@@ -1609,8 +1770,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1609
1770
  isRoot: true,
1610
1771
  });
1611
1772
  } catch (err) {
1612
- logger.error("Error logging channel creation:");
1613
- logger.error(err);
1773
+ logger.error("Error logging channel creation:", {
1774
+ projectId: data.projectId?.toString(),
1775
+ } as LogAttributes);
1776
+ logger.error(err, {
1777
+ projectId: data.projectId?.toString(),
1778
+ } as LogAttributes);
1614
1779
  // Don't throw the error, just log it so the main flow continues
1615
1780
  }
1616
1781
 
@@ -1618,8 +1783,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1618
1783
  createdWorkspaceChannels.push(notificationWorkspaceChannel);
1619
1784
  }
1620
1785
 
1621
- logger.debug("Returning created workspace channels:");
1622
- logger.debug(createdWorkspaceChannels);
1786
+ logger.debug("Returning created workspace channels:", {
1787
+ projectId: data.projectId?.toString(),
1788
+ } as LogAttributes);
1789
+ logger.debug(createdWorkspaceChannels, {
1790
+ projectId: data.projectId?.toString(),
1791
+ } as LogAttributes);
1623
1792
 
1624
1793
  return createdWorkspaceChannels;
1625
1794
  }
@@ -1654,8 +1823,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1654
1823
  const userIds: Array<ObjectID> =
1655
1824
  workspaceRules.inviteUsersToNewChannel || [];
1656
1825
 
1657
- logger.debug("User IDs to invite from rule:");
1658
- logger.debug(userIds);
1826
+ logger.debug("User IDs to invite from rule:", {} as LogAttributes);
1827
+ logger.debug(userIds, {} as LogAttributes);
1659
1828
 
1660
1829
  for (const userId of userIds) {
1661
1830
  if (
@@ -1679,14 +1848,14 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1679
1848
  return new ObjectID(teamId.toString());
1680
1849
  });
1681
1850
 
1682
- logger.debug("Team IDs to invite from rule:");
1683
- logger.debug(teamIds);
1851
+ logger.debug("Team IDs to invite from rule:", {} as LogAttributes);
1852
+ logger.debug(teamIds, {} as LogAttributes);
1684
1853
 
1685
1854
  const usersInTeam: Array<User> =
1686
1855
  await TeamMemberService.getUsersInTeams(teamIds);
1687
1856
 
1688
- logger.debug("Users in teams:");
1689
- logger.debug(usersInTeam);
1857
+ logger.debug("Users in teams:", {} as LogAttributes);
1858
+ logger.debug(usersInTeam, {} as LogAttributes);
1690
1859
 
1691
1860
  for (const user of usersInTeam) {
1692
1861
  if (
@@ -1711,8 +1880,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1711
1880
  }
1712
1881
  }
1713
1882
 
1714
- logger.debug("Final list of user IDs to invite:");
1715
- logger.debug(result);
1883
+ logger.debug("Final list of user IDs to invite:", {} as LogAttributes);
1884
+ logger.debug(result, {} as LogAttributes);
1716
1885
 
1717
1886
  return result;
1718
1887
  }
@@ -1723,8 +1892,9 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1723
1892
  }): Array<WorkspaceChannel> {
1724
1893
  logger.debug(
1725
1894
  "getExistingChannelNamesFromNotificationRules called with data:",
1895
+ {} as LogAttributes,
1726
1896
  );
1727
- logger.debug(data);
1897
+ logger.debug(data, {} as LogAttributes);
1728
1898
 
1729
1899
  const channels: Array<WorkspaceChannel> = [];
1730
1900
 
@@ -1735,12 +1905,15 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1735
1905
  const existingChannelNames: Array<string> =
1736
1906
  workspaceRules.existingChannelNames.split(",");
1737
1907
 
1738
- logger.debug("Existing channel names from rule:");
1739
- logger.debug(existingChannelNames);
1908
+ logger.debug("Existing channel names from rule:", {} as LogAttributes);
1909
+ logger.debug(existingChannelNames, {} as LogAttributes);
1740
1910
 
1741
1911
  for (const channelName of existingChannelNames) {
1742
1912
  if (!channelName) {
1743
- logger.debug("Empty channel name found. Skipping.");
1913
+ logger.debug(
1914
+ "Empty channel name found. Skipping.",
1915
+ {} as LogAttributes,
1916
+ );
1744
1917
  continue;
1745
1918
  }
1746
1919
 
@@ -1764,8 +1937,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1764
1937
  }
1765
1938
  }
1766
1939
 
1767
- logger.debug("Final list of existing channels:");
1768
- logger.debug(channels);
1940
+ logger.debug("Final list of existing channels:", {} as LogAttributes);
1941
+ logger.debug(channels, {} as LogAttributes);
1769
1942
 
1770
1943
  return channels;
1771
1944
  }
@@ -1781,8 +1954,9 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1781
1954
  }> {
1782
1955
  logger.debug(
1783
1956
  "getnotificationChannelssFromNotificationRules called with data:",
1957
+ {} as LogAttributes,
1784
1958
  );
1785
- logger.debug(data);
1959
+ logger.debug(data, {} as LogAttributes);
1786
1960
 
1787
1961
  const channels: Array<{
1788
1962
  channelName: string;
@@ -1794,16 +1968,16 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1794
1968
  const workspaceRules: CreateChannelNotificationRule =
1795
1969
  notificationRule.notificationRule as CreateChannelNotificationRule;
1796
1970
 
1797
- logger.debug("Processing notification rule:");
1798
- logger.debug(workspaceRules);
1971
+ logger.debug("Processing notification rule:", {} as LogAttributes);
1972
+ logger.debug(workspaceRules, {} as LogAttributes);
1799
1973
 
1800
1974
  if (workspaceRules.shouldCreateNewChannel) {
1801
1975
  const notificationChannels: string =
1802
1976
  workspaceRules.newChannelTemplateName ||
1803
1977
  `oneuptime-${data.notificationEventType.toLowerCase()}-`;
1804
1978
 
1805
- logger.debug("New channel template name:");
1806
- logger.debug(notificationChannels);
1979
+ logger.debug("New channel template name:", {} as LogAttributes);
1980
+ logger.debug(notificationChannels, {} as LogAttributes);
1807
1981
 
1808
1982
  /*
1809
1983
  * Sanitize the suffix for workspace channel names.
@@ -1818,8 +1992,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1818
1992
  // add suffix and then check if it is already added or not.
1819
1993
  const channelName: string = notificationChannels + sanitizedSuffix;
1820
1994
 
1821
- logger.debug("Final channel name with suffix:");
1822
- logger.debug(channelName);
1995
+ logger.debug("Final channel name with suffix:", {} as LogAttributes);
1996
+ logger.debug(channelName, {} as LogAttributes);
1823
1997
 
1824
1998
  if (
1825
1999
  channels.filter(
@@ -1847,17 +2021,21 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1847
2021
  }
1848
2022
 
1849
2023
  channels.push(channelData);
1850
- logger.debug(`Channel name ${channelName} added to the list.`);
2024
+ logger.debug(
2025
+ `Channel name ${channelName} added to the list.`,
2026
+ {} as LogAttributes,
2027
+ );
1851
2028
  } else {
1852
2029
  logger.debug(
1853
2030
  `Channel name ${channelName} already exists in the list. Skipping.`,
2031
+ {} as LogAttributes,
1854
2032
  );
1855
2033
  }
1856
2034
  }
1857
2035
  }
1858
2036
 
1859
- logger.debug("Final list of new channel names:");
1860
- logger.debug(channels);
2037
+ logger.debug("Final list of new channel names:", {} as LogAttributes);
2038
+ logger.debug(channels, {} as LogAttributes);
1861
2039
 
1862
2040
  return channels;
1863
2041
  }
@@ -1867,8 +2045,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1867
2045
  workspaceType: WorkspaceType;
1868
2046
  notificationRuleEventType: NotificationRuleEventType;
1869
2047
  }): Promise<Array<WorkspaceNotificationRule>> {
1870
- logger.debug("getNotificationRules called with data:");
1871
- logger.debug(data);
2048
+ logger.debug("getNotificationRules called with data:", {
2049
+ projectId: data.projectId?.toString(),
2050
+ } as LogAttributes);
2051
+ logger.debug(data, {
2052
+ projectId: data.projectId?.toString(),
2053
+ } as LogAttributes);
1872
2054
 
1873
2055
  const notificationRules: Array<WorkspaceNotificationRule> =
1874
2056
  await this.findBy({
@@ -1889,8 +2071,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1889
2071
  limit: LIMIT_PER_PROJECT,
1890
2072
  });
1891
2073
 
1892
- logger.debug("Notification rules retrieved:");
1893
- logger.debug(notificationRules);
2074
+ logger.debug("Notification rules retrieved:", {
2075
+ projectId: data.projectId?.toString(),
2076
+ } as LogAttributes);
2077
+ logger.debug(notificationRules, {
2078
+ projectId: data.projectId?.toString(),
2079
+ } as LogAttributes);
1894
2080
 
1895
2081
  return notificationRules;
1896
2082
  }
@@ -1903,12 +2089,18 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1903
2089
  | Array<string>
1904
2090
  | undefined;
1905
2091
  }> {
1906
- logger.debug("getValuesBasedOnNotificationFor called with data:");
1907
- logger.debug(data);
2092
+ logger.debug(
2093
+ "getValuesBasedOnNotificationFor called with data:",
2094
+ {} as LogAttributes,
2095
+ );
2096
+ logger.debug(data, {} as LogAttributes);
1908
2097
 
1909
2098
  if (data.notificationFor.incidentId) {
1910
- logger.debug("Fetching incident details for incident ID:");
1911
- logger.debug(data.notificationFor.incidentId);
2099
+ logger.debug(
2100
+ "Fetching incident details for incident ID:",
2101
+ {} as LogAttributes,
2102
+ );
2103
+ logger.debug(data.notificationFor.incidentId, {} as LogAttributes);
1912
2104
 
1913
2105
  const incident: Incident | null = await IncidentService.findOneById({
1914
2106
  id: data.notificationFor.incidentId,
@@ -1926,13 +2118,13 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1926
2118
  });
1927
2119
 
1928
2120
  if (!incident) {
1929
- logger.debug("Incident not found for ID:");
1930
- logger.debug(data.notificationFor.incidentId);
2121
+ logger.debug("Incident not found for ID:", {} as LogAttributes);
2122
+ logger.debug(data.notificationFor.incidentId, {} as LogAttributes);
1931
2123
  throw new BadDataException("Incident ID not found");
1932
2124
  }
1933
2125
 
1934
- logger.debug("Incident details retrieved:");
1935
- logger.debug(incident);
2126
+ logger.debug("Incident details retrieved:", {} as LogAttributes);
2127
+ logger.debug(incident, {} as LogAttributes);
1936
2128
 
1937
2129
  const monitorLabels: Array<Label> =
1938
2130
  await MonitorService.getLabelsForMonitors({
@@ -1942,8 +2134,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1942
2134
  }) || [],
1943
2135
  });
1944
2136
 
1945
- logger.debug("Monitor labels retrieved:");
1946
- logger.debug(monitorLabels);
2137
+ logger.debug("Monitor labels retrieved:", {} as LogAttributes);
2138
+ logger.debug(monitorLabels, {} as LogAttributes);
1947
2139
 
1948
2140
  return {
1949
2141
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
@@ -1999,8 +2191,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
1999
2191
  }
2000
2192
 
2001
2193
  if (data.notificationFor.alertId) {
2002
- logger.debug("Fetching alert details for alert ID:");
2003
- logger.debug(data.notificationFor.alertId);
2194
+ logger.debug("Fetching alert details for alert ID:", {} as LogAttributes);
2195
+ logger.debug(data.notificationFor.alertId, {} as LogAttributes);
2004
2196
 
2005
2197
  const alert: Alert | null = await AlertService.findOneById({
2006
2198
  id: data.notificationFor.alertId,
@@ -2018,21 +2210,21 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2018
2210
  });
2019
2211
 
2020
2212
  if (!alert) {
2021
- logger.debug("Alert not found for ID:");
2022
- logger.debug(data.notificationFor.alertId);
2213
+ logger.debug("Alert not found for ID:", {} as LogAttributes);
2214
+ logger.debug(data.notificationFor.alertId, {} as LogAttributes);
2023
2215
  throw new BadDataException("Alert ID not found");
2024
2216
  }
2025
2217
 
2026
- logger.debug("Alert details retrieved:");
2027
- logger.debug(alert);
2218
+ logger.debug("Alert details retrieved:", {} as LogAttributes);
2219
+ logger.debug(alert, {} as LogAttributes);
2028
2220
 
2029
2221
  const monitorLabels: Array<Label> =
2030
2222
  await MonitorService.getLabelsForMonitors({
2031
2223
  monitorIds: alert?.monitor?.id ? [alert?.monitor?.id] : [],
2032
2224
  });
2033
2225
 
2034
- logger.debug("Monitor labels retrieved:");
2035
- logger.debug(monitorLabels);
2226
+ logger.debug("Monitor labels retrieved:", {} as LogAttributes);
2227
+ logger.debug(monitorLabels, {} as LogAttributes);
2036
2228
 
2037
2229
  return {
2038
2230
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
@@ -2087,8 +2279,14 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2087
2279
  }
2088
2280
 
2089
2281
  if (data.notificationFor.scheduledMaintenanceId) {
2090
- logger.debug("Fetching scheduled maintenance details for ID:");
2091
- logger.debug(data.notificationFor.scheduledMaintenanceId);
2282
+ logger.debug(
2283
+ "Fetching scheduled maintenance details for ID:",
2284
+ {} as LogAttributes,
2285
+ );
2286
+ logger.debug(
2287
+ data.notificationFor.scheduledMaintenanceId,
2288
+ {} as LogAttributes,
2289
+ );
2092
2290
 
2093
2291
  const scheduledMaintenance: ScheduledMaintenance | null =
2094
2292
  await ScheduledMaintenanceService.findOneById({
@@ -2106,13 +2304,22 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2106
2304
  });
2107
2305
 
2108
2306
  if (!scheduledMaintenance) {
2109
- logger.debug("Scheduled maintenance not found for ID:");
2110
- logger.debug(data.notificationFor.scheduledMaintenanceId);
2307
+ logger.debug(
2308
+ "Scheduled maintenance not found for ID:",
2309
+ {} as LogAttributes,
2310
+ );
2311
+ logger.debug(
2312
+ data.notificationFor.scheduledMaintenanceId,
2313
+ {} as LogAttributes,
2314
+ );
2111
2315
  throw new BadDataException("Scheduled Maintenance ID not found");
2112
2316
  }
2113
2317
 
2114
- logger.debug("Scheduled maintenance details retrieved:");
2115
- logger.debug(scheduledMaintenance);
2318
+ logger.debug(
2319
+ "Scheduled maintenance details retrieved:",
2320
+ {} as LogAttributes,
2321
+ );
2322
+ logger.debug(scheduledMaintenance, {} as LogAttributes);
2116
2323
 
2117
2324
  const monitorLabels: Array<Label> =
2118
2325
  await MonitorService.getLabelsForMonitors({
@@ -2124,8 +2331,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2124
2331
  ) || [],
2125
2332
  });
2126
2333
 
2127
- logger.debug("Monitor labels retrieved:");
2128
- logger.debug(monitorLabels);
2334
+ logger.debug("Monitor labels retrieved:", {} as LogAttributes);
2335
+ logger.debug(monitorLabels, {} as LogAttributes);
2129
2336
 
2130
2337
  return {
2131
2338
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
@@ -2181,8 +2388,11 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2181
2388
  }
2182
2389
 
2183
2390
  if (data.notificationFor.monitorId) {
2184
- logger.debug("Fetching monitor status timeline details for ID:");
2185
- logger.debug(data.notificationFor.monitorId);
2391
+ logger.debug(
2392
+ "Fetching monitor status timeline details for ID:",
2393
+ {} as LogAttributes,
2394
+ );
2395
+ logger.debug(data.notificationFor.monitorId, {} as LogAttributes);
2186
2396
 
2187
2397
  const monitor: Monitor | null = await MonitorService.findOneById({
2188
2398
  id: data.notificationFor.monitorId,
@@ -2198,8 +2408,8 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2198
2408
  });
2199
2409
 
2200
2410
  if (!monitor) {
2201
- logger.debug("Monitor not found for ID:");
2202
- logger.debug(data.notificationFor.monitorId);
2411
+ logger.debug("Monitor not found for ID:", {} as LogAttributes);
2412
+ logger.debug(data.notificationFor.monitorId, {} as LogAttributes);
2203
2413
  throw new BadDataException(ExceptionMessages.MonitorNotFound);
2204
2414
  }
2205
2415
 
@@ -2253,8 +2463,14 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2253
2463
  }
2254
2464
 
2255
2465
  if (data.notificationFor.onCallDutyPolicyId) {
2256
- logger.debug("Fetching on call policy details for ID:");
2257
- logger.debug(data.notificationFor.onCallDutyPolicyId);
2466
+ logger.debug(
2467
+ "Fetching on call policy details for ID:",
2468
+ {} as LogAttributes,
2469
+ );
2470
+ logger.debug(
2471
+ data.notificationFor.onCallDutyPolicyId,
2472
+ {} as LogAttributes,
2473
+ );
2258
2474
 
2259
2475
  const onCallDutyPolicy: OnCallDutyPolicy | null =
2260
2476
  await OnCallDutyPolicyService.findOneById({
@@ -2270,8 +2486,14 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2270
2486
  });
2271
2487
 
2272
2488
  if (!onCallDutyPolicy) {
2273
- logger.debug("On Call Duty Policy not found for ID:");
2274
- logger.debug(data.notificationFor.onCallDutyPolicyId);
2489
+ logger.debug(
2490
+ "On Call Duty Policy not found for ID:",
2491
+ {} as LogAttributes,
2492
+ );
2493
+ logger.debug(
2494
+ data.notificationFor.onCallDutyPolicyId,
2495
+ {} as LogAttributes,
2496
+ );
2275
2497
  throw new BadDataException("On Call Duty Policy ID not found");
2276
2498
  }
2277
2499
 
@@ -2325,8 +2547,11 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2325
2547
 
2326
2548
  // Handle Incident Episode
2327
2549
  if (data.notificationFor.incidentEpisodeId) {
2328
- logger.debug("Fetching incident episode details for ID:");
2329
- logger.debug(data.notificationFor.incidentEpisodeId);
2550
+ logger.debug(
2551
+ "Fetching incident episode details for ID:",
2552
+ {} as LogAttributes,
2553
+ );
2554
+ logger.debug(data.notificationFor.incidentEpisodeId, {} as LogAttributes);
2330
2555
 
2331
2556
  const incidentEpisode: IncidentEpisode | null =
2332
2557
  await IncidentEpisodeService.findOneById({
@@ -2344,13 +2569,16 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2344
2569
  });
2345
2570
 
2346
2571
  if (!incidentEpisode) {
2347
- logger.debug("Incident Episode not found for ID:");
2348
- logger.debug(data.notificationFor.incidentEpisodeId);
2572
+ logger.debug("Incident Episode not found for ID:", {} as LogAttributes);
2573
+ logger.debug(
2574
+ data.notificationFor.incidentEpisodeId,
2575
+ {} as LogAttributes,
2576
+ );
2349
2577
  throw new BadDataException("Incident Episode ID not found");
2350
2578
  }
2351
2579
 
2352
- logger.debug("Incident Episode details retrieved:");
2353
- logger.debug(incidentEpisode);
2580
+ logger.debug("Incident Episode details retrieved:", {} as LogAttributes);
2581
+ logger.debug(incidentEpisode, {} as LogAttributes);
2354
2582
 
2355
2583
  return {
2356
2584
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
@@ -2415,8 +2643,12 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2415
2643
  notificationRuleEventType: data.notificationRuleEventType,
2416
2644
  });
2417
2645
 
2418
- logger.debug("Notification rules retrieved:");
2419
- logger.debug(notificationRules);
2646
+ logger.debug("Notification rules retrieved:", {
2647
+ projectId: data.projectId?.toString(),
2648
+ } as LogAttributes);
2649
+ logger.debug(notificationRules, {
2650
+ projectId: data.projectId?.toString(),
2651
+ } as LogAttributes);
2420
2652
 
2421
2653
  const values: {
2422
2654
  [key in NotificationRuleConditionCheckOn]:
@@ -2427,13 +2659,19 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2427
2659
  notificationFor: data.notificationFor,
2428
2660
  });
2429
2661
 
2430
- logger.debug("Values based on notification for:");
2431
- logger.debug(values);
2662
+ logger.debug("Values based on notification for:", {
2663
+ projectId: data.projectId?.toString(),
2664
+ } as LogAttributes);
2665
+ logger.debug(values, {
2666
+ projectId: data.projectId?.toString(),
2667
+ } as LogAttributes);
2432
2668
 
2433
2669
  const matchingNotificationRules: Array<WorkspaceNotificationRule> = [];
2434
2670
 
2435
2671
  for (const notificationRule of notificationRules) {
2436
- logger.debug("Checking if rule matches:");
2672
+ logger.debug("Checking if rule matches:", {
2673
+ projectId: data.projectId?.toString(),
2674
+ } as LogAttributes);
2437
2675
  if (
2438
2676
  WorkspaceNotificationRuleUtil.isRuleMatching({
2439
2677
  notificationRule:
@@ -2441,10 +2679,14 @@ export class Service extends DatabaseService<WorkspaceNotificationRule> {
2441
2679
  values: values,
2442
2680
  })
2443
2681
  ) {
2444
- logger.debug("Rule matches. Adding to the list.");
2682
+ logger.debug("Rule matches. Adding to the list.", {
2683
+ projectId: data.projectId?.toString(),
2684
+ } as LogAttributes);
2445
2685
  matchingNotificationRules.push(notificationRule);
2446
2686
  } else {
2447
- logger.debug("Rule does not match. Skipping.");
2687
+ logger.debug("Rule does not match. Skipping.", {
2688
+ projectId: data.projectId?.toString(),
2689
+ } as LogAttributes);
2448
2690
  }
2449
2691
  }
2450
2692