Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Fixed QFlappingShift date boundary and summing bugs #4

Merged
merged 2 commits into from
May 25, 2022

Conversation

abyrne55
Copy link
Contributor

There's a bug in the definition of _query() for the Question subclass QFlappingShift (a.k.a. "Which alerts fire more than once per on-call shift (in the same cluster)?") where date boundaries (since and until) 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:

WHERE alert.creation_time > time_window_start && alert.creation_time < time_window_end

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).

@openshift-ci openshift-ci bot requested review from bdematte and jasonrhunter May 24, 2022 17:04
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 24, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 24, 2022
@abyrne55 abyrne55 added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 24, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 24, 2022

@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.

@boranx
Copy link
Member

boranx commented May 25, 2022

/hold
/lgtm

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
unhold upon your availability

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 25, 2022
Copy link
Member

@boranx boranx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 25, 2022
@abyrne55
Copy link
Contributor Author

(personal thoughts) I think in general it's better to put filtering logic into code and let db layer just query the data

@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.

@abyrne55
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 25, 2022
@openshift-merge-robot openshift-merge-robot merged commit 64507e7 into openshift:main May 25, 2022
@abyrne55 abyrne55 deleted the OSD-11288 branch May 25, 2022 19:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants