INFRA-3098 : Auto escalate refactor (#409)

* INFRA-3098 : Auto escalate refactor

* INFRA-3098 : Delete old cron code

* INFRA-2887 : File and api name changes

* INFRA-2887 : Code review comments
This commit is contained in:
Vijay Joshi
2024-03-27 19:06:22 +05:30
committed by GitHub
parent 164a29cb86
commit a8a0d44da9
12 changed files with 280 additions and 152 deletions

View File

@@ -135,6 +135,18 @@ func (handler *IncidentHandler) HandleResolveIncident(c *gin.Context) {
c.JSON(http.StatusOK, common.SuccessResponse("Incident resolved successfully", http.StatusOK))
}
func (handler *IncidentHandler) HandleEscalateIncident(c *gin.Context) {
err := handler.service.EscalateIncidents()
if err != nil {
logger.Error(fmt.Sprintf("%s failed to escalate incidents", logTag), zap.Error(err))
metrics.PublishHoustonFlowFailureMetrics(incidentService.ESCALATE_INCIDENT, err.Error())
c.JSON(http.StatusInternalServerError, common.ErrorResponse(err, http.StatusInternalServerError, nil))
return
}
c.JSON(http.StatusOK, common.SuccessResponse("Incidents escalated successfully", http.StatusOK))
}
func (handler *IncidentHandler) HandleJiraLinking(c *gin.Context) {
var linkJiraRequest request.LinkJiraRequest
if err := c.ShouldBindJSON(&linkJiraRequest); err != nil {

View File

@@ -218,6 +218,7 @@ func (s *Server) incidentClientHandlerV2(houstonGroup *gin.RouterGroup) {
s.gin.POST("/incidents", authService.IfValidHoustonUser(incidentHandler.HandleUpdateIncident))
houstonGroup.POST("/incidents", incidentHandler.HandleUpdateIncident)
houstonGroup.POST("/incidents/resolve", authService.IfValidHoustonUser(incidentHandler.HandleResolveIncident))
houstonGroup.POST("/incidents/escalate", incidentHandler.HandleEscalateIncident)
houstonGroup.POST("/link-jira-to-incident", incidentHandler.HandleJiraLinking)
houstonGroup.POST("/unlink-jira-from-incident", incidentHandler.HandleJiraUnLinking)
houstonGroup.GET("/get-jira-statuses", incidentHandler.HandleGetJiraStatuses)