@oneuptime/common 9.4.12 → 9.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/Incident.ts +77 -0
- package/Models/DatabaseModels/IncidentEpisode.ts +1223 -0
- package/Models/DatabaseModels/IncidentEpisodeFeed.ts +533 -0
- package/Models/DatabaseModels/IncidentEpisodeInternalNote.ts +456 -0
- package/Models/DatabaseModels/IncidentEpisodeMember.ts +587 -0
- package/Models/DatabaseModels/IncidentEpisodeOwnerTeam.ts +421 -0
- package/Models/DatabaseModels/IncidentEpisodeOwnerUser.ts +419 -0
- package/Models/DatabaseModels/IncidentEpisodeStateTimeline.ts +524 -0
- package/Models/DatabaseModels/IncidentGroupingRule.ts +1430 -0
- package/Models/DatabaseModels/Index.ts +18 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +70 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.ts +59 -0
- package/Models/DatabaseModels/UserOnCallLog.ts +48 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.ts +49 -0
- package/Models/DatabaseModels/WorkspaceNotificationLog.ts +57 -0
- package/Server/API/IncidentEpisodeAPI.ts +150 -0
- package/Server/API/SlackAPI.ts +23 -0
- package/Server/API/UserOnCallLogTimelineAPI.ts +24 -4
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769626069479-MigrationName.ts +729 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769629928240-MigrationName.ts +261 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769676117342-RenameEvaluateOverTimeInCriteriaFilter.ts +28 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Services/BillingService.ts +1 -3
- package/Server/Services/CallService.ts +1 -0
- package/Server/Services/IncidentEpisodeFeedService.ts +94 -0
- package/Server/Services/IncidentEpisodeInternalNoteService.ts +71 -0
- package/Server/Services/IncidentEpisodeMemberService.ts +321 -0
- package/Server/Services/IncidentEpisodeOwnerTeamService.ts +10 -0
- package/Server/Services/IncidentEpisodeOwnerUserService.ts +10 -0
- package/Server/Services/IncidentEpisodeService.ts +1045 -0
- package/Server/Services/IncidentEpisodeStateTimelineService.ts +566 -0
- package/Server/Services/IncidentGroupingEngineService.ts +1047 -0
- package/Server/Services/IncidentGroupingRuleService.ts +14 -0
- package/Server/Services/IncidentService.ts +11 -0
- package/Server/Services/Index.ts +18 -0
- package/Server/Services/MailService.ts +1 -0
- package/Server/Services/MonitorService.ts +9 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +18 -0
- package/Server/Services/OnCallDutyPolicyExecutionLogService.ts +64 -2
- package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +26 -1
- package/Server/Services/OnCallDutyPolicyService.ts +15 -0
- package/Server/Services/SmsService.ts +1 -0
- package/Server/Services/UserNotificationRuleService.ts +48 -2
- package/Server/Services/UserNotificationSettingService.ts +23 -0
- package/Server/Services/UserOnCallLogService.ts +41 -4
- package/Server/Services/WhatsAppService.ts +1 -0
- package/Server/Services/WorkspaceNotificationLogService.ts +16 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +116 -0
- package/Server/Utils/AI/IncidentEpisodeAIContextBuilder.ts +490 -0
- package/Server/Utils/Monitor/Criteria/APIRequestCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/CompareCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/IncomingRequestCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.ts +2 -2
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +182 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +13 -0
- package/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.ts +1 -1
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +37 -0
- package/Server/Utils/PushNotificationUtil.ts +31 -0
- package/Server/Utils/WhatsAppTemplateUtil.ts +14 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.ts +18 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +702 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +20 -0
- package/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts +11 -0
- package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +918 -0
- package/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.ts +120 -0
- package/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.ts +74 -0
- package/Types/Email/EmailTemplateType.ts +6 -0
- package/Types/Monitor/CriteriaFilter.ts +24 -4
- package/Types/Monitor/MonitorCriteriaInstance.ts +67 -0
- package/Types/Monitor/MonitorStep.ts +37 -0
- package/Types/Monitor/MonitorStepSnmpMonitor.ts +102 -0
- package/Types/Monitor/MonitorType.ts +15 -2
- package/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.ts +8 -0
- package/Types/Monitor/SnmpMonitor/SnmpDataType.ts +21 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +16 -0
- package/Types/Monitor/SnmpMonitor/SnmpOid.ts +60 -0
- package/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.ts +7 -0
- package/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.ts +7 -0
- package/Types/Monitor/SnmpMonitor/SnmpV3Auth.ts +12 -0
- package/Types/Monitor/SnmpMonitor/SnmpVersion.ts +7 -0
- package/Types/NotificationSetting/NotificationSettingEventType.ts +7 -0
- package/Types/Permission.ts +311 -0
- package/Types/Probe/ProbeMonitorResponse.ts +2 -0
- package/Types/UserNotification/UserNotificationEventType.ts +1 -0
- package/Types/WhatsApp/WhatsAppTemplates.ts +24 -0
- package/Types/Workspace/NotificationRules/EventType.ts +1 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +38 -1
- package/Utils/Monitor/MonitorMetricType.ts +2 -1
- package/build/dist/Models/DatabaseModels/Incident.js +78 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js +1250 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeFeed.js +555 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeInternalNote.js +467 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeInternalNote.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js +607 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerTeam.js +437 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerUser.js +436 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js +546 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentGroupingRule.js +1437 -0
- package/build/dist/Models/DatabaseModels/IncidentGroupingRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +16 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +69 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +58 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLog.js +47 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js +58 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +97 -0
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -0
- package/build/dist/Server/API/SlackAPI.js +18 -0
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js +30 -10
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769626069479-MigrationName.js +256 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769626069479-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769629928240-MigrationName.js +96 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769629928240-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769676117342-RenameEvaluateOverTimeInCriteriaFilter.js +25 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769676117342-RenameEvaluateOverTimeInCriteriaFilter.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/BillingService.js +1 -2
- package/build/dist/Server/Services/BillingService.js.map +1 -1
- package/build/dist/Server/Services/CallService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js +83 -0
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeInternalNoteService.js +70 -0
- package/build/dist/Server/Services/IncidentEpisodeInternalNoteService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeMemberService.js +298 -0
- package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerUserService.js +9 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeService.js +933 -0
- package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +498 -0
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -0
- package/build/dist/Server/Services/IncidentGroupingEngineService.js +799 -0
- package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -0
- package/build/dist/Server/Services/IncidentGroupingRuleService.js +13 -0
- package/build/dist/Server/Services/IncidentGroupingRuleService.js.map +1 -0
- package/build/dist/Server/Services/IncidentService.js +10 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +16 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MailService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +9 -1
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +10 -0
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js +48 -2
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +20 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +8 -0
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/SmsService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +39 -2
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +9 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogService.js +35 -3
- package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
- package/build/dist/Server/Services/WhatsAppService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationLogService.js +12 -0
- package/build/dist/Server/Services/WorkspaceNotificationLogService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +95 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js +402 -0
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/IncomingRequestCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js +2 -2
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +135 -0
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +10 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +26 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/PushNotificationUtil.js +20 -0
- package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +8 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js +17 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +547 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +15 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js +10 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +651 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.js +100 -0
- package/build/dist/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.js +70 -0
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.js.map +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js +5 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +16 -3
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +62 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +26 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js +77 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +13 -2
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js +9 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpDataType.js +22 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpDataType.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpOid.js +55 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpOid.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js +8 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js +8 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpV3Auth.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpV3Auth.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js +8 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js.map +1 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +5 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/Permission.js +264 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/UserNotification/UserNotificationEventType.js +1 -0
- package/build/dist/Types/UserNotification/UserNotificationEventType.js.map +1 -1
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +15 -0
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/EventType.js +1 -0
- package/build/dist/Types/Workspace/NotificationRules/EventType.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +33 -1
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js +2 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DatabaseService from "./DatabaseService";
|
|
2
|
+
import Model from "../../Models/DatabaseModels/IncidentGroupingRule";
|
|
3
|
+
import { IsBillingEnabled } from "../EnvironmentConfig";
|
|
4
|
+
|
|
5
|
+
export class Service extends DatabaseService<Model> {
|
|
6
|
+
public constructor() {
|
|
7
|
+
super(Model);
|
|
8
|
+
if (IsBillingEnabled) {
|
|
9
|
+
this.hardDeleteItemsOlderThanInDays("createdAt", 3 * 365); // 3 years
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default new Service();
|
|
@@ -49,6 +49,7 @@ import Semaphore, {
|
|
|
49
49
|
} from "../../Server/Infrastructure/Semaphore";
|
|
50
50
|
import IncidentFeedService from "./IncidentFeedService";
|
|
51
51
|
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
|
|
52
|
+
import IncidentGroupingEngineService from "./IncidentGroupingEngineService";
|
|
52
53
|
import { Blue500, Gray500, Red500 } from "../../Types/BrandColors";
|
|
53
54
|
import Label from "../../Models/DatabaseModels/Label";
|
|
54
55
|
import LabelService from "./LabelService";
|
|
@@ -841,6 +842,16 @@ export class Service extends DatabaseService<Model> {
|
|
|
841
842
|
return Promise.resolve();
|
|
842
843
|
}
|
|
843
844
|
})
|
|
845
|
+
.then(async () => {
|
|
846
|
+
// Process incident for grouping into episodes
|
|
847
|
+
try {
|
|
848
|
+
await IncidentGroupingEngineService.processIncident(createdItem);
|
|
849
|
+
} catch (error) {
|
|
850
|
+
logger.error(
|
|
851
|
+
`Incident grouping failed in IncidentService.onCreateSuccess: ${error}`,
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
})
|
|
844
855
|
.catch((error: Error) => {
|
|
845
856
|
logger.error(
|
|
846
857
|
`Critical error in IncidentService sequential operations: ${error}`,
|
package/Server/Services/Index.ts
CHANGED
|
@@ -167,6 +167,15 @@ import AlertEpisodeMemberService from "./AlertEpisodeMemberService";
|
|
|
167
167
|
import AlertEpisodeOwnerTeamService from "./AlertEpisodeOwnerTeamService";
|
|
168
168
|
import AlertEpisodeOwnerUserService from "./AlertEpisodeOwnerUserService";
|
|
169
169
|
import AlertEpisodeStateTimelineService from "./AlertEpisodeStateTimelineService";
|
|
170
|
+
|
|
171
|
+
// IncidentEpisode Services
|
|
172
|
+
import IncidentEpisodeService from "./IncidentEpisodeService";
|
|
173
|
+
import IncidentEpisodeFeedService from "./IncidentEpisodeFeedService";
|
|
174
|
+
import IncidentEpisodeInternalNoteService from "./IncidentEpisodeInternalNoteService";
|
|
175
|
+
import IncidentEpisodeMemberService from "./IncidentEpisodeMemberService";
|
|
176
|
+
import IncidentEpisodeOwnerTeamService from "./IncidentEpisodeOwnerTeamService";
|
|
177
|
+
import IncidentEpisodeOwnerUserService from "./IncidentEpisodeOwnerUserService";
|
|
178
|
+
import IncidentEpisodeStateTimelineService from "./IncidentEpisodeStateTimelineService";
|
|
170
179
|
import AlertGroupingRuleService from "./AlertGroupingRuleService";
|
|
171
180
|
|
|
172
181
|
import TableViewService from "./TableViewService";
|
|
@@ -370,6 +379,15 @@ const services: Array<BaseService> = [
|
|
|
370
379
|
AlertEpisodeOwnerTeamService,
|
|
371
380
|
AlertEpisodeOwnerUserService,
|
|
372
381
|
AlertEpisodeStateTimelineService,
|
|
382
|
+
|
|
383
|
+
// IncidentEpisode Services
|
|
384
|
+
IncidentEpisodeService,
|
|
385
|
+
IncidentEpisodeFeedService,
|
|
386
|
+
IncidentEpisodeInternalNoteService,
|
|
387
|
+
IncidentEpisodeMemberService,
|
|
388
|
+
IncidentEpisodeOwnerTeamService,
|
|
389
|
+
IncidentEpisodeOwnerUserService,
|
|
390
|
+
IncidentEpisodeStateTimelineService,
|
|
373
391
|
AlertGroupingRuleService,
|
|
374
392
|
|
|
375
393
|
TableViewService,
|
|
@@ -24,6 +24,7 @@ export class MailService extends BaseService {
|
|
|
24
24
|
incidentId?: ObjectID | undefined;
|
|
25
25
|
alertId?: ObjectID | undefined;
|
|
26
26
|
alertEpisodeId?: ObjectID | undefined;
|
|
27
|
+
incidentEpisodeId?: ObjectID | undefined;
|
|
27
28
|
scheduledMaintenanceId?: ObjectID | undefined;
|
|
28
29
|
statusPageId?: ObjectID | undefined;
|
|
29
30
|
statusPageAnnouncementId?: ObjectID | undefined;
|
|
@@ -118,6 +118,15 @@ export class Service extends DatabaseService<Model> {
|
|
|
118
118
|
monitorDestination = `${monitorDestination}:${port}`;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
+
|
|
122
|
+
// For SNMP monitors, use the hostname from snmpMonitor config
|
|
123
|
+
if (monitorType === MonitorType.SNMP && firstStep?.data?.snmpMonitor) {
|
|
124
|
+
monitorDestination = firstStep.data.snmpMonitor.hostname || "";
|
|
125
|
+
const port: number = firstStep.data.snmpMonitor.port || 161;
|
|
126
|
+
if (monitorDestination && port) {
|
|
127
|
+
monitorDestination = `${monitorDestination}:${port}`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
|
|
@@ -111,6 +111,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
111
111
|
triggeredByIncidentId?: ObjectID | undefined;
|
|
112
112
|
triggeredByAlertId?: ObjectID | undefined;
|
|
113
113
|
triggeredByAlertEpisodeId?: ObjectID | undefined;
|
|
114
|
+
triggeredByIncidentEpisodeId?: ObjectID | undefined;
|
|
114
115
|
userNotificationEventType: UserNotificationEventType;
|
|
115
116
|
onCallPolicyExecutionLogId: ObjectID;
|
|
116
117
|
onCallPolicyId: ObjectID;
|
|
@@ -178,6 +179,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
178
179
|
log.triggeredByAlertEpisodeId = options.triggeredByAlertEpisodeId;
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
if (options.triggeredByIncidentEpisodeId) {
|
|
183
|
+
log.triggeredByIncidentEpisodeId =
|
|
184
|
+
options.triggeredByIncidentEpisodeId;
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
return log;
|
|
182
188
|
};
|
|
183
189
|
|
|
@@ -211,6 +217,16 @@ export class Service extends DatabaseService<Model> {
|
|
|
211
217
|
);
|
|
212
218
|
}
|
|
213
219
|
|
|
220
|
+
if (
|
|
221
|
+
UserNotificationEventType.IncidentEpisodeCreated ===
|
|
222
|
+
options.userNotificationEventType &&
|
|
223
|
+
!options.triggeredByIncidentEpisodeId
|
|
224
|
+
) {
|
|
225
|
+
throw new BadDataException(
|
|
226
|
+
"triggeredByIncidentEpisodeId is required when userNotificationEventType is IncidentEpisodeCreated",
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
214
230
|
const usersInRule: Array<OnCallDutyPolicyEscalationRuleUser> =
|
|
215
231
|
await OnCallDutyPolicyEscalationRuleUserService.findBy({
|
|
216
232
|
query: {
|
|
@@ -324,6 +340,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
324
340
|
triggeredByAlertId: options.triggeredByAlertId || undefined,
|
|
325
341
|
triggeredByAlertEpisodeId:
|
|
326
342
|
options.triggeredByAlertEpisodeId || undefined,
|
|
343
|
+
triggeredByIncidentEpisodeId:
|
|
344
|
+
options.triggeredByIncidentEpisodeId || undefined,
|
|
327
345
|
onCallPolicyExecutionLogId: options.onCallPolicyExecutionLogId,
|
|
328
346
|
onCallPolicyId: options.onCallPolicyId,
|
|
329
347
|
onCallPolicyEscalationRuleId: ruleId,
|
|
@@ -19,10 +19,13 @@ import AlertFeedService from "./AlertFeedService";
|
|
|
19
19
|
import { AlertFeedEventType } from "../../Models/DatabaseModels/AlertFeed";
|
|
20
20
|
import AlertEpisodeFeedService from "./AlertEpisodeFeedService";
|
|
21
21
|
import { AlertEpisodeFeedEventType } from "../../Models/DatabaseModels/AlertEpisodeFeed";
|
|
22
|
+
import IncidentEpisodeFeedService from "./IncidentEpisodeFeedService";
|
|
23
|
+
import { IncidentEpisodeFeedEventType } from "../../Models/DatabaseModels/IncidentEpisodeFeed";
|
|
22
24
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
23
25
|
import IncidentService from "./IncidentService";
|
|
24
26
|
import AlertService from "./AlertService";
|
|
25
27
|
import AlertEpisodeService from "./AlertEpisodeService";
|
|
28
|
+
import IncidentEpisodeService from "./IncidentEpisodeService";
|
|
26
29
|
|
|
27
30
|
export class Service extends DatabaseService<Model> {
|
|
28
31
|
public constructor() {
|
|
@@ -61,7 +64,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
61
64
|
if (
|
|
62
65
|
createdItem.triggeredByIncidentId ||
|
|
63
66
|
createdItem.triggeredByAlertId ||
|
|
64
|
-
createdItem.triggeredByAlertEpisodeId
|
|
67
|
+
createdItem.triggeredByAlertEpisodeId ||
|
|
68
|
+
createdItem.triggeredByIncidentEpisodeId
|
|
65
69
|
) {
|
|
66
70
|
const onCallPolicy: OnCallDutyPolicy | null =
|
|
67
71
|
await OnCallDutyPolicyService.findOneById({
|
|
@@ -105,6 +109,14 @@ export class Service extends DatabaseService<Model> {
|
|
|
105
109
|
incidentOrAlertLink = `[Alert Episode ${episodeNumber}](${(await AlertEpisodeService.getEpisodeLinkInDashboard(createdItem.projectId!, createdItem.triggeredByAlertEpisodeId)).toString()})`;
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
if (createdItem.triggeredByIncidentEpisodeId) {
|
|
113
|
+
const episodeNumber: number | null =
|
|
114
|
+
await IncidentEpisodeService.getEpisodeNumber({
|
|
115
|
+
episodeId: createdItem.triggeredByIncidentEpisodeId,
|
|
116
|
+
});
|
|
117
|
+
incidentOrAlertLink = `[Incident Episode ${episodeNumber}](${(await IncidentEpisodeService.getEpisodeLinkInDashboard(createdItem.projectId!, createdItem.triggeredByIncidentEpisodeId)).toString()})`;
|
|
118
|
+
}
|
|
119
|
+
|
|
108
120
|
const feedInfoInMarkdown: string = `**📞 On Call Policy Started Executing:** On Call Policy **${onCallPolicy.name}** started executing for ${incidentOrAlertLink}. Users on call on this policy will now be notified.`;
|
|
109
121
|
|
|
110
122
|
if (
|
|
@@ -147,6 +159,21 @@ export class Service extends DatabaseService<Model> {
|
|
|
147
159
|
feedInfoInMarkdown: feedInfoInMarkdown,
|
|
148
160
|
});
|
|
149
161
|
}
|
|
162
|
+
|
|
163
|
+
if (
|
|
164
|
+
onCallPolicy &&
|
|
165
|
+
onCallPolicy.id &&
|
|
166
|
+
createdItem.triggeredByIncidentEpisodeId
|
|
167
|
+
) {
|
|
168
|
+
await IncidentEpisodeFeedService.createIncidentEpisodeFeedItem({
|
|
169
|
+
incidentEpisodeId: createdItem.triggeredByIncidentEpisodeId,
|
|
170
|
+
projectId: createdItem.projectId!,
|
|
171
|
+
incidentEpisodeFeedEventType:
|
|
172
|
+
IncidentEpisodeFeedEventType.OnCallPolicy,
|
|
173
|
+
displayColor: Yellow500,
|
|
174
|
+
feedInfoInMarkdown: feedInfoInMarkdown,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
150
177
|
}
|
|
151
178
|
}
|
|
152
179
|
|
|
@@ -193,6 +220,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
193
220
|
UserNotificationEventType.AlertEpisodeCreated;
|
|
194
221
|
}
|
|
195
222
|
|
|
223
|
+
if (createdItem.triggeredByIncidentEpisodeId) {
|
|
224
|
+
userNotificationEventType =
|
|
225
|
+
UserNotificationEventType.IncidentEpisodeCreated;
|
|
226
|
+
}
|
|
227
|
+
|
|
196
228
|
if (!userNotificationEventType) {
|
|
197
229
|
throw new BadDataException("Invalid userNotificationEventType");
|
|
198
230
|
}
|
|
@@ -204,6 +236,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
204
236
|
triggeredByIncidentId: createdItem.triggeredByIncidentId,
|
|
205
237
|
triggeredByAlertId: createdItem.triggeredByAlertId,
|
|
206
238
|
triggeredByAlertEpisodeId: createdItem.triggeredByAlertEpisodeId,
|
|
239
|
+
triggeredByIncidentEpisodeId:
|
|
240
|
+
createdItem.triggeredByIncidentEpisodeId,
|
|
207
241
|
userNotificationEventType: userNotificationEventType,
|
|
208
242
|
onCallPolicyExecutionLogId: createdItem.id!,
|
|
209
243
|
onCallPolicyId: createdItem.onCallDutyPolicyId!,
|
|
@@ -292,6 +326,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
292
326
|
triggeredByIncidentId: true,
|
|
293
327
|
triggeredByAlertId: true,
|
|
294
328
|
triggeredByAlertEpisodeId: true,
|
|
329
|
+
triggeredByIncidentEpisodeId: true,
|
|
295
330
|
},
|
|
296
331
|
props: {
|
|
297
332
|
isRoot: true,
|
|
@@ -303,7 +338,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
303
338
|
onCalldutyPolicyExecutionLog &&
|
|
304
339
|
(onCalldutyPolicyExecutionLog.triggeredByIncidentId ||
|
|
305
340
|
onCalldutyPolicyExecutionLog.triggeredByAlertId ||
|
|
306
|
-
onCalldutyPolicyExecutionLog.triggeredByAlertEpisodeId
|
|
341
|
+
onCalldutyPolicyExecutionLog.triggeredByAlertEpisodeId ||
|
|
342
|
+
onCalldutyPolicyExecutionLog.triggeredByIncidentEpisodeId)
|
|
307
343
|
) {
|
|
308
344
|
const onCallPolicy: OnCallDutyPolicy | null =
|
|
309
345
|
await OnCallDutyPolicyService.findOneById({
|
|
@@ -354,6 +390,15 @@ export class Service extends DatabaseService<Model> {
|
|
|
354
390
|
incidentOrAlertLink = `[Alert Episode ${episodeNumber}](${(await AlertEpisodeService.getEpisodeLinkInDashboard(onCalldutyPolicyExecutionLog.projectId!, onCalldutyPolicyExecutionLog.triggeredByAlertEpisodeId)).toString()})`;
|
|
355
391
|
}
|
|
356
392
|
|
|
393
|
+
if (onCalldutyPolicyExecutionLog.triggeredByIncidentEpisodeId) {
|
|
394
|
+
const episodeNumber: number | null =
|
|
395
|
+
await IncidentEpisodeService.getEpisodeNumber({
|
|
396
|
+
episodeId:
|
|
397
|
+
onCalldutyPolicyExecutionLog.triggeredByIncidentEpisodeId,
|
|
398
|
+
});
|
|
399
|
+
incidentOrAlertLink = `[Incident Episode ${episodeNumber}](${(await IncidentEpisodeService.getEpisodeLinkInDashboard(onCalldutyPolicyExecutionLog.projectId!, onCalldutyPolicyExecutionLog.triggeredByIncidentEpisodeId)).toString()})`;
|
|
400
|
+
}
|
|
401
|
+
|
|
357
402
|
const feedInfoInMarkdown: string = `**${this.getEmojiByStatus(onCalldutyPolicyExecutionLog.status)} On Call Policy Status Updated for ${incidentOrAlertLink}:**
|
|
358
403
|
|
|
359
404
|
On-call policy **[${onCallPolicy.name?.toString()}](${(await OnCallDutyPolicyService.getOnCallDutyPolicyLinkInDashboard(onCallPolicy.projectId!, onCallPolicy.id!)).toString()})** status updated to **${onCalldutyPolicyExecutionLog.status}**`;
|
|
@@ -406,6 +451,23 @@ export class Service extends DatabaseService<Model> {
|
|
|
406
451
|
feedInfoInMarkdown: feedInfoInMarkdown,
|
|
407
452
|
});
|
|
408
453
|
}
|
|
454
|
+
|
|
455
|
+
if (onCalldutyPolicyExecutionLog.triggeredByIncidentEpisodeId) {
|
|
456
|
+
await IncidentEpisodeFeedService.createIncidentEpisodeFeedItem({
|
|
457
|
+
incidentEpisodeId:
|
|
458
|
+
onCalldutyPolicyExecutionLog.triggeredByIncidentEpisodeId,
|
|
459
|
+
projectId: onCalldutyPolicyExecutionLog.projectId!,
|
|
460
|
+
incidentEpisodeFeedEventType:
|
|
461
|
+
IncidentEpisodeFeedEventType.OnCallPolicy,
|
|
462
|
+
displayColor: onCalldutyPolicyExecutionLog.status
|
|
463
|
+
? this.getDisplayColorByStatus(
|
|
464
|
+
onCalldutyPolicyExecutionLog.status,
|
|
465
|
+
)
|
|
466
|
+
: Blue500,
|
|
467
|
+
moreInformationInMarkdown: moreInformationInMarkdown,
|
|
468
|
+
feedInfoInMarkdown: feedInfoInMarkdown,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
409
471
|
}
|
|
410
472
|
}
|
|
411
473
|
}
|
|
@@ -13,9 +13,12 @@ import AlertFeedService from "./AlertFeedService";
|
|
|
13
13
|
import { AlertFeedEventType } from "../../Models/DatabaseModels/AlertFeed";
|
|
14
14
|
import AlertEpisodeFeedService from "./AlertEpisodeFeedService";
|
|
15
15
|
import { AlertEpisodeFeedEventType } from "../../Models/DatabaseModels/AlertEpisodeFeed";
|
|
16
|
+
import IncidentEpisodeFeedService from "./IncidentEpisodeFeedService";
|
|
17
|
+
import { IncidentEpisodeFeedEventType } from "../../Models/DatabaseModels/IncidentEpisodeFeed";
|
|
16
18
|
import OnCallDutyPolicyService from "./OnCallDutyPolicyService";
|
|
17
19
|
import AlertService from "./AlertService";
|
|
18
20
|
import AlertEpisodeService from "./AlertEpisodeService";
|
|
21
|
+
import IncidentEpisodeService from "./IncidentEpisodeService";
|
|
19
22
|
import IncidentService from "./IncidentService";
|
|
20
23
|
import UserService from "./UserService";
|
|
21
24
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
@@ -130,7 +133,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
130
133
|
if (
|
|
131
134
|
!onCallDutyPolicyExecutionLogTimeline.triggeredByIncidentId &&
|
|
132
135
|
!onCallDutyPolicyExecutionLogTimeline.triggeredByAlertId &&
|
|
133
|
-
!onCallDutyPolicyExecutionLogTimeline.triggeredByAlertEpisodeId
|
|
136
|
+
!onCallDutyPolicyExecutionLogTimeline.triggeredByAlertEpisodeId &&
|
|
137
|
+
!onCallDutyPolicyExecutionLogTimeline.triggeredByIncidentEpisodeId
|
|
134
138
|
) {
|
|
135
139
|
return;
|
|
136
140
|
}
|
|
@@ -186,6 +190,15 @@ export class Service extends DatabaseService<Model> {
|
|
|
186
190
|
incidentOrAlertLink = `[Alert Episode ${episodeNumber}](${(await AlertEpisodeService.getEpisodeLinkInDashboard(onCallDutyPolicyExecutionLogTimeline.projectId!, onCallDutyPolicyExecutionLogTimeline.triggeredByAlertEpisodeId)).toString()})`;
|
|
187
191
|
}
|
|
188
192
|
|
|
193
|
+
if (onCallDutyPolicyExecutionLogTimeline.triggeredByIncidentEpisodeId) {
|
|
194
|
+
const episodeNumber: number | null =
|
|
195
|
+
await IncidentEpisodeService.getEpisodeNumber({
|
|
196
|
+
episodeId:
|
|
197
|
+
onCallDutyPolicyExecutionLogTimeline.triggeredByIncidentEpisodeId,
|
|
198
|
+
});
|
|
199
|
+
incidentOrAlertLink = `[Incident Episode ${episodeNumber}](${(await IncidentEpisodeService.getEpisodeLinkInDashboard(onCallDutyPolicyExecutionLogTimeline.projectId!, onCallDutyPolicyExecutionLogTimeline.triggeredByIncidentEpisodeId)).toString()})`;
|
|
200
|
+
}
|
|
201
|
+
|
|
189
202
|
let feedInfoInMarkdown: string = `**${this.getEmojiBasedOnStatus(status)} ${incidentOrAlertLink} On-Call Alert ${status} to ${await UserService.getUserMarkdownString(
|
|
190
203
|
{
|
|
191
204
|
userId: onCallDutyPolicyExecutionLogTimeline.alertSentToUserId!,
|
|
@@ -250,6 +263,18 @@ The on-call policy **[${onCallDutyPolicyExecutionLogTimeline.onCallDutyPolicy.na
|
|
|
250
263
|
});
|
|
251
264
|
}
|
|
252
265
|
|
|
266
|
+
if (onCallDutyPolicyExecutionLogTimeline.triggeredByIncidentEpisodeId) {
|
|
267
|
+
await IncidentEpisodeFeedService.createIncidentEpisodeFeedItem({
|
|
268
|
+
incidentEpisodeId:
|
|
269
|
+
onCallDutyPolicyExecutionLogTimeline.triggeredByIncidentEpisodeId,
|
|
270
|
+
projectId: onCallDutyPolicyExecutionLogTimeline.projectId!,
|
|
271
|
+
incidentEpisodeFeedEventType:
|
|
272
|
+
IncidentEpisodeFeedEventType.OnCallNotification,
|
|
273
|
+
displayColor: displayColor,
|
|
274
|
+
feedInfoInMarkdown: feedInfoInMarkdown,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
253
278
|
logger.debug("Incident Feed created");
|
|
254
279
|
}
|
|
255
280
|
}
|
|
@@ -264,6 +264,7 @@ ${onCallPolicy.description || "No description provided."}
|
|
|
264
264
|
triggeredByIncidentId?: ObjectID | undefined;
|
|
265
265
|
triggeredByAlertId?: ObjectID | undefined;
|
|
266
266
|
triggeredByAlertEpisodeId?: ObjectID | undefined;
|
|
267
|
+
triggeredByIncidentEpisodeId?: ObjectID | undefined;
|
|
267
268
|
userNotificationEventType: UserNotificationEventType;
|
|
268
269
|
},
|
|
269
270
|
): Promise<void> {
|
|
@@ -299,6 +300,16 @@ ${onCallPolicy.description || "No description provided."}
|
|
|
299
300
|
);
|
|
300
301
|
}
|
|
301
302
|
|
|
303
|
+
if (
|
|
304
|
+
UserNotificationEventType.IncidentEpisodeCreated ===
|
|
305
|
+
options.userNotificationEventType &&
|
|
306
|
+
!options.triggeredByIncidentEpisodeId
|
|
307
|
+
) {
|
|
308
|
+
throw new BadDataException(
|
|
309
|
+
"triggeredByIncidentEpisodeId is required when userNotificationEventType is IncidentEpisodeCreated",
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
302
313
|
const policy: OnCallDutyPolicy | null = await this.findOneById({
|
|
303
314
|
id: policyId,
|
|
304
315
|
select: {
|
|
@@ -338,6 +349,10 @@ ${onCallPolicy.description || "No description provided."}
|
|
|
338
349
|
log.triggeredByAlertEpisodeId = options.triggeredByAlertEpisodeId;
|
|
339
350
|
}
|
|
340
351
|
|
|
352
|
+
if (options.triggeredByIncidentEpisodeId) {
|
|
353
|
+
log.triggeredByIncidentEpisodeId = options.triggeredByIncidentEpisodeId;
|
|
354
|
+
}
|
|
355
|
+
|
|
341
356
|
await OnCallDutyPolicyExecutionLogService.create({
|
|
342
357
|
data: log,
|
|
343
358
|
props: {
|
|
@@ -29,6 +29,7 @@ export class SmsService extends BaseService {
|
|
|
29
29
|
incidentId?: ObjectID | undefined;
|
|
30
30
|
alertId?: ObjectID | undefined;
|
|
31
31
|
alertEpisodeId?: ObjectID | undefined;
|
|
32
|
+
incidentEpisodeId?: ObjectID | undefined;
|
|
32
33
|
scheduledMaintenanceId?: ObjectID | undefined;
|
|
33
34
|
statusPageId?: ObjectID | undefined;
|
|
34
35
|
statusPageAnnouncementId?: ObjectID | undefined;
|
|
@@ -56,6 +56,8 @@ import AlertEpisode from "../../Models/DatabaseModels/AlertEpisode";
|
|
|
56
56
|
import AlertEpisodeService from "./AlertEpisodeService";
|
|
57
57
|
import AlertEpisodeMember from "../../Models/DatabaseModels/AlertEpisodeMember";
|
|
58
58
|
import AlertEpisodeMemberService from "./AlertEpisodeMemberService";
|
|
59
|
+
import IncidentEpisode from "../../Models/DatabaseModels/IncidentEpisode";
|
|
60
|
+
import IncidentEpisodeService from "./IncidentEpisodeService";
|
|
59
61
|
import WorkspaceNotificationRule from "../../Models/DatabaseModels/WorkspaceNotificationRule";
|
|
60
62
|
import WorkspaceNotificationRuleService from "./WorkspaceNotificationRuleService";
|
|
61
63
|
import PushNotificationService from "./PushNotificationService";
|
|
@@ -79,6 +81,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
79
81
|
triggeredByIncidentId?: ObjectID | undefined;
|
|
80
82
|
triggeredByAlertId?: ObjectID | undefined;
|
|
81
83
|
triggeredByAlertEpisodeId?: ObjectID | undefined;
|
|
84
|
+
triggeredByIncidentEpisodeId?: ObjectID | undefined;
|
|
82
85
|
userNotificationEventType: UserNotificationEventType;
|
|
83
86
|
onCallPolicyExecutionLogId?: ObjectID | undefined;
|
|
84
87
|
onCallPolicyId: ObjectID | undefined;
|
|
@@ -212,6 +215,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
212
215
|
options.triggeredByAlertEpisodeId;
|
|
213
216
|
}
|
|
214
217
|
|
|
218
|
+
if (options.triggeredByIncidentEpisodeId) {
|
|
219
|
+
logTimelineItem.triggeredByIncidentEpisodeId =
|
|
220
|
+
options.triggeredByIncidentEpisodeId;
|
|
221
|
+
}
|
|
222
|
+
|
|
215
223
|
if (options.onCallDutyPolicyExecutionLogTimelineId) {
|
|
216
224
|
logTimelineItem.onCallDutyPolicyExecutionLogTimelineId =
|
|
217
225
|
options.onCallDutyPolicyExecutionLogTimelineId;
|
|
@@ -312,9 +320,41 @@ export class Service extends DatabaseService<Model> {
|
|
|
312
320
|
});
|
|
313
321
|
}
|
|
314
322
|
|
|
315
|
-
|
|
323
|
+
let incidentEpisode: IncidentEpisode | null = null;
|
|
324
|
+
|
|
325
|
+
if (
|
|
326
|
+
options.userNotificationEventType ===
|
|
327
|
+
UserNotificationEventType.IncidentEpisodeCreated &&
|
|
328
|
+
options.triggeredByIncidentEpisodeId
|
|
329
|
+
) {
|
|
330
|
+
incidentEpisode = await IncidentEpisodeService.findOneById({
|
|
331
|
+
id: options.triggeredByIncidentEpisodeId!,
|
|
332
|
+
props: {
|
|
333
|
+
isRoot: true,
|
|
334
|
+
},
|
|
335
|
+
select: {
|
|
336
|
+
_id: true,
|
|
337
|
+
title: true,
|
|
338
|
+
description: true,
|
|
339
|
+
projectId: true,
|
|
340
|
+
project: {
|
|
341
|
+
name: true,
|
|
342
|
+
},
|
|
343
|
+
currentIncidentState: {
|
|
344
|
+
name: true,
|
|
345
|
+
},
|
|
346
|
+
incidentSeverity: {
|
|
347
|
+
name: true,
|
|
348
|
+
},
|
|
349
|
+
episodeNumber: true,
|
|
350
|
+
rootCause: true,
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (!incident && !alert && !alertEpisode && !incidentEpisode) {
|
|
316
356
|
throw new BadDataException(
|
|
317
|
-
"Incident, Alert, or
|
|
357
|
+
"Incident, Alert, Alert Episode, or Incident Episode not found.",
|
|
318
358
|
);
|
|
319
359
|
}
|
|
320
360
|
|
|
@@ -1969,6 +2009,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
1969
2009
|
triggeredByIncidentId?: ObjectID | undefined;
|
|
1970
2010
|
triggeredByAlertId?: ObjectID | undefined;
|
|
1971
2011
|
triggeredByAlertEpisodeId?: ObjectID | undefined;
|
|
2012
|
+
triggeredByIncidentEpisodeId?: ObjectID | undefined;
|
|
1972
2013
|
userNotificationEventType: UserNotificationEventType;
|
|
1973
2014
|
onCallPolicyExecutionLogId?: ObjectID | undefined;
|
|
1974
2015
|
onCallPolicyId: ObjectID | undefined;
|
|
@@ -1998,6 +2039,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
1998
2039
|
options.triggeredByAlertEpisodeId;
|
|
1999
2040
|
}
|
|
2000
2041
|
|
|
2042
|
+
if (options.triggeredByIncidentEpisodeId) {
|
|
2043
|
+
userOnCallLog.triggeredByIncidentEpisodeId =
|
|
2044
|
+
options.triggeredByIncidentEpisodeId;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2001
2047
|
userOnCallLog.userNotificationEventType = options.userNotificationEventType;
|
|
2002
2048
|
|
|
2003
2049
|
if (options.onCallPolicyExecutionLogId) {
|
|
@@ -50,6 +50,7 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
50
50
|
incidentId?: ObjectID | undefined;
|
|
51
51
|
alertId?: ObjectID | undefined;
|
|
52
52
|
alertEpisodeId?: ObjectID | undefined;
|
|
53
|
+
incidentEpisodeId?: ObjectID | undefined;
|
|
53
54
|
scheduledMaintenanceId?: ObjectID | undefined;
|
|
54
55
|
statusPageId?: ObjectID | undefined;
|
|
55
56
|
statusPageAnnouncementId?: ObjectID | undefined;
|
|
@@ -115,6 +116,7 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
115
116
|
incidentId: data.incidentId,
|
|
116
117
|
alertId: data.alertId,
|
|
117
118
|
alertEpisodeId: data.alertEpisodeId,
|
|
119
|
+
incidentEpisodeId: data.incidentEpisodeId,
|
|
118
120
|
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
119
121
|
statusPageId: data.statusPageId,
|
|
120
122
|
statusPageAnnouncementId: data.statusPageAnnouncementId,
|
|
@@ -161,6 +163,7 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
161
163
|
incidentId: data.incidentId,
|
|
162
164
|
alertId: data.alertId,
|
|
163
165
|
alertEpisodeId: data.alertEpisodeId,
|
|
166
|
+
incidentEpisodeId: data.incidentEpisodeId,
|
|
164
167
|
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
165
168
|
statusPageId: data.statusPageId,
|
|
166
169
|
statusPageAnnouncementId: data.statusPageAnnouncementId,
|
|
@@ -214,6 +217,7 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
214
217
|
incidentId: data.incidentId,
|
|
215
218
|
alertId: data.alertId,
|
|
216
219
|
alertEpisodeId: data.alertEpisodeId,
|
|
220
|
+
incidentEpisodeId: data.incidentEpisodeId,
|
|
217
221
|
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
218
222
|
statusPageId: data.statusPageId,
|
|
219
223
|
statusPageAnnouncementId: data.statusPageAnnouncementId,
|
|
@@ -259,6 +263,7 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
259
263
|
incidentId: data.incidentId,
|
|
260
264
|
alertId: data.alertId,
|
|
261
265
|
alertEpisodeId: data.alertEpisodeId,
|
|
266
|
+
incidentEpisodeId: data.incidentEpisodeId,
|
|
262
267
|
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
263
268
|
statusPageId: data.statusPageId,
|
|
264
269
|
statusPageAnnouncementId: data.statusPageAnnouncementId,
|
|
@@ -346,6 +351,7 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
346
351
|
await this.addOnCallNotificationSettings(userId, projectId);
|
|
347
352
|
await this.addAlertNotificationSettings(userId, projectId);
|
|
348
353
|
await this.addAlertEpisodeNotificationSettings(userId, projectId);
|
|
354
|
+
await this.addIncidentEpisodeNotificationSettings(userId, projectId);
|
|
349
355
|
}
|
|
350
356
|
|
|
351
357
|
private async addProbeOwnerNotificationSettings(
|
|
@@ -474,6 +480,23 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
474
480
|
);
|
|
475
481
|
}
|
|
476
482
|
|
|
483
|
+
private async addIncidentEpisodeNotificationSettings(
|
|
484
|
+
userId: ObjectID,
|
|
485
|
+
projectId: ObjectID,
|
|
486
|
+
): Promise<void> {
|
|
487
|
+
await this.addNotificationSettingIfNotExists(
|
|
488
|
+
userId,
|
|
489
|
+
projectId,
|
|
490
|
+
NotificationSettingEventType.SEND_INCIDENT_EPISODE_CREATED_OWNER_NOTIFICATION,
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
await this.addNotificationSettingIfNotExists(
|
|
494
|
+
userId,
|
|
495
|
+
projectId,
|
|
496
|
+
NotificationSettingEventType.SEND_INCIDENT_EPISODE_STATE_CHANGED_OWNER_NOTIFICATION,
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
|
|
477
500
|
private async addNotificationSettingIfNotExists(
|
|
478
501
|
userId: ObjectID,
|
|
479
502
|
projectId: ObjectID,
|
|
@@ -21,6 +21,8 @@ import Alert from "../../Models/DatabaseModels/Alert";
|
|
|
21
21
|
import AlertService from "./AlertService";
|
|
22
22
|
import AlertEpisode from "../../Models/DatabaseModels/AlertEpisode";
|
|
23
23
|
import AlertEpisodeService from "./AlertEpisodeService";
|
|
24
|
+
import IncidentEpisode from "../../Models/DatabaseModels/IncidentEpisode";
|
|
25
|
+
import IncidentEpisodeService from "./IncidentEpisodeService";
|
|
24
26
|
|
|
25
27
|
export class Service extends DatabaseService<Model> {
|
|
26
28
|
public constructor() {
|
|
@@ -206,6 +208,34 @@ export class Service extends DatabaseService<Model> {
|
|
|
206
208
|
});
|
|
207
209
|
}
|
|
208
210
|
|
|
211
|
+
// get rule count for incident episodes.
|
|
212
|
+
let incidentEpisode: IncidentEpisode | null = null;
|
|
213
|
+
if (createdItem.triggeredByIncidentEpisodeId) {
|
|
214
|
+
incidentEpisode = await IncidentEpisodeService.findOneById({
|
|
215
|
+
id: createdItem.triggeredByIncidentEpisodeId,
|
|
216
|
+
props: {
|
|
217
|
+
isRoot: true,
|
|
218
|
+
},
|
|
219
|
+
select: {
|
|
220
|
+
incidentSeverityId: true,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
ruleCount = await UserNotificationRuleService.countBy({
|
|
225
|
+
query: {
|
|
226
|
+
userId: createdItem.userId!,
|
|
227
|
+
projectId: createdItem.projectId!,
|
|
228
|
+
ruleType: notificationRuleType,
|
|
229
|
+
incidentSeverityId: incidentEpisode?.incidentSeverityId as ObjectID,
|
|
230
|
+
},
|
|
231
|
+
skip: 0,
|
|
232
|
+
limit: LIMIT_PER_PROJECT,
|
|
233
|
+
props: {
|
|
234
|
+
isRoot: true,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
209
239
|
if (ruleCount.toNumber() === 0) {
|
|
210
240
|
// update this item to be processed.
|
|
211
241
|
await this.updateOneById({
|
|
@@ -239,6 +269,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
239
269
|
/*
|
|
240
270
|
* find immediate notification rule and alert the user.
|
|
241
271
|
* Determine the alertSeverityId - can come from alert or alertEpisode
|
|
272
|
+
* Determine the incidentSeverityId - can come from incident or incidentEpisode
|
|
242
273
|
*/
|
|
243
274
|
const alertSeverityIdForQuery: ObjectID | undefined =
|
|
244
275
|
alert && alert.alertSeverityId
|
|
@@ -247,6 +278,13 @@ export class Service extends DatabaseService<Model> {
|
|
|
247
278
|
? (alertEpisode.alertSeverityId as ObjectID)
|
|
248
279
|
: undefined;
|
|
249
280
|
|
|
281
|
+
const incidentSeverityIdForQuery: ObjectID | undefined =
|
|
282
|
+
incident && incident.incidentSeverityId
|
|
283
|
+
? (incident.incidentSeverityId as ObjectID)
|
|
284
|
+
: incidentEpisode && incidentEpisode.incidentSeverityId
|
|
285
|
+
? (incidentEpisode.incidentSeverityId as ObjectID)
|
|
286
|
+
: undefined;
|
|
287
|
+
|
|
250
288
|
const immediateNotificationRule: Array<UserNotificationRule> =
|
|
251
289
|
await UserNotificationRuleService.findBy({
|
|
252
290
|
query: {
|
|
@@ -254,10 +292,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
254
292
|
projectId: createdItem.projectId!,
|
|
255
293
|
notifyAfterMinutes: 0,
|
|
256
294
|
ruleType: notificationRuleType,
|
|
257
|
-
incidentSeverityId:
|
|
258
|
-
incident && incident.incidentSeverityId
|
|
259
|
-
? (incident?.incidentSeverityId as ObjectID)
|
|
260
|
-
: undefined,
|
|
295
|
+
incidentSeverityId: incidentSeverityIdForQuery,
|
|
261
296
|
alertSeverityId: alertSeverityIdForQuery,
|
|
262
297
|
},
|
|
263
298
|
select: {
|
|
@@ -279,6 +314,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
279
314
|
triggeredByIncidentId: createdItem.triggeredByIncidentId,
|
|
280
315
|
triggeredByAlertId: createdItem.triggeredByAlertId,
|
|
281
316
|
triggeredByAlertEpisodeId: createdItem.triggeredByAlertEpisodeId,
|
|
317
|
+
triggeredByIncidentEpisodeId:
|
|
318
|
+
createdItem.triggeredByIncidentEpisodeId,
|
|
282
319
|
userNotificationEventType: createdItem.userNotificationEventType!,
|
|
283
320
|
onCallPolicyExecutionLogId:
|
|
284
321
|
createdItem.onCallDutyPolicyExecutionLogId,
|
|
@@ -27,6 +27,7 @@ export class WhatsAppService extends BaseService {
|
|
|
27
27
|
incidentId?: ObjectID | undefined;
|
|
28
28
|
alertId?: ObjectID | undefined;
|
|
29
29
|
alertEpisodeId?: ObjectID | undefined;
|
|
30
|
+
incidentEpisodeId?: ObjectID | undefined;
|
|
30
31
|
scheduledMaintenanceId?: ObjectID | undefined;
|
|
31
32
|
statusPageId?: ObjectID | undefined;
|
|
32
33
|
statusPageAnnouncementId?: ObjectID | undefined;
|