Open VaaFull opened 7 months ago
Hi @VaaFull, I'm running into the same issue. Did you find out what the problem was?
The issue is only about the log message. I put a small fix to get the correct output:
diff --git a/pkg/notify/notify.go b/pkg/notify/notify.go
index e4b96a2..9b5c25f 100644
--- a/pkg/notify/notify.go
+++ b/pkg/notify/notify.go
@@ -334,7 +334,13 @@ func (r *Receiver) search(projects []string, issueLabel string) (*jira.Issue, bo
issue := issues[0]
if len(issues) > 1 {
- level.Warn(r.logger).Log("msg", "more than one issue matched, picking most recently resolved", "query", query, "issues", issues, "picked", issue)
+ // level.Warn(r.logger).Log("msg", "more than one issue matched, picking most recently resolved", "query", query, "issues", issues, "picked", issue)
+ keys := make([]string, len(issues))
+ for i, iss := range issues {
+ keys[i] = iss.Key
+ }
+ issuesKeys := strings.Join(keys, ", ")
+ level.Warn(r.logger).Log("msg", "more than one issue matched, picking most recently resolved", "query", query, "issues", issuesKeys, "picked", issue.Key)
}
level.Debug(r.logger).Log("msg", "found", "issue", issue, "query", query)
@banuchka fast test shows - it works, thank you!
@banuchka
one more place to change variable
level=debug ts=2024-10-18T04:01:53.473381514Z caller=notify.go:345 msg=found issue="unsupported value type" query=
The issue is only about the log message. I put a small fix to get the correct output:
diff --git a/pkg/notify/notify.go b/pkg/notify/notify.go index e4b96a2..9b5c25f 100644 --- a/pkg/notify/notify.go +++ b/pkg/notify/notify.go @@ -334,7 +334,13 @@ func (r *Receiver) search(projects []string, issueLabel string) (*jira.Issue, bo issue := issues[0] if len(issues) > 1 { - level.Warn(r.logger).Log("msg", "more than one issue matched, picking most recently resolved", "query", query, "issues", issues, "picked", issue) + // level.Warn(r.logger).Log("msg", "more than one issue matched, picking most recently resolved", "query", query, "issues", issues, "picked", issue) + keys := make([]string, len(issues)) + for i, iss := range issues { + keys[i] = iss.Key + } + issuesKeys := strings.Join(keys, ", ") + level.Warn(r.logger).Log("msg", "more than one issue matched, picking most recently resolved", "query", query, "issues", issuesKeys, "picked", issue.Key) } level.Debug(r.logger).Log("msg", "found", "issue", issue, "query", query)
level.Debug(r.logger).Log("msg", "found", "issue", issue.Key, "query", query)
Hello team I've got an issue with https://github.com/prometheus-community/jiralert/blob/master/pkg/notify/notify.go#L337 It seems like variables
issues
andissue
returned some wrong data. If we check logs,query
shows with no error, but for the last 2 variables I've got the issue -unsupported value type
"query", query, "issues", issues, "picked", issue
I took some logs to get better understanding. It is the same logs, but in different output
So the first one is default logs format tell us:
Next is DEBUG level
Next DEBUG JSON