ShivamSharma43 opened a new issue, #9388:
URL: https://github.com/apache/devlake/issues/9388

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/devlake/issues?q=is%3Aissue) and found no 
similar issues.
   
   ### What happened
   
   The Opsgenie `convertIncidents` subtask 
(`plugins/opsgenie/tasks/incidents_converter.go`) maps closed incidents to 
`OTHER` and leaves them without a resolution date.
   
   Opsgenie incidents have three statuses, `open`, `resolved` and `closed` 
(`models.IncidentStatus*`). A closed incident is finished, the same as a 
resolved one, but the converter treats it as neither open nor done:
   
   ```go
   func getStatus(incident *models.Incident) string {
        if incident.Status == models.IncidentStatusClosed {
                return ticket.OTHER
        }
        ...
        if incident.Status == models.IncidentStatusResolved {
                return ticket.DONE
        }
   ```
   
   and `getTimes` only sets `resolution_date` and `lead_time_minutes` for 
`resolved`.
   
   So every closed Opsgenie incident ends up in `issues` with `status = 
'OTHER'`, `resolution_date = NULL` and `lead_time_minutes = NULL`. Metrics that 
use the resolution date, such as DORA's failed deployment recovery time, leave 
closed incidents out, and they don't count as done in issue status breakdowns.
   
   ### What do you expect to happen
   
   Closed incidents are converted like resolved ones: `status = 'DONE'`, with 
`resolution_date` and `lead_time_minutes` set from the incident's `updatedAt`, 
as is already done for resolved incidents. `original_status` keeps `closed`.
   
   ### How to reproduce
   
   1. Close an incident in Opsgenie (or have one with `"status": "closed"` in 
`_raw_opsgenie_incidents`).
   2. Collect the Opsgenie service and run the convert incidents subtask.
   3. The incident's row in `issues` has `status = OTHER` and no 
`resolution_date` / `lead_time_minutes`.
   
   ### Anything else
   
   Proposed fix (I have a PR ready): treat `closed` like `resolved` in 
`getStatus` and `getTimes`, with unit tests for both.
   
   ### Version
   
   main
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to