-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Jira Integration: Allow configuring issue update via parameter #4621
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
base: main
Are you sure you want to change the base?
Jira Integration: Allow configuring issue update via parameter #4621
Conversation
|
this is also important due to upcoming rate-limiting https://developer.atlassian.com/cloud/jira/platform/rate-limiting/ |
tbh this sounds to me like it will be mandatory to have some kind of back off mechanism to avoid running into these enforced rate limits? |
|
@holger-waschke i think this is already implemented alertmanager/notify/jira/jira.go Line 63 in f7ff687
|
|
I'm with you, but this handles every alarm separate. I think generally an optional circuit-breaker could solve this.
Maybe we should discuss this in an issue. |
|
I like this idea, but I'm wondering if we should have a more generic implementation. I'm less familiar with the Jira integration than I should be, honestly. Are there any other fields which we might want to avoid updating on repeat notifications? I'm wondering if we should allow fields to have sub-keys that indicate if we should update them or not. I also think the discussion about rate-limiting is important enough to move to a dedicated issue. It's really a problem for any receiver, so it's something we should ideally solve generically. |
we´re using this Jira API Endpoint to update existing issues In the request body we send the fields we would like to update. which are the same as creating a new issue so basically everything. |
That makes sense to me... The thing I'm worried about is that we'll end up having multiple What do you think about introducing a new This would result in config like: We could then reuse the type for cc @siavashs and @grobinson-grafana since they might have a different opinion. |
91101c8 to
c792c12
Compare
|
@Spaceman1701 The jira_test required a fair amount of refactoring to accommodate this, but it feels justified. |
Signed-off-by: Holger Waschke <[email protected]>
c81ed9c to
9da06dc
Compare
Spaceman1701
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes! I like the implementation, this is looking good to me.
Last thing is to make sure the docs reflect this change.
| Project *issueProject `json:"project,omitempty"` | ||
| Resolution *idNameValue `json:"resolution,omitempty"` | ||
| Summary string `json:"summary"` | ||
| Summary any `json:"summary"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did this change? I see that Description is also any, so I think this is fine. Just answering here in github is enough that someone will be able to learn the answer if they come looking for it in the future 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any is an alias for interface{} and we´re using it in combination with the MarshalJSON function
// MarshalJSON merges the struct issueFields and issueFields.CustomField together.
func (i issueFields) MarshalJSON() ([]byte, error) {
jsonFields := map[string]interface{}{}
if i.Summary != nil {
jsonFields["summary"] = i.Summary
}
if i.Description != nil {
jsonFields["description"] = i.Description
}
to ensure that the field is nil and not an empty string when updating existing issues with the fields not being included. parsing an empty string would just update the field to an empty string so we have to make sure it´s omitted from the JSON completely. I´m not quite sure if a string pointer could be used here as well I tested it and I think it would need quite some reworking.
…description fields
This change allows disabling the update of issue descriptions.
It´s a non breaking change the default is still to update everything. Only if you set the parameter disable_update_description explicit to true the description won´t get updated anymore.
We need this feature as there a lot of jira automations which updates the description itself, jiralert would revert the changes back to the original templated description state once the repeat_interval kicks in and the alert is still active, so it´s handy to have the possibility to disable it.
I added a new unit test for this function to test.
Exempel config