prometheus / prometheus/alertmanager

Alertmanager native integration jira problem

Open
#4,293 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/notify kind/question stale
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

Hello.

I am configuring Alertmanager native integration with Jira. Before upgrading to version 0.28.0, we were using the jira-ab receiver. We are using Jira Data Center.

  - api_url: http://hostname-jira/rest/api/2/
    description: '{{ template "jira.default.description" . }}'
    fields:
      components:
      - name: Monitoring
      customfield_10001: Auto-created by Alertmanager
    http_config:
      basic_auth:
        password: <pass>
        username: jiralert
    issue_type: Bug
    labels:
    - alertmanager
    - '{{ .CommonLabels.severity }}'
    priority: '{{ .CommonLabels.severity }}'
    project: MON
    reopen_duration: 1h
    reopen_transition: Reopen
    send_resolved: true
    summary: '{{ template "jira.default.summary" . }}'
  name: receiver-jira-dc

route:
  - continue: true
    group_by:
    - alertname
    - instance
    matchers:
    - alertname = "TestJiraAlert"
    receiver: receiver-jira-dc

However, when sending a test alert, I receive the following message:

time=2025-03-05T10:02:55.603Z level=WARN source=jira.go:145 msg="Truncated summary" integration=jira group_key="{}/{alertname=\"TestJiraAlert\"}:{alertname=\"TestJiraAlert\", instance=\"<name>:9100\"}" max_runes=255

It seems that the correct issue is not being found, and it tries to use the most recently resolved one. I suspect the issue is related to the template configuration.

{{ define "jira.summary" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join "," }}{{ end }}

{{ define "jira.description" }}{{ range .Alerts.Firing }}Labels:
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
Annotations:
{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
Source: {{ .GeneratorURL }}
{{ end }}
CommonLabels:
{{ range .CommonLabels.SortedPairs }} - {{ .Name }} = {{ .Value}}
{{ end }}
GroupLabels:
{{ range .GroupLabels.SortedPairs }} - {{ .Name }} = {{ .Value}}
{{ end }}
{{ end }}

I need help. What am I doing wrong?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in jira.go around the logged lines 145 and 245, then compare the native Jira configuration and the supplied jira.summary and jira.description templates. Determine whether the template configuration explains the issue matching and summary behavior; done means documenting the cause or a reproducible fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.