Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It shouldn't harm to include it, but it's rather strange to send
cancel_time
for adowntime_start
event that would contain0
anyway.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.
"would" is the most important word here. If for some reason this goes wrong, I want
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.
That's the primary objective of this PR.
Know what? I mean a possible alternative could be to just remove
has_been_cancelled
from the start event altogether as that doesn't really make sense here (note: I didn't check/test how Icinga DB will behave in that case) and should be set in the end event. The downtime start and end events affect the same row indowntime_history
anyways, so you can't tell which of both even setcancel_time
.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.
Nope.
2023-12-19 15:09:14 2023-12-19T14:09:14.260Z FATAL icingadb Error 1048 (23000): Column 'has_been_cancelled' cannot be null
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.
That's because the DB column is not nullable. How about just sending a hardcoded
0
forhas_been_cancelled
then? I mean, this is a downtime start event, we don't need to set this to a meaningful value as it is guaranteed to be synchronised with the downtime end event.icinga2/lib/icingadb/icingadb-objects.cpp
Lines 1954 to 1956 in 949d983
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 sounds so cheaty, that's literally fake info.