alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

jira integration

Open jkroepke opened this issue 1 year ago • 14 comments

This PR track the Atlassian JIRA integration into Alertmanger.

See: #3577

Replaces: https://github.com/prometheus-community/jiralert


What I test:

  • Jira Cloud only
  • Create issues
  • Auto-Close issue with resolve_transition
  • Reopen issue with reopen_transition
  • Reopen duration
  • Custom Fields
  • api_token_file

jkroepke avatar Nov 01 '23 20:11 jkroepke

Can this integration cover another of jiralert issue - is custom field for alert hash? https://github.com/prometheus-community/jiralert/issues/164

Current code search hash in hardcoded place - in labels

jql.WriteString(fmt.Sprintf(`project = "%s" and
labels=%q order by status ASC,
resolutiondate DESC`, n.conf.Project, key.Hash()))

Thanks

k0ste avatar Nov 18 '23 12:11 k0ste

Sure. After merge. Everyone is invited to improve.

I would not like to add more feature here. Even I understand you request.

The current PR covery already a lot of cases to test. Adding more new features results into more testing. I would prefer to add new features in separate PRs.

jkroepke avatar Nov 18 '23 15:11 jkroepke

Is this implementation only for Jira Cloud or can I still use the on-premise API with a PAT Authentication?

holger-waschke avatar Dec 05 '23 14:12 holger-waschke

Hi @holger-waschke

I'm not able to test on-premise. But you can enter an Server API Path to an on premise instance and the authentication is still auth basic which should work on on-premise, too.

The integration does not use any cloud specific features. If https://github.com/prometheus-community/jiralert works on-premise, this integration should work, too.

I remember that Issue handling, the Jira Software Server API v2 and Cloud API v2 is the same.

  • https://docs.atlassian.com/software/jira/docs/api/REST/9.11.0/#api/2/issue
  • https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-post

But please keep in mind that this integration will always have best-effort since most users are not able to setup a on premise instance.

jkroepke avatar Dec 05 '23 17:12 jkroepke

Thanks for starting this! I haven't looked yet in details into the notifier but I suppose that it's almost a 1:1 copy from the original project?

No. while jiralert uses a unofficial outdated REST SDK for JIRA, I used the standard http client to setup the few http calls.

jkroepke avatar Dec 11 '23 15:12 jkroepke

@simonpasquier I tested the PR after review and code changes again.

jkroepke avatar Dec 16 '23 09:12 jkroepke

@simonpasquier could you please take a look here? Thanks you.

jkroepke avatar Feb 04 '24 22:02 jkroepke

@simonpasquier

I would kindly ask, if this can be pushed forward after the next release of Alertmanager. I understand, the Release Candidate für 0.27 has an higher priority to fix issues here.

It would finally deprecate the jiralert project (which also lacks for ARM64 support)

jkroepke avatar Feb 16 '24 08:02 jkroepke

i´ve tested the PR with our Jira Cloud Setup and everything looks good so far. Would be really interested in using this, is there an update @simonpasquier?

christianjedroCDT avatar Feb 20 '24 10:02 christianjedroCDT

Showing some additional support here! The tests I ran all look good and I can't wait to get the official release.

Matz13 avatar Apr 17 '24 17:04 Matz13

I fixed all the pipeline issues now

jkroepke avatar Apr 30 '24 12:04 jkroepke

@simonpasquier thanks for taking an other look here.

Since I open the PR 7 months ago, I learned bit more about go. In conclusion, I added some units tests and I was able to identity some bugs.

Sadly, adding the units tests here requires additional review cycles.

I will continue some integrations tests and once I'm done, I will re-request an review.

jkroepke avatar May 22 '24 21:05 jkroepke

I have tested the priority template together with inhibit_rules which works really great together.

inhibit_rules:
  - equal:
      - namespace
      - alertname
    source_matchers:
      - severity = critical
    target_matchers:
      - severity =~ warning|info
  - equal:
      - namespace
      - alertname
    source_matchers:
      - severity = warning
    target_matchers:
      - severity = info

Manual testing against Jira Atlassian Cloud works fine.


In conclusion, we have 2 open topic:

  • fields vs custom_fields inside jira_config
  • github.com/trivago/tgo for cast nested map from map[any]any to map[string]any

jkroepke avatar May 27 '24 17:05 jkroepke

The code looks good to me. Unfortunately, I cannot test in my setup, because I have a problem with the field Labels. I'll way the code be merged to include https://github.com/prometheus-community/jiralert/

I‘m open to extend the feature set after this PR got merged.

Background: it seems like AM has some review capacity issues and increase the scope involves an additional review each time. The current scope is well tested (including manual test against prod systems).

jkroepke avatar Jun 20 '24 17:06 jkroepke

Yes, I would like to see this merged so we can iterate on additional featres.

SuperQ avatar Jul 02 '24 05:07 SuperQ

Thanks for all the reviews.

  • I had some issues with jsoniter (as replacement for tcontainer), but I struggle here. Tests are failing with jsoniter.
  • I have implement a truncate for jira description (ref https://github.com/prometheus-community/jiralert/pull/165) - also experienced this once already.
  • The notify context will be passed to all API calls.
  • I merged group_labels and static_labels as suggested by @simonpasquier

jkroepke avatar Jul 02 '24 20:07 jkroepke

Hi all, after 2 approvals. how we should proceed?

jkroepke avatar Jul 10 '24 20:07 jkroepke

Ping @gotjosh @simonpasquier

SuperQ avatar Jul 12 '24 14:07 SuperQ