-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore: add missing shiftby in alert rule #6239
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
Conversation
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.
👍 Looks good to me! Reviewed everything up to ca5c756 in 42 seconds
More details
- Looked at
259
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. pkg/query-service/model/v3/v3.go:793
- Draft comment:
Consider adding a check for an emptyArgs
list inSetShiftByFromFunc
to prevent potential panics. Log an error ifArgs
is empty, as this is an unexpected state. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The function already checks for the length ofArgs
before accessing it, so there is no risk of a panic. The suggestion to log an error ifArgs
is empty is more about logging unexpected states rather than preventing a panic. This could be considered a code quality improvement, but it's not strictly necessary for functionality.
I might be underestimating the importance of logging unexpected states for debugging purposes. Logging could help in identifying issues during runtime that are not immediately apparent.
While logging unexpected states can be useful, the absence of such logging does not constitute a functional issue. The current implementation prevents panics, which is the primary concern.
The comment suggests a code quality improvement by logging unexpected states, but it is not necessary for functionality. The function already prevents panics by checking the length ofArgs
.
2. pkg/query-service/app/parser.go:1145
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_FeDb6yhV4gFprvG9
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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
Summary
Part of #6151
Prior to this change, shift by happened only during the
/query_range
, making the alert created with shift by useless.Important
Add
shiftBy
functionality to alert rules by implementingSetShiftByFromFunc()
inBuilderQuery
and applying it in query parsing and preparation.SetShiftByFromFunc()
method toBuilderQuery
inv3.go
to handleshiftBy
functionality.SetShiftByFromFunc()
inParseQueryRangeParams
inparser.go
andprepareQueryRange
inthreshold_rule.go
to setshiftBy
during alert rule creation.parser_test.go
andthreshold_rule_test.go
to verifyshiftBy
functionality for builder queries withtimeShift
function.ParseQueryRangeParams
inparser.go
to useSetShiftByFromFunc()
for cleaner code.This description was created by
for ca5c756. It will automatically update as commits are pushed.