Skip to content

Native Jira Integration: JQL Query Excludes Unresolved Issues When Using wont_fix_resolution #4295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eyeteekay opened this issue Mar 5, 2025 · 2 comments · May be fixed by #4370
Open

Comments

@eyeteekay
Copy link

JQL Query Excludes Unresolved Issues When Using wont_fix_resolution

Description

When defining a wont_fix_resolution, the JQL query used in Alertmanager 0.28 (as seen in the debug output) is:

jql="resolution != \"Won't Do\" and (resolutiondate is EMPTY OR resolutiondate >= -1440m) and project=\"TEST\" and labels=\"ALERT{........}\" order by status ASC,resolutiondate DESC"

However, this query does not return issues that have no resolution set. This is due to the behavior of JIRA's != operator, which excludes issues where the resolution field is empty (i.e., unresolved).

Reference

See JIRA documentation for details on this behavior: https://confluence.atlassian.com/jirakb/using-not-equals-on-a-resolution-does-not-return-unresolved-issues-635897091.html

Expected Behavior

The query should return both unresolved issues and issues with resolutions that do not match "Won't Do".
Possible Fix

To correctly include unresolved issues, the JQL should be modified to explicitly account for them, such as:

jql="(resolution is EMPTY OR resolution != \"Won't Do\") and (resolutiondate is EMPTY OR resolutiondate >= -1440m) and project=\"TEST\" and labels=\"ALERT{........}\" order by status ASC,resolutiondate DESC"

Steps to Reproduce

  • Define a wont_fix_resolution with a JQL query similar to the one above.
  • Ensure there are unresolved issues in the project.
  • Run the query and observe that unresolved issues are missing from the results.

Environment

  • Alertmanager version: 0.28
@grobinson-grafana
Copy link
Collaborator

Thanks for opening an issue. Do you think you would be able to open a fix for this, including tests, and perhaps a screenshot showing the old (incorrect) behavior and the new (correct) behavior for some test data in Jira?

surinkim added a commit to surinkim/alertmanager that referenced this issue Apr 26, 2025
surinkim added a commit to surinkim/alertmanager that referenced this issue Apr 26, 2025
surinkim added a commit to surinkim/alertmanager that referenced this issue Apr 26, 2025
@surinkim
Copy link

Hi, I've submitted a PR to fix this issue: #4370

It includes:

  • a fix for correctly handling issues with null resolution values,
  • corresponding tests,
  • and a screenshot showing the previous (incorrect) and current (correct) behavior in Jira.

Let me know if anything needs to be improved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants