Description
Thank you for your hard work and great project!
Unfortunately we have found an issue in 1.0.
In our case, when the JiraAlert is triggered by the Alertmanager, it creates new Jira defect, without adding additional Label. For example if the service is down Jira Alert uses the label like: ALERT{alertname="ServiceDown",namespace="",service_name=""} which should already be added to Defect.
Every time the JiraAlert is triggered before creating new defect it searches for existing ones. It uses query – which is the Label which should have been added during the creation of the defect. The query nothing returns, therefore JiraAlert creates new defect rather then updating it.
See the logs below:
• I1017 15:19:32.510837 8 notify.go:115] Issue created: key=SPRINT-25234 ID=6505526
• I1017 19:20:50.423961 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1017 19:20:51.020082 8 notify.go:115] Issue created: key=SPRINT-25235 ID=6505716
• I1017 23:22:13.671601 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1017 23:22:14.337028 8 notify.go:115] Issue created: key=SPRINT-25238 ID=6505766
• I1018 03:23:31.037384 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1018 03:23:31.718012 8 notify.go:115] Issue created: key=SPRINT-25240 ID=6505911
• I1018 07:25:00.828099 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1018 07:25:01.558600 8 notify.go:115] Issue created: key=SPRINT-25241 ID=6506001
• I1018 11:26:30.193346 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1018 11:26:30.864185 8 notify.go:115] Issue created: key=SPRINT-25242 ID=6506149
• I1018 15:27:30.113821 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1018 15:27:31.282052 8 notify.go:115] Issue created: key=SPRINT-25244 ID=6506319
• I1018 19:28:06.189205 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1018 19:28:07.001398 8 notify.go:115] Issue created: key=SPRINT-25245 ID=6506630
• I1018 23:28:54.166905 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
• I1018 23:28:54.728162 8 notify.go:115] Issue created: key=SPRINT-25247 ID=6506923
• I1019 03:29:51.075680 8 notify.go:74] No issue matching ALERT{alertname="ServiceDown",namespace="***",service_name="***"} found, creating new issue
The issue causes that many duplicates is created as long as the Label is not added manually.
Below, the part of code that should be checked.
notify.go
log.Infof("No issue matching %s found, creating new issue", issueLabel)
issue = &jira.Issue{
Fields: &jira.IssueFields{
Project: jira.Project{Key: project},
Type: jira.IssueType{Name: r.tmpl.Execute(r.conf.IssueType, data)},
Description: r.tmpl.Execute(r.conf.Description, data),
Summary: r.tmpl.Execute(r.conf.Summary, data),
Labels: []string{
issueLabel,
},
Unknowns: tcontainer.NewMarshalMap(),
},
}
Thank you for help in advance!