-
Notifications
You must be signed in to change notification settings - Fork 1
Preparation for sending non-state notifications #270
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: icingadb-source
Are you sure you want to change the base?
Conversation
7653b83
to
3ab100a
Compare
30e2b00
to
baedf32
Compare
193fb86
to
de9b824
Compare
baedf32
to
8dc0902
Compare
Initially, I was thinking that this PR would become obsolete with the new event rules evaluation process, but after reviving it, it still needed for the non-state notifications PR to work properly. I've dropped all the event rules related changes from this PR, so it only contains the changes needed to evaluate escalations in a central place, plus some other (hopefully) useful refactorings and cleanups along the way (like introducing a new PS: The tests are all failing because they depend on this Icinga Go library PR. |
de9b824
to
508ea9c
Compare
It's getting ridiculous that those fields have to be passed around everywhere into functions and methods. This becomes even more ridiculous with upcoming PR of mine, so I just bite the bullet and make a struct for it. This struct is typically embedded into other structs that need access to these common resources, and each function or method has just to take the `RuntimeConfig` as a parameter, and this will be populated from there.
8dc0902
to
07d937b
Compare
I think, this PR is ready to be reviewed now. It's based on top of #324, so can't be merged before that one but can be reviewed meanwhile. Please take a look when either of you have time. Thanks! :) |
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.
I went over the changes multiple times and in general it seems to work. However, sometimes it was a bit hard to understand the motivation for some changes.
Soft Approve.
func (i *Incident) MakeNotificationRequest(ev *event.Event) *plugin.NotificationRequest { | ||
baseUrl, err := url.Parse(daemon.Config().Icingaweb2URL) | ||
if err != nil { | ||
i.Logger.Panicw("Failed to parse Icinga Web 2 URL", zap.String("url", daemon.Config().Icingaweb2URL), zap.Error(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.
I would prefer not to panic
this deep into the codebase for something which might be a misconfiguration. In the future, this even might come from the database or somewhere else. How about just returning an error?
For example? You could/can also just ask me here or in person and I can telly the reasoning behind them. |
This PR introduces/extracts some of the codes of the existing components in preparation for #188. All these changes were part of that PR, but as it was slowly getting bigger and bigger, I decided to split up those commits which can be reviewed and merged independently.
Incident#Id
field toID
as we no longer need to implement anID()
receiver onIncident
type, after thecontracts.Incident
interface has been removed by 503b874.Blocked by