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

labels without keys #38

Closed
equick opened this issue Jun 8, 2019 · 3 comments · Fixed by #154
Closed

labels without keys #38

equick opened this issue Jun 8, 2019 · 3 comments · Fixed by #154

Comments

@equick
Copy link

equick commented Jun 8, 2019

Hi,
I've been trying out jiralert, and really like it but one thing I noticed is that the labels come out in KEY=VALUE format. Is it possible to specify a label value without the key?
The reason I ask is because the jira board I'm assigning tickets to, filters on a single label called "CFT".

Thanks for any help,
Ed

@equick
Copy link
Author

equick commented Jun 8, 2019

I found one way round this by hardcoding labels in the receiver configuration, however this seems to overwrite the jiralert label ALERT(key=value) which appears to be used to prevent duplicate tickets opening.

fields:
  labels: ["CFT"]

@equick
Copy link
Author

equick commented Jun 9, 2019

Further to my last post, I managed to overcome the duplicate tickets issue using the following configuration. This works though might seem a bit of a hack.

config/jiralert.yml

fields:
  labels: ["CFT", '{{ template "sm.labels" . }}']

config/jiralert.tmpl
{{ define "sm.labels" }}ALERT{alertname="{{ .GroupLabels.SortedPairs.Values | join "," }}"}{{ end }}

I now have two labels on the jira ticket:
ALERT{alertname="TestAlert"} CFT

@free
Copy link
Member

free commented Jun 9, 2019

Wow, impressive problem solving skills. (o:

Yeah, the labels should be cumulative, but I guess any label you set via fields.labels will overwrite the ALERT label used by JIRAlert to identify which alert this is.

Will need some code tweaks for special handling of custom labels added via fields.labels. Might also need to check if any other fields need similar special handling (although most of them are single-valued rather than lists, so overriding is likely the expected outcome there, even though it wouldn't make much sense).

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

Successfully merging a pull request may close this issue.

2 participants