Skip to content
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

issues="unsupported value type" picked="unsupported value type" #185

Open
VaaFull opened this issue Mar 14, 2024 · 4 comments
Open

issues="unsupported value type" picked="unsupported value type" #185

VaaFull opened this issue Mar 14, 2024 · 4 comments

Comments

@VaaFull
Copy link

VaaFull commented Mar 14, 2024

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 and issue 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:

level=warn ts=2024-03-13T14:38:23.351923702Z caller=notify.go:337 msg="more than one issue matched, picking most recently resolved" query="project in('ITDPL') and labels=\"JIRALERT{153c989daecc938ce2e36d47......1cae62a0475ca415c238b824556e2192e1148}\" order by resolutiondate desc" issues="unsupported value type" picked="unsupported value type"

Next is DEBUG level

level=debug ts=2024-03-13T14:26:23.121607584Z caller=notify.go:323 msg=search query="project in('ITDPL') and labels=\"JIRALERT{153c989daecc938ce98fc1025b.......16c1cae62a0475ca415c238b824556e2192e1148}\" order by resolutiondate desc" options="&{StartAt:0 MaxResults:2 Expand: Fields:[summary status resolution resolutiondate description comment] ValidateQuery:}"
level=warn ts=2024-03-13T14:26:23.386894917Z caller=notify.go:337 msg="more than one issue matched, picking most recently resolved" query="project in('ITDPL') and labels=\"JIRALERT{153c989daecc938.........6c1cae62a0475ca415c238b824556e2192e1148}\" order by resolutiondate desc" issues="unsupported value type" picked="unsupported value type"

Next DEBUG JSON

{"caller":"notify.go:337","issues":[{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3741735","self":"https://gtsaaa.aaa.com/rest/api/2/issue/3741735","key":"ITDPL-54439","fields":{"status":{"description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://gtsaaa.aaa.com/images/icons/statuses/open.png","id":"1","name":"Open","self":"https://gtsaaa.aaa.com/rest/api/2/status/1","statusCategory":{"colorName":"default","id":2,"key":"new","name":"To Do","self":"https://gtsaaa.aaa.com/rest/api/2/statuscategory/2"}},"summary":"[FIRING:1] TEST-PVC,aaa,postgres-main"}},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3741684","self":"https://gtsaaa.aaa.com/rest/api/2/issue/3741684","key":"ITDPL-54436","fields":{"resolutiondate":"2024-03-11T10:17:08.000-0400","status":{"description":"A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.","iconUrl":"https://gtsaaa.aaa.com/images/icons/statuses/resolved.png","id":"5","name":"Resolved","self":"https://gtsaaa.aaa.com/rest/api/2/status/5","statusCategory":{"colorName":"success","id":3,"key":"done","name":"Done","self":"https://gtsaaa.aaa.com/rest/api/2/statuscategory/3"}},"summary":"[FIRING:1] TEST-PVC,aaa,postgres-main"}}],"level":"warn","msg":"more than one issue matched, picking most recently resolved","picked":{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3741735","self":"https://gtsaaa.aaa.com/rest/api/2/issue/3741735","key":"ITDPL-54439","fields":{"status":{"description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://gtsaaa.aaa.com/images/icons/statuses/open.png","id":"1","name":"Open","self":"https://gtsaaa.aaa.com/rest/api/2/status/1","statusCategory":{"colorName":"default","id":2,"key":"new","name":"To Do","self":"https://gtsaaa.aaa.com/rest/api/2/statuscategory/2"}},"summary":"[FIRING:1] TEST-PVC,aaa,postgres-main"}},"query":"project in('ITDPL') and labels=\"JIRALERT{153c989daecc938ce98.........ca415c238b824556e2192e1148}\" order by resolutiondate desc","ts":"2024-03-13T13:26:23.214364566Z"}
{"caller":"notify.go:340","issue":{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3741735","self":"https://gtsaaa.aaa.com/rest/api/2/issue/3741735","key":"ITDPL-54439","fields":{"status":{"description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://gtsaaa.aaa.com/images/icons/statuses/open.png","id":"1","name":"Open","self":"https://gtsaaa.aaa.com/rest/api/2/status/1","statusCategory":{"colorName":"default","id":2,"key":"new","name":"To Do","self":"https://gtsaaa.aaa.com/rest/api/2/statuscategory/2"}},"summary":"[FIRING:1] TEST-PVC,aaa,postgres-main"}},"level":"debug","msg":"found","query":"project in('ITDPL') and labels=\"JIRALERT{153c989daecc938ce98........38b824556e2192e1148}\" order by resolutiondate desc","ts":"2024-03-13T13:26:23.214785765Z"}```
@madddi
Copy link

madddi commented Sep 16, 2024

Hi @VaaFull, I'm running into the same issue. Did you find out what the problem was?

@banuchka
Copy link

banuchka commented Oct 3, 2024

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)

@VaaFull
Copy link
Author

VaaFull commented Oct 11, 2024

@banuchka fast test shows - it works, thank you!

@VaaFull
Copy link
Author

VaaFull commented Oct 18, 2024

@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)

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

No branches or pull requests

3 participants