-
Notifications
You must be signed in to change notification settings - Fork 132
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 ability to update in comments #161
add ability to update in comments #161
Conversation
Signed-off-by: Jason Wells <[email protected]>
@bwplotka Could you help review? If there are any deal-breakers, I'd like to get them fixed ASAP. |
@twotired Wouldn't it be better to add these features in config instead of global flag? That way each of the features might be managed per project saving the configurations flexibility, otherwise for two projects with flag on/off we'd need two instances of jiralert. |
Hey @twotired, |
Tests are still failing (also DCO) - do you mind to fix that? |
60a58d4
to
5cde203
Compare
Signed-off-by: Jason Wells <[email protected]>
- Changed comment; - Replaced space indentation by tab indentation. Signed-off-by: Jason Wells <[email protected]>
…KB) (prometheus-community#165) * truncate descriptions that exceed -max-description-length (default 32,768) Signed-off-by: Jason Wells <[email protected]> * Update main.go size was off by 1 Signed-off-by: Jason Wells <[email protected]> --------- Signed-off-by: Jason Wells <[email protected]>
Signed-off-by: Jason Wells <[email protected]>
5cde203
to
e6032aa
Compare
@bwplotka tests and DCO fixed, please review. |
We want to use this too so I tested it. There were some tweaks necessary for us to work. I think its better to only add a comment in a issue if the description contains something new. Otherwise a new comment will be created as if the repeat_interval from Alertmanager is configured.
For this to work I had to add description to the options field. Now only a comment is added if theres a actual update and not just a polling
I will push a commit this week if I find time |
@holger-waschke I was planning to close this PR and open a new one after I realized some cleanup is needed. To work around duplicate comments, I set a repeat_interval in the Alertmanager config that is longer than our time between releases:
This works for us because we replace all containers (and reset counters) every 7d. Also, we wouldn't be able to compare to the Description because we disable updating the Description, because sometimes users want to make changes to the Description and those would otherwise be lost. |
I see then it has to be outside of the Most users probably have a much lower repeat interval. Before jiralert wasnt comparing the description at all and always updated the description if updateDescription was set to true only jira itself prevents updating the description is the content is identical so its cleaner now anyway to add the description to the fields
|
@@ -107,6 +113,13 @@ func (r *Receiver) Notify(data *alertmanager.Data, hashJiraLabel bool, updateSum | |||
} | |||
} | |||
|
|||
if r.conf.UpdateInComment { |
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.
this works better for me to avoid flodding of comments if repeat interval is set low
if r.conf.UpdateInComment {
if issue.Fields.Description != issueDesc {
retry, err := r.addComment(issue.Key, issueDesc)
if err != nil {
return retry, err
}
}
}
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.
And add descriptionhere
func (r *Receiver) search(project, issueLabel string) (*jira.Issue, bool, error) {
query := fmt.Sprintf("project=\"%s\" and labels=%q order by resolutiondate desc", project, issueLabel)
options := &jira.SearchOptions{
Fields: []string{"summary", "status", "resolution", "resolutiondate", "description"},
MaxResults: 2,
}
Thanks for helping @holger-waschke 👍🏽 Happy to review the final result of your collaboration (: |
closing this now that I have a new PR with more tests and better config options: #180 |
As an alternative, or as an addition to updated the Description, additional Alert updates should go to comments.
The default behavior is to update the JIRA Description when the Alert details change. This makes it difficult if the viewers of the JIRA are researching each failure because it is not obvious which alerts are new or existing. Depending on the Alert expression, old firing details may also be removed.
Additionally, adding too many firing details to the description increases the likelihood of exceeding the 32KB char limit for the JIRA Description.
By optionally sending each update to a Comment, viewers can better keep track of which activity is new, and it will be possible to continue adding firing details without exceeding the Description char limit.
resolves #160