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

Add Jira integration #280

Merged
merged 30 commits into from
Feb 20, 2025
Merged

Add Jira integration #280

merged 30 commits into from
Feb 20, 2025

Conversation

santihernandezc
Copy link
Contributor

@santihernandezc santihernandezc commented Feb 11, 2025

This PR introduces support for JIRA integration in Grafana Managed Alertmanager.
It's almost carbon copy of the prometheus/alertmanager#3590 (credits to @jkroepke) with couple changes:

  • b52aeaa (#280) Configuration extended with option dedup_key_field that allows to specify a custom field to store deduplication key. The field must be a text field. If it is not specified, the deduplication key is added to labels.
  • 1578f74 (#280) changes how description is handled in v3 API:
    • if the payload is not a valid JSON it treats it as string, truncates it and created and ADF document
    • if payload is a valid JSON, it does not truncate it and puts into the body as is. The code in the upstream PR would fail to parse truncated JSON. This way it will be on API to reject it as too long.
  • d9b37ab (#280) changes how empty transition settings are treated. In contrast to the upstream implementation that looks for empty-string transition and fails notification, this integration skips resolving\reopening of integration.
  • to match the behavior of other integrations, errors in expanding template do not cause the integration to fail. Instead, it follows the Grafana's paradigm of best effort to notify user even if the payload is not what user expects and falls back to the default templates.
  • handling of field Fields.
    • The original PR does conversion of map[any]any to map[string]any here because yaml unmarshaller produced result that is not supported by json marshaller. In the case of Grafana the integration configuration is stored in JSON and therefore, it is not affected by this problem.
    • However, due to limitations put by Grafana's UI framework for integrations, the Fields could be only a map[string]string. To workaround this limitation the config parser is extended to scan values and parse if string is a valid JSON

How integration works

Diagram
diagram-733674009971547440

Notes for reviewer

Due to some security reason, the Grafana's webhook sender does not support GET requests. I initiated extraction of it in #281 to alerting module to be able to change it and have more control over its behavior. In the meantime, I worked around GET requests 449c192 (#280). I will remove once the migrated sender will be able to process GET requests.

@santihernandezc santihernandezc requested a review from a team as a code owner February 11, 2025 15:18
@santihernandezc santihernandezc marked this pull request as draft February 11, 2025 15:18
This commit introduces a JIRA notifier for handling alert notifications. It implements creating, updating, and resolving JIRA issues via the JIRA API, supports custom templates for summary and description, handles authentication, and includes configurations for transitions and custom fields.
@yuri-tceretian yuri-tceretian marked this pull request as ready for review February 14, 2025 23:31
@jkroepke
Copy link

Some changes are great. I hope
Some of them can be done upstream

Copy link
Contributor Author

@santihernandezc santihernandezc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
I left a few comments. Also, please consider capitalizing log lines.

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
@yuri-tceretian yuri-tceretian merged commit 4baca04 into main Feb 20, 2025
2 checks passed
@yuri-tceretian yuri-tceretian deleted the add_jira_integration branch February 20, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants