-
Notifications
You must be signed in to change notification settings - Fork 6
Fixed QFlappingShift date boundary and summing bugs #4
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abyrne55 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@abyrne55: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/hold Looks good, (personal thoughts) I think in general it's better to put filtering logic into code and let db layer just query the data |
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.
/lgtm
@boranx I genuinely appreciate the feedback. I'm going to unhold this PR and continue the conversation with you off-GitHub, as changing to a code-does-the-filtering approach would require a larger refactor, IMO. |
/unhold |
There's a bug in the definition of
_query()
for the Question subclassQFlappingShift
(a.k.a. "Which alerts fire more than once per on-call shift (in the same cluster)?") where date boundaries (since
anduntil
) were not being considered, leading to increasingly-large results for that query. This PR fixes that bug by adding an SQLAlchemy filter clause along the lines of:There's also an undocumented bug in the above-mentioned method that caused flap counts to not be summed across days, leading to duplicate entries in the answer table. This PR fixes this by converting the original query into a subquery, and then returning a new query that sums across the subquery.
This PR addresses bug OSD-11288 (date boundaries).