jiralert icon indicating copy to clipboard operation
jiralert copied to clipboard

how to change jira.Summary values?

Open gustavosaes opened this issue 6 years ago • 7 comments

Hello

How do I change the jira.summary template by entering ".Status: .jobname .alertname"?

I tried to configure jira.summary as follows:

"{{.Status | toUpper}} {{if eq .Status" firing "}}: {{.Alerts.Firing | len}} {{end}} {{.CommonLabels.alertname}} for {{.CommonLabels. job}}}} "

However, when checking the Logs, I noticed that when forwarding the call to Jira, he returns error below:

"level = error ts = 2019-09-27T19: 30: 51.012349498Z caller = main.go: 142 msg =" error handling request "statusCode = 500 statusText =" Internal Server Error "err =" JIRA request https: // jira_url .com / rest / api / 2 / issue / OPTI-12763 returned status 400, body \ "\" "receiver = jiralert groupLabels =" unsupported value type ""

gustavosaes avatar Sep 30 '19 10:09 gustavosaes

Hi, All

Please, Is there any position?

Thanks very much

Att,

Fernando Beltrame

fsbnando avatar Oct 07 '19 16:10 fsbnando

I'm also seeing the same error message (groupLabels="unsupported value type") Any pointers?

andrewakl avatar Jan 10 '20 00:01 andrewakl

The groupLabels="unsupported value type" could simply be due to logfmt (which JIRAlert uses for logging) being unable to log a map[string]string (which is what groupLabels is) in a structured log. And is likely unrelated to the root cause (i.e. why JIRA returns a HTTP 400).

The latter could e.g. be caused by the issue summary including characters that are not accepted. (Maybe terminating with a space?) Or it could be a bug in JIRAlert that causes it to produce an invalid request (which is what HTTP 400 stands for).

free avatar Jan 10 '20 11:01 free

For me, it's a HTTP 500 error:

level=error ts=2020-01-09T01:34:49.698466622Z caller=main.go:143 msg="error handling request" statusCode=500 statusText="Internal Server Error" err="JIRA request https://myjira.mycompany.com/rest/api/2/search?jql=project%3D%22MYPROJECT%22+and+labels%3D%22ALERT%7Balertname%3D%5C%22TestAlert%5C%22%7D%22+order+by+resolutiondate+desc&maxResults=2&fields=summary,status,resolution,resolutiondate returned status 400 , body \"\"" receiver=jira-ab groupLabels="unsupported value type"

When i paste the same API url into my web browser, i also get a HTTP 500.

It looks like Jira doesn't like ALERT{alertname="TestAlert"} I'm using Jira v7.4.4 Which version of Jira supports that syntax: ALERT{alertname="TestAlert"} ?

Thanks --Andrew

andrewakl avatar Jan 10 '20 20:01 andrewakl

I'm also getting the error groupLabels="unsupported value type" Can't find out the reason..

bumarcell avatar Apr 12 '21 13:04 bumarcell

@free Could you please help on how to fix that problem (maybe how to change log format)?

bumarcell avatar Apr 13 '21 07:04 bumarcell

I am facing the same kind of problem here. It would be very much appreciated if we could have those following information:

  • jira project configuration (How to configure the fields within issues and related workflow in JIRA to match jiralert configuration/template)
  • jiralert/jira releases compliance

yugsie avatar May 10 '21 14:05 yugsie